summaryrefslogtreecommitdiff
path: root/watcher.py
diff options
context:
space:
mode:
authorMichaël Ball <michael.ball@gmail.com>2014-12-24 17:52:04 +0000
committerMichaël Ball <michael.ball@gmail.com>2014-12-24 17:52:04 +0000
commit601198884d58c0f3825e7108a9adb4dc4353ff5c (patch)
tree61740d70677e3da94ded71d8a9a6ec741dd5b24c /watcher.py
parent765a2d306b1d64480933999af96a7df6e9053934 (diff)
Better searching methods
Diffstat (limited to 'watcher.py')
-rw-r--r--watcher.py9
1 files changed, 7 insertions, 2 deletions
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: