1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-22 17:06:17 +00:00

Dropped python-daemon and its daemon-runner wrapper

This makes the watcher persisting with the terminal, breaking
installs using it as a initd/sysV daemon. The watcher currently
doesn't print anything on standard output or standard error.

Closes #39, #72
This commit is contained in:
spl0k 2017-10-08 16:22:04 +02:00
parent 81609be7ce
commit 62bcce331a
3 changed files with 15 additions and 18 deletions

View File

@ -30,7 +30,7 @@ For more details, go check the [API implementation status][api].
* [Transcoding](#transcoding)
* [Command line interface](#command-line-interface)
* [Quickstart](#quickstart)
* [Scanner daemon](#scanner-daemon)
* [Watching library changes](#watching-library-changes)
* [Upgrading](#upgrading)
## Installation
@ -353,12 +353,15 @@ Once you've added a folder, you will need to scan it:
You should now be able to enjoy your music with the client of your choice!
## Scanner daemon
## Watching library changes
Instead of manually running a scan every time your library changes, you can
run a daemon that will listen to any library change and update the database
accordingly. The daemon is `bin/supysonic-watcher` and can be run as an
*init.d* script.
run a watcher that will listen to any library change and update the database
accordingly.
The watcher is `bin/supysonic-watcher`, it is a non-exiting process and doesn't
print anything to stdout nor stderr. If you want to keep it running in
background, either use the old `nohup` or `screen` methods, or start it as a
simple systemd unit (unit file not included).
## Upgrading

View File

@ -4,7 +4,7 @@
# This file is part of Supysonic.
#
# Supysonic is a Python implementation of the Subsonic server API.
# Copyright (C) 2014 Alban 'spl0k' Féron
# Copyright (C) 2014-2017 Alban 'spl0k' Féron
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@ -19,16 +19,9 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from daemon.runner import DaemonRunner
from supysonic.watcher import SupysonicWatcher
watcher = SupysonicWatcher()
watcher.stdin_path = '/dev/null'
watcher.stdout_path = '/dev/tty'
watcher.stderr_path = '/dev/tty'
watcher.pidfile_path = '/tmp/supysonic-watcher.pid'
watcher.pidfile_timeout = 5
daemon_runner = DaemonRunner(watcher)
daemon_runner.do_action()
if __name__ == "__main__":
watcher = SupysonicWatcher()
watcher.run()

View File

@ -3,7 +3,7 @@
# This file is part of Supysonic.
#
# Supysonic is a Python implementation of the Subsonic server API.
# Copyright (C) 2014 Alban 'spl0k' Féron
# Copyright (C) 2014-2017 Alban 'spl0k' Féron
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@ -20,7 +20,7 @@
import time
import logging
from signal import signal, SIGTERM
from signal import signal, SIGTERM, SIGINT
from threading import Thread, Condition, Timer
from logging.handlers import TimedRotatingFileHandler
from watchdog.observers import Observer
@ -241,6 +241,7 @@ class SupysonicWatcher(object):
store.close()
signal(SIGTERM, self.__terminate)
signal(SIGINT, self.__terminate)
self.__running = True
queue.start()