diff --git a/config.sample b/config.sample index 66f3162..7b2b548 100644 --- a/config.sample +++ b/config.sample @@ -35,6 +35,9 @@ log_level = WARNING ; Default: /tmp/supysonic/supysonic.sock socket = /var/run/supysonic.sock +; Defines if the file watcher should be started. Default: yes +run_watcher = yes + ; Delay before triggering scanning operation after a change have been detected ; This prevents running too many scans when multiple changes are detected for a ; single file over a short time span. Default: 5 diff --git a/docs/configuration.md b/docs/configuration.md index a52d64e..806df69 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -132,6 +132,9 @@ between the daemon and clients that rely on it (eg. CLI, folder admin web page, etc.). Note that using an IP address here isn't supported. Default: /tmp/supysonic/supysonic.sock +`run_watcher`: whether or not to start the watcher that will listen for library +changes. Default: yes + `wait_delay`: delay before triggering the scanning operation after a change have been detected. This prevents running too many scans when multiple changes are detected for a single file over a short time span. Default: 5 seconds. @@ -149,6 +152,9 @@ If left empty, any logging will be sent to stderr. ; Default: /tmp/supysonic/supysonic.sock socket = /var/run/supysonic.sock +; Defines if the file watcher should be started. Default: yes +run_watcher = yes + ; Delay before triggering scanning operation after a change have been detected ; This prevents running too many scans when multiple changes are detected for a ; single file over a short time span. Default: 5 diff --git a/supysonic/config.py b/supysonic/config.py index 2c5f495..5dc4da3 100644 --- a/supysonic/config.py +++ b/supysonic/config.py @@ -40,6 +40,7 @@ class DefaultConfig(object): } DAEMON = { 'socket': os.path.join(tempdir, 'supysonic.sock'), + 'run_watcher': True, 'wait_delay': 5, 'log_file': None, 'log_level': 'WARNING' diff --git a/supysonic/daemon.py b/supysonic/daemon.py index bad8ea6..3262a6e 100644 --- a/supysonic/daemon.py +++ b/supysonic/daemon.py @@ -62,7 +62,8 @@ class Daemon(object): def __handle_connection(self, connection): try: module, cmd, args = connection.recv() - if module == WATCHER: + logger.debug('Received %s %s %s', module, cmd, args) + if module == WATCHER and self.__watcher is not None: if cmd == W_ADD: self.__watcher.add_folder(*args) elif cmd == W_DEL: @@ -74,8 +75,9 @@ class Daemon(object): self.__listener = Listener(address = self.__address, authkey = get_secret_key('daemon_key')) logger.info("Listening to %s", self.__listener.address) - self.__watcher = SupysonicWatcher(config) - self.__watcher.start() + if config.DAEMON['run_watcher']: + self.__watcher = SupysonicWatcher(config) + self.__watcher.start() while True: conn = self.__listener.accept()