aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Wang2024-07-28 02:11:06 +0000
committerAnthony Wang2024-07-28 02:11:06 +0000
commit945c2da5d02df0d1014e47cdef09d6f308078e62 (patch)
tree4417f957dba83003f52abe7c2248aedb04f11ac8
parent59641e75d47e4186a2fec0e5d2c16116d2471090 (diff)
Ignore FileOpenedEvent
-rw-r--r--server.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/server.py b/server.py
index 1e02a20..d1c41d5 100644
--- a/server.py
+++ b/server.py
@@ -10,7 +10,7 @@ from xmlrpc.server import SimpleXMLRPCDispatcher, SimpleXMLRPCRequestHandler
import pillow_avif
import sqlite_vec
from watchdog.observers import Observer
-from watchdog.events import FileSystemEventHandler
+from watchdog.events import FileSystemEventHandler, FileOpenedEvent
import model
@@ -39,9 +39,10 @@ def get_parent(path):
class EventHandler(FileSystemEventHandler):
def dispatch(self, event):
- with lock:
- print(event)
- super().dispatch(event)
+ if not isinstance(event, FileOpenedEvent):
+ with lock:
+ print(event)
+ super().dispatch(event)
def on_created(self, event):
index(event.src_path, get_parent(event.src_path))