aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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))