mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-09-17 10:20:09 +00:00
feat(library): 3-tab Fix-metadata popup — Details / Cover art / Match (slice 4)
Turns the thin single-song fix-match modal into the Plex-style metadata
editor reached from a card's "Fix metadata…" menu:
- Details tab: type + lock the displayed title/artist/album/year. Values
ride the reversible override store (GET/PUT /api/song/{fn}/overrides); each
field sits on its pack value (Yours/Pack provenance + revert-to-pack), a lock
pins it against auto-match, and Save repaints the grid via library:changed
(slice-3 overlay). This is the real tool for the blank-artist city-pop pile
MusicBrainz can't surface — you just type the right title.
- Cover art tab: hands off to the shared image picker (its own modal); the
pick refreshes the thumbnail everywhere.
- Match tab: the existing MusicBrainz search + candidate/pick flow, refactored
into shared body/footer helpers (the queue-review flow is untouched).
Backend: GET /overrides now also returns the pack baseline so the Details tab
can pre-fill + show provenance. tailwind.min.css regenerated (build-tailwind.sh)
for the popup's new utility classes.
Identify-by-audio (AcoustID) is deferred: it lives in unmerged PR #759, off
main — the Match tab gains the button once #759 lands and this branch rebases.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
committed by
byrongamatos
co-authored by
Claude Opus 4.8
parent
c61aa008ba
commit
9ace7a3401
@@ -1266,6 +1266,17 @@ class MetadataDB:
|
||||
out.setdefault(fn, {})[field] = {"value": value, "locked": bool(locked)}
|
||||
return out
|
||||
|
||||
def pack_fields(self, filename: str) -> dict:
|
||||
"""The stored (pack) values for the overridable catalog fields — the
|
||||
Fix-metadata popup shows these behind each override as the 'revert to
|
||||
pack' reference + the Yours/Pack provenance. Empty strings for a missing
|
||||
song so the popup always has a value to render."""
|
||||
keys = ("title", "artist", "album", "year", "genre")
|
||||
row = self.conn.execute(
|
||||
"SELECT title, artist, album, year, genre FROM songs WHERE filename = ?",
|
||||
(filename,)).fetchone()
|
||||
return {k: ((row[i] or "") if row else "") for i, k in enumerate(keys)}
|
||||
|
||||
def set_song_tags(self, filename: str, tags) -> list:
|
||||
"""Replace ALL of a song's tags with the given set (each normalized;
|
||||
blanks + case-dupes dropped). Full-replace so the whole personal-meta
|
||||
@@ -9203,9 +9214,13 @@ _OVERRIDE_FIELDS = frozenset({"title", "artist", "album", "year", "genre"})
|
||||
@app.get("/api/song/{filename:path}/overrides")
|
||||
def get_song_overrides(filename: str):
|
||||
"""Per-field metadata overrides + locks for one song (Fix-metadata popup):
|
||||
{"overrides": {field: {"value": str|null, "locked": bool}}}."""
|
||||
return {"overrides": meta_db.get_song_overrides(
|
||||
meta_db._canonical_song_filename(filename))}
|
||||
{"overrides": {field: {"value": str|null, "locked": bool}},
|
||||
"pack": {field: str}}. `pack` is the stored value each override sits on top
|
||||
of — the popup's Details tab renders it as the revert-to-pack reference and
|
||||
the Yours/Pack provenance."""
|
||||
key = meta_db._canonical_song_filename(filename)
|
||||
return {"overrides": meta_db.get_song_overrides(key),
|
||||
"pack": meta_db.pack_fields(key)}
|
||||
|
||||
|
||||
@app.put("/api/song/{filename:path}/overrides")
|
||||
|
||||
Reference in New Issue
Block a user