feat: extend file watcher to support all indexable file types beyond markdown
This commit is contained in:
parent
c5e395005f
commit
d020264ba3
@ -7,11 +7,11 @@ from typing import Callable, Dict, List, Optional
|
|||||||
from watchdog.observers import Observer
|
from watchdog.observers import Observer
|
||||||
from watchdog.observers.polling import PollingObserver
|
from watchdog.observers.polling import PollingObserver
|
||||||
from watchdog.events import FileSystemEventHandler
|
from watchdog.events import FileSystemEventHandler
|
||||||
|
from backend.indexer import SUPPORTED_EXTENSIONS
|
||||||
|
|
||||||
logger = logging.getLogger("obsigate.watcher")
|
logger = logging.getLogger("obsigate.watcher")
|
||||||
|
|
||||||
# Extensions de fichiers surveillées
|
# Extensions de fichiers surveillées
|
||||||
WATCHED_EXTENSIONS = {'.md', '.markdown'}
|
|
||||||
IGNORED_DIRS = {'.obsidian', '.trash', '.git', '__pycache__', 'node_modules'}
|
IGNORED_DIRS = {'.obsidian', '.trash', '.git', '__pycache__', 'node_modules'}
|
||||||
|
|
||||||
|
|
||||||
@ -37,7 +37,9 @@ class VaultEventHandler(FileSystemEventHandler):
|
|||||||
p = Path(path)
|
p = Path(path)
|
||||||
if any(part in IGNORED_DIRS for part in p.parts):
|
if any(part in IGNORED_DIRS for part in p.parts):
|
||||||
return False
|
return False
|
||||||
return p.suffix.lower() in WATCHED_EXTENSIONS
|
suffix = p.suffix.lower()
|
||||||
|
basename_lower = p.name.lower()
|
||||||
|
return suffix in SUPPORTED_EXTENSIONS or basename_lower in ("dockerfile", "makefile", "cmakelists.txt")
|
||||||
|
|
||||||
def _enqueue(self, event_type: str, src: str, dest: str = None):
|
def _enqueue(self, event_type: str, src: str, dest: str = None):
|
||||||
"""Thread-safe : envoyer l'événement vers l'event loop asyncio."""
|
"""Thread-safe : envoyer l'événement vers l'event loop asyncio."""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user