From 601198884d58c0f3825e7108a9adb4dc4353ff5c Mon Sep 17 00:00:00 2001 From: Michaƫl Ball Date: Wed, 24 Dec 2014 17:52:04 +0000 Subject: Better searching methods --- watcher.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'watcher.py') diff --git a/watcher.py b/watcher.py index d1e4ab6..9af4a6b 100644 --- a/watcher.py +++ b/watcher.py @@ -1,5 +1,6 @@ import atexit import configparser +import os import pyinotify @@ -13,7 +14,9 @@ class EventHandler(pyinotify.ProcessEvent): def process_IN_DELETE(self, event): print("Removing:", event.pathname) - library.delete_file(event.pathname) + + if not os.path.isdir(event.pathname): + library.delete_file(event.pathname) def process_IN_MOVED_TO(self, event): print("Moved to:", event.pathname) @@ -24,7 +27,9 @@ class EventHandler(pyinotify.ProcessEvent): def process_IN_MODIFY(self, event): print("Modified:", event.pathname) - library.update_file(event.pathname) + + if not os.path.isdir(event.pathname): + library.update_file(event.pathname) class LibraryWatcher: -- cgit v1.2.3