]> git.treefish.org Git - photosort.git/blobdiff - src/dirtrigger.py
ignore deletion events
[photosort.git] / src / dirtrigger.py
index 7978df3555dd663d10efe4aabaf3f61a82567ba2..2ea981ccd6afd66cd678d84df9c8dd91f038eb61 100644 (file)
@@ -1,6 +1,6 @@
 import threading
 import time
-from watchdog.events import FileSystemEventHandler
+from watchdog.events import DirDeletedEvent, FileDeletedEvent, FileSystemEventHandler
 from watchdog.observers import Observer
 
 class DirTrigger(FileSystemEventHandler):
@@ -35,6 +35,9 @@ class DirTrigger(FileSystemEventHandler):
         self._last_reset_time = time.time()
 
     def on_any_event(self, event):
+        if event.event_type == FileDeletedEvent or event.event_type == DirDeletedEvent:
+            return
+
         self._lock.acquire()
         try:
             self._got_event = True