S020: MusicBrainz and Cover Art Archive client with rate limit and track matching
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
parent
cd4fa920f2
commit
f71048eac9
1 changed files with 888 additions and 7 deletions
|
|
@ -62,5 +62,12 @@ One entry per session, newest last, ≤ 15 lines: done, verified how, not done,
|
|||
- Not done: tracker artifact not updated (session had no ArtifactData). Dates are the raw string (`RecordingDate`, falls back to `Year`); no Timestamp parsing.
|
||||
- Later: Vorbis `COMMENT` key (non-standard, ffmpeg writes it) is not read as the comment, only `DESCRIPTION`; lofty rewrites the file in place (no temp-file + rename); sort-order and lyrics fields; multi-value artists.
|
||||
|
||||
## S020 — MusicBrainz and Cover Art Archive client
|
||||
- Done: `tunal_tags::Client` (`Client::new()` real services; `Client::with_bases(mb, caa)` for mocks). `search_releases(artist, album, track_count, limit) -> Vec<ReleaseHit { id, title, artist, date, country, track_count, release_group_id, score }>`, `search_recordings(title, artist, album, limit) -> Vec<RecordingHit { id, title, artist, length_ms, releases, score }>`, `release(id) -> Option<Release { id, title, artist, artist_ids, date, country, release_group_id, genres, disc_total, tracks: Vec<Track { disc, position, disc_track_count, title, artist, artist_ids, recording_id, track_id, length_ms }> }>`, `front_cover(release_id) -> Option<Cover>` (front-500, redirects followed, JPEG/PNG only; same `Cover` as S019). `match_tracks(&[FileInfo { disc, track, title, duration_ms }], &Release) -> Vec<Option<usize>>` (index into `release.tracks`; position 60 + duration ≤ 3 s up to 20 + title bigram similarity up to 40, threshold 40, each track once). Errors `NetError::{Http, Status, Parse}`; all calls are blocking (run off the UI thread).
|
||||
- HTTP: `ureq` 3 with rustls + ring (`cargo tree -i aws-lc-rs` empty), User-Agent `Tunal/<version> ( … )`, one process-wide limiter (≥ 1 s between requests to either service, shared by all `Client`s), 503/429 retried after 2 s, 4 s, 8 s then `Status`; 404 → `None`; 30 s timeout, 16 MiB body cap. Workspace deps added: ureq, serde, serde_json. Mapping of `Release` to tags (`mb_*` ids, track/disc totals, genre) is left to the editor plan (S021) via `TagEdit`.
|
||||
- Verified: build and clippy -D warnings and fmt --check for `tunal-tags`; example `mb` against a scratchpad mock (python, not committed): requests 1 s apart (stamps 0.00/1.00/…), lookup got 503 once and succeeded after the 2 s pause, cover via 307 redirect, matching of 3 made-up files. Real services never contacted.
|
||||
- Not done: workspace-wide clippy currently fails in `tunal-core` (S008's in-progress `playlist.rs`), not in this plan's files. Real MusicBrainz JSON shape checked against docs only, not live. No search by AcoustID.
|
||||
- Later: `inc` for labels/barcode; honour `Retry-After`; cache of lookups.
|
||||
|
||||
## Later
|
||||
-
|
||||
|
|
|
|||
Loading…
Reference in a new issue