]> git.treefish.org Git - photosort.git/commitdiff
ignore deletion events daemon
authorAlexander Schmidt <alex@treefish.org>
Mon, 19 Oct 2020 12:25:04 +0000 (14:25 +0200)
committerAlexander Schmidt <alex@treefish.org>
Mon, 19 Oct 2020 12:25:04 +0000 (14:25 +0200)
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