Align the fetch-lyrics summary with fetch-artists via shared utils

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-04 15:34:26 +08:00
co-authored by Claude Fable 5
parent 2af5458e6b
commit 6d7153e48c
8 changed files with 68 additions and 36 deletions
@@ -43,6 +43,7 @@ from .models import (
Song,
SongArtist,
)
from .utils import format_duration
PROVENANCE_FIELDS: Sequence[str] = (
"song_id", "source", "method", "acquired_at", "note")
@@ -228,6 +229,7 @@ def main(argv: list[str] | None = None) -> int:
:return: The exit status: 0 on success, misses included,
non-zero on a setup error.
"""
started: float = time.monotonic()
args: argparse.Namespace = parse_args(argv)
fetcher: LyricsFetcher = LyricsFetcher()
fetched: int = 0
@@ -264,6 +266,9 @@ def main(argv: list[str] | None = None) -> int:
return 1
finally:
session.close()
print(f"done: {fetched} fetched, {missed} missed",
attempted: int = fetched + missed
elapsed: str = format_duration(time.monotonic() - started)
print(f"Done. Fetched lyrics for {fetched}/{attempted}"
f" songs. {elapsed} elapsed.",
file=sys.stderr)
return 0