fix pipe
This commit is contained in:
@@ -540,3 +540,38 @@ def enable_matrix_features() -> None:
|
||||
_MATRIX_AVAILABLE = True
|
||||
_MATRIX_UNAVAILABLE_REASON = None
|
||||
logger.info("[Matrix] Features manually enabled")
|
||||
|
||||
|
||||
def initialize_local_library_scan(config: Dict[str, Any]) -> None:
|
||||
"""Initialize and scan local library at startup.
|
||||
|
||||
This ensures that any new files in the local library folder are indexed
|
||||
and their sidecar files are imported and cleaned up.
|
||||
"""
|
||||
from config import get_local_storage_path
|
||||
from helper.local_library import LocalLibraryInitializer
|
||||
|
||||
logger.info("[Startup] Starting Local Library scan...")
|
||||
|
||||
try:
|
||||
storage_path = get_local_storage_path(config)
|
||||
if not storage_path:
|
||||
debug("⚠️ Local Library: SKIPPED - No storage path configured", file=sys.stderr)
|
||||
return
|
||||
|
||||
debug(f"Scanning local library at: {storage_path}", file=sys.stderr)
|
||||
initializer = LocalLibraryInitializer(storage_path)
|
||||
stats = initializer.scan_and_index()
|
||||
|
||||
# Log summary
|
||||
new_files = stats.get('files_new', 0)
|
||||
sidecars = stats.get('sidecars_imported', 0)
|
||||
|
||||
if new_files > 0 or sidecars > 0:
|
||||
debug(f"✅ Local Library: Scanned - New files: {new_files}, Sidecars imported: {sidecars}", file=sys.stderr)
|
||||
else:
|
||||
debug("✅ Local Library: Up to date", file=sys.stderr)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"[Startup] Failed to scan local library: {e}", exc_info=True)
|
||||
debug(f"⚠️ Local Library: ERROR - Scan failed: {e}", file=sys.stderr)
|
||||
|
||||
Reference in New Issue
Block a user