admin: editable MB work IDs and alternate titles on song detail#216
Merged
Conversation
Add inline editors to the admin song detail page: - MB Work ID and Secondary MB Work ID are both shown and editable. Entering an ID runs a MusicBrainz work lookup (cached via MusicBrainzSearcher) that surfaces the id, title, and composer/ writer/lyricist credits; Save is gated on a successful lookup so an unverified ID cannot be persisted. Slots with a value get Clear. - Alternate titles render under the song title as chips with an add/remove editor that saves to songs.alt_titles. Backing endpoints: - GET /admin/musicbrainz/work/<id>/lookup - POST /admin/songs/<id>/mb-id (slot: primary|second) - POST /admin/songs/<id>/alt-titles CSRF is handled by the existing admin.js fetch wrapper. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds inline editing to the admin song detail page for MusicBrainz work IDs and alternate titles.
MusicBrainzSearcher) that surfaces the id, title, and composer/writer/lyricist credits. Save is gated on a successful lookup, so an unverified ID can't be persisted — editing the field after a lookup re-disables Save. Slots that already hold a value get a Clear button.songs.alt_titles.Endpoints
GET /admin/musicbrainz/work/<id>/lookup— UUID-validated; returns{id, title, composers:[{name,type}]}POST /admin/songs/<id>/mb-id—slot: primary|second, set or clearPOST /admin/songs/<id>/alt-titles— replacesalt_titles(trim/de-dupe/empty→NULL)CSRF is handled automatically by the existing
static/js/admin.jsfetch wrapper.Verification
admin.pycompiles; all three routes register in the app URL map.<script>blocks passnode --check.Live DB write tests were not run, since the local
.envDATABASE_URLpoints at production.Note
This screen edits the
second_mb_idvalue only — it does not trigger a re-import of recordings from the newly-set work (the dual-worksource_mb_work_idtagging). A "re-research" trigger could be wired in as a follow-up.🤖 Generated with Claude Code