feat: MusicBrainz-aware intake and completeness check against canonical track count
This commit is contained in:
@@ -101,6 +101,7 @@ def run_pipeline(
|
||||
conn: psycopg.Connection,
|
||||
job_id: str,
|
||||
adapters: Sequence[SourceAdapter],
|
||||
resolver=None,
|
||||
min_confidence: float = 0.7,
|
||||
dest_root: str = "/music",
|
||||
) -> None:
|
||||
@@ -112,6 +113,10 @@ def run_pipeline(
|
||||
# 1. intake
|
||||
_set_state(conn, job_id, "matching", "intake")
|
||||
target = _load_target(conn, job_id)
|
||||
if resolver is not None:
|
||||
resolved = resolver.resolve(target.artist, target.album)
|
||||
if resolved is not None:
|
||||
target = resolved
|
||||
if _already_in_library(conn, target):
|
||||
_set_state(conn, job_id, "imported", "import")
|
||||
with conn.cursor() as cur:
|
||||
@@ -161,9 +166,10 @@ def run_pipeline(
|
||||
_fail(conn, job_id, "all downloads failed")
|
||||
return
|
||||
|
||||
# 5. tag (integrity check; real tagging is Plan 4)
|
||||
# 5. tag (integrity check against the canonical track count when known)
|
||||
_set_state(conn, job_id, "tagging", "tag")
|
||||
if result.track_count != winner.track_count:
|
||||
expected = target.track_count if target.track_count is not None else winner.track_count
|
||||
if result.track_count < expected:
|
||||
_fail(conn, job_id, "incomplete download")
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user