This commit is contained in:
2026-01-19 06:24:09 -08:00
parent a961ac3ce7
commit 7ddf0065d1
45 changed files with 627 additions and 411 deletions

View File

@@ -55,6 +55,7 @@ def _db_retry(max_attempts: int = 6, base_sleep: float = 0.1):
return _decorator
# Try to import optional dependencies
mutagen: Any
try:
import mutagen
except ImportError:
@@ -72,12 +73,12 @@ try:
METADATA_AVAILABLE = True
except ImportError:
_read_sidecar_metadata = None
_derive_sidecar_path = None
write_tags = None
write_tags_to_file = None
embed_metadata_in_file = None
read_tags_from_file = None
_read_sidecar_metadata = None # type: ignore
_derive_sidecar_path = None # type: ignore
write_tags = None # type: ignore
write_tags_to_file = None # type: ignore
embed_metadata_in_file = None # type: ignore
read_tags_from_file = None # type: ignore
METADATA_AVAILABLE = False
# Media extensions to index
@@ -219,7 +220,7 @@ class API_folder_store:
"""
self.library_root = expand_path(library_root).resolve()
self.db_path = self.library_root / self.DB_NAME
self.connection: Optional[sqlite3.Connection] = None
self.connection: sqlite3.Connection = None # type: ignore
# Use the shared lock
self._db_lock = self._shared_db_lock
mm_debug(f"[folder-db] init: root={self.library_root} db={self.db_path}")
@@ -3818,7 +3819,7 @@ def migrate_all(library_root: Path,
db),
}
finally:
if should_close:
if should_close and db is not None:
db.close()