S019: tag model with lofty, merge and Keep edits, cover set/remove

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
astar76 2026-11-18 10:14:22 -06:00
commit 1d82c1241d

View file

@ -56,5 +56,11 @@ One entry per session, newest last, ≤ 15 lines: done, verified how, not done,
- Not done: cancel and timeout paths not exercised (code only); SVG `<text>` did not render in the smoke run (system fonts not found in this environment; geometry fine); local files only — remote requests are gated by the flag, the pool reads `std::fs` (S018/UI must hand remote files over another way).
- Later: stale-thumbnail cleanup; video thumbnails of very short clips use first frame only when seek fails.
## S019 — Tag model with lofty
- Done: `tunal-tags` (lofty only). `TrackTags` (`Option` fields: title, artist, album, album_artist, track_no/total, disc_no/total, date, genre, composer, comment, six `mb_*_id`, `cover: Option<Cover { mime, data }>`, `other_pictures` count). `TagSet::merge(&[TrackTags])` → per field `Merged::{Same(Option<T>), Mixed}`. `TagEdit` (same fields as `Edit::{Keep, Set(v), Clear}`, `cover: CoverEdit::{Keep, Set(Cover), Remove}`; `is_empty`, `apply(&mut TrackTags)`, `TagEdit::set_all(&TrackTags)` for MusicBrainz apply). I/O: `read(path)`, `read_set(&[PathBuf]) -> (TagSet, Vec<(PathBuf, Error)>)`, `write(path, &TagEdit)` (touches only named fields; other items and non-front pictures kept; Keep-only edit writes nothing), `write_many`. `Error::{Io, Tag(String), BadImage}`. Cover must be JPEG/PNG (checked by magic bytes); MP4 front cover = its first picture. Example `tags [--title/--artist/--album/--comment/--track T] [--cover IMG|--no-cover] <files>` (edits in place: scratch copies only).
- Verified: workspace build, clippy -D warnings, fmt --check; ffmpeg fixtures mp3/flac/ogg/m4a in the scratchpad: title+track+cover written and read back on all four, PNG→JPEG replace, cover remove, non-image cover refused, comment/album round trip, untouched artist/genre kept, merged view over four files (cover Mixed when they differ).
- 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.
## Later
-