2.1 KiB
src/core/legacy_meta.py
Readers for Curator's pre-index metadata layouts.
Before the unified pool index (.Curator.!index), Tagger / early Curator stored
a movie's metadata in a per-file sidecar .{filename}.!tag (JSON) sitting
next to the video. When importing a file that came from such a pool we can
recover its ČSFD link (and title / year) from that sidecar — or from an old
.Curator.!index found by walking up from the file.
This is read-only recovery for the import dialog; nothing here writes.
Source: src/core/legacy_meta.py
Classes
LegacyMeta
class · line 25
class LegacyMeta:
What an old sidecar / index record can still tell us about a movie.
Functions
_record_to_meta
function · line 34
_record_to_meta(record: object, source: str) -> Optional[LegacyMeta]
Pull the useful fields out of a stored movie record (any schema version).
_from_sidecar
function · line 51
_from_sidecar(video_path: Path) -> Optional[LegacyMeta]
Read the metadata from the per-file .{name}.!tag JSON sidecar next to a video, or return None when there is no readable sidecar.
_lookup_in_index
function · line 62
_lookup_in_index(movies: dict, video_path: Path, index_dir: Path) -> Optional[dict]
Find the record for video_path in an index's movies map.
Tries the exact pool-relative key first, then falls back to a unique basename match (the file may have moved since the index was written).
_from_legacy_index
function · line 79
_from_legacy_index(video_path: Path) -> Optional[LegacyMeta]
Read the metadata from a .Curator.!index file found by walking up at most _MAX_INDEX_WALK_UP directories from the video. Returns None if nothing matches.
read_legacy_meta
function · line 99
read_legacy_meta(video_path: Path) -> Optional[LegacyMeta]
Recover ČSFD link / title / year from a pre-index layout, or None.
Order: a per-file .{name}.!tag sidecar next to the video, then a
.Curator.!index found walking up (max 4 levels) from the file.