feat: Tagger seam and pipeline tag-stage integration
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -103,6 +103,7 @@ def run_pipeline(
|
||||
job_id: str,
|
||||
adapters: Sequence[SourceAdapter],
|
||||
resolver=None,
|
||||
tagger=None,
|
||||
min_confidence: float = 0.7,
|
||||
dest_root: str = "/music",
|
||||
) -> None:
|
||||
@@ -174,6 +175,12 @@ def run_pipeline(
|
||||
_fail(conn, job_id, "incomplete download")
|
||||
return
|
||||
|
||||
if tagger is not None:
|
||||
try:
|
||||
tagger.tag_album(dest, target)
|
||||
except Exception as e: # a tagging failure must not discard a good download
|
||||
print(f"pipeline: tagging failed for job {job_id}: {e}", flush=True)
|
||||
|
||||
# 6. import
|
||||
_set_state(conn, job_id, "imported", "import")
|
||||
_import(conn, job_id, target, winner, result.path or dest)
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
from typing import Protocol
|
||||
|
||||
from lyra_worker.types import MBTarget
|
||||
|
||||
|
||||
class Tagger(Protocol):
|
||||
def tag_album(self, album_dir: str, target: MBTarget) -> None:
|
||||
"""Tag the album's audio files with target's metadata and rename them."""
|
||||
...
|
||||
@@ -8,6 +8,7 @@ class MBTarget:
|
||||
track_count: int | None = None
|
||||
total_duration_s: int | None = None
|
||||
year: int | None = None
|
||||
tracklist: tuple[str, ...] = ()
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
||||
Reference in New Issue
Block a user