diff options
author | Michaël Ball <michael.ball@gmail.com> | 2014-12-24 17:52:04 +0000 |
---|---|---|
committer | Michaël Ball <michael.ball@gmail.com> | 2014-12-24 17:52:04 +0000 |
commit | 601198884d58c0f3825e7108a9adb4dc4353ff5c (patch) | |
tree | 61740d70677e3da94ded71d8a9a6ec741dd5b24c /watcher.py | |
parent | 765a2d306b1d64480933999af96a7df6e9053934 (diff) |
Better searching methods
Diffstat (limited to 'watcher.py')
-rw-r--r-- | watcher.py | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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: |