Code Monkey home page Code Monkey logo

Comments (7)

spl0k avatar spl0k commented on August 17, 2024

That would be a good idea, but since supysonic is a WSGI application and not a standalone one, it will certainly require another process/daemon for the file system watcher.
I'll take a look...

from supysonic.

andrenam avatar andrenam commented on August 17, 2024

Oups, wrong buttons. You're right. But right now I use the CLI via cronjob.

I wonder: How is that working when the daemon watches the music directory and you add or remove a new music directory via web interface at runtime?

from supysonic.

spl0k avatar spl0k commented on August 17, 2024

Right now I see three solutions:

  • restart the daemon each time you edit the music directory list
  • write the music directory list to a file (automatically modified each time you add or remove a directory) and have the daemon also monitor this file
  • have the daemon query the list on a regular basis and then start or stop watchers accordingly

The first one is the easiest, and I guess if you have administrative rights on the app, you should also have access to the server to create/delete the folders on disk and then the rights to start daemons.
The second solution is ugly, I wouldn't go that way.
Either way, they would require the user to run a scan if a creates a directory that is not empty when the watcher is started.

I came across watchdog for a cross-platform implementation.

from supysonic.

andrenam avatar andrenam commented on August 17, 2024

Hi spl0k, sorry for the late feedback. I forgot about it.
I just tested it and it seems to work so far.
I had a little problem with watchdog failing with an exception when I had subfolders that could not be opened due to missing permissions (.Trash-1000 folders, etc.). But other than that, it seems fine. :-)

Great work! 👍

I started the watcher using a systemd service file:

[Unit]
Description=supysonic-watcher monitors music folders for the supysonic webapp
After=local-fs.target

[Service]
Type=simple
ExecStart=/path/to/supysonic-watcher
User=supysonic
Group=supysonic

[Install]
WantedBy=multi-user.target

from supysonic.

spl0k avatar spl0k commented on August 17, 2024

Thanks.
There's still a bit of work to do though. I plan on providing some OS-dependent scripts to run it as a real daemon and not just a foreground console command. I am thinking about an init script, systemd (maybe using yours as a starting point), and maybe others.

from supysonic.

andrenam avatar andrenam commented on August 17, 2024

Indeed, I googled and found python-daemon but didnt want to change so much since it would be platform-dependent.

from supysonic.

spl0k avatar spl0k commented on August 17, 2024

I'll finally won't provide any systemd file and leave it to package maintainers. Yours might need a small update as it not a simple service anymore but a forking one.

I guess the daemon is stable enough (and merged to master) so I'll close this issue, even if I plan on improving it.

from supysonic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.