feat(v3 library): "Write to file" in the Fix-metadata popup#778
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdded a "Write to file" workflow to the Details tab metadata editor in match-review.js, alongside the existing reversible "Save" overlay behavior. Introduced a new footer button wired to an async ChangesWrite to File Feature
Estimated code review effort: 2 (Simple) | ~12 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant DetailsTab
participant writeToFile
participant API as /api/song/{fn}/meta
participant Library
User->>DetailsTab: click Write to file
DetailsTab->>writeToFile: writeToFile(body, song)
writeToFile->>API: POST edited title/artist/album/year
API-->>writeToFile: response (persisted, coerced values)
writeToFile->>Library: emit library:changed (reason write)
alt persisted
writeToFile->>DetailsTab: clear overrides, keep locks, re-render tab
writeToFile->>DetailsTab: set status "Written to the song file."
else not persisted
writeToFile->>DetailsTab: keep overlay, set fallback status
end
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts
Comment |
📋 Merge order — metadata-curation epic (7 PRs)
#778–#780 are stacked (each based on the branch above), so GitHub re-points each to
|
d96627e to
fcb3b41
Compare
Completes the confirmed edit model: Save keeps edits as a reversible display
overlay (files untouched); "Write to file" bakes the shown title/artist/album/
year into the pack itself via the existing POST /api/song/{fn}/meta (writes the
manifest, re-stats, coalesces a rescan). On a real file write the now-redundant
override values are cleared (locks kept) and the tab re-renders, so the fields
read from the file as "Pack". Loose-folder / unwritable packs fall back to a
DB-only update and say so (may revert on a full rescan). Secondary button next
to Save; touches only the four file-safe fields, the rest of the pack verbatim.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
update_song_meta coerces a non-numeric/empty year to "" before persisting, but writeToFile optimistically set song.year to the raw typed text — so the library card flashed e.g. "abcd" until the next natural refresh. Apply the same integer coercion client-side so the in-memory song matches what was written. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
5f10762 to
0735d44
Compare
Completes the confirmed edit model for the Fix-metadata popup (stacked on #777).
Today the popup's Save keeps edits as a reversible display overlay — the pack/
.sloppakfiles are never touched. This adds the deliberate opt-in counterpart: Write to file bakes the shown title / artist / album / year into the pack itself, so other tools/apps see the corrected tags and the fix survives a full rescan.How
POST /api/song/{fn}/meta(already onmain: writes the manifest viasongmeta.write_song_metadata, re-stats, coalesces a rescan). No new backend — and no dependency on the heavier v3 library: per-field pack overwrite (R4b) — fix wrong author values, with receipts [DRAFT: gated on spec §7] #733 overwrite-with-backups feature, which is a separate thing.persisted: true): the now-redundant override values are cleared (any locks are kept), and the Details tab re-renders — so the fields read from the file as Pack, honestly reflecting that the fix now lives in the pack, not just the overlay.UX
Testing
node --checkclean. Verified on the testbed against the real library: the write path returnspersisted: true(repacks the.feedpak); Save vs Write-to-file are distinct, and a persisted write flips the field provenance from Yours to Pack.Stacked on #777 — merge that first (or land them together).
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes