diff --git a/app/app.py b/app/app.py index 375fe62..3c4cc37 100644 --- a/app/app.py +++ b/app/app.py @@ -24,7 +24,7 @@ def init(): global watcher_thread # Create and start the file watcher logger.info('Initializing File Watcher...') - watcher = Watcher([], on_library_change) + watcher = Watcher(on_library_change) watcher_thread = threading.Thread(target=watcher.run) watcher_thread.daemon = True watcher_thread.start() diff --git a/app/file_watcher.py b/app/file_watcher.py index 2145e4d..7fc488d 100644 --- a/app/file_watcher.py +++ b/app/file_watcher.py @@ -32,17 +32,14 @@ def call_it(): return decorator class Watcher: - def __init__(self, directories, callback): - self.directories = set(directories) # Use a set to store directories + def __init__(self, callback): + self.directories = set() # Use a set to store directories self.callback = callback self.event_handler = Handler(self.callback) self.observer = PollingObserver() self.scheduler_map = {} def run(self): - for directory in self.directories: - task = self.observer.schedule(self.event_handler, directory, recursive=True) - self.scheduler_map[directory] = task self.observer.start() logger.debug('Successfully started observer.')