Repository navigation
Bulk edit via MusicBrainz: album lookup for a selection (#42) - #58
Merged
Merged
Conversation
Adds "Look up on MusicBrainz" to the bulk action bar, so it works in every view that can select songs - folders, smart playlists and recently played, including whole-folder and whole-playlist selections, which the server resolves like the other bulk actions. The release is searched once by album and album artist. The selected songs are matched to its tracks by disc/track number, then title, then length; every match can be changed or left out. Each song is written its own track's tags, only the fields that change, optionally with the release's front cover. Closes suitux#42
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.
Closes #42.
Adds a Look up on MusicBrainz action to the bulk action bar. The bar sits on the song table that every view uses, so the lookup works the same in folders, smart playlists and recently played - including "select entire folder / smart playlist", which the server resolves like the other bulk actions.
How it works
Search the release once, by album and album artist. Both are prefilled with the values most of the selected songs share. The results show year, country, media (e.g. 2×CD), track count, label / catalog number and barcode, so editions can be told apart.
Match the songs to the release's tracks, the way Picard does for a known album:
A number is not trusted when title and length both disagree (another edition of the album). A badge shows how each match was found. Every match can be changed by hand, and every song can be left out.
Choose the fields: the same ones as the single-song lookup except genre, which the release lookup does not return. Optionally the release's front cover is written to all songs; it is fetched once.
Apply goes through the existing bulk confirm dialog with its progress bar and the bulk summary. Each song gets its own track's values, and only fields that actually change are written, so the history lists real changes only.
Implementation
GET /api/musicbrainz/releases- release search (release:+artist:).GET /api/musicbrainz/release/[id]/tracks- every track of a release with the tags it would write, via a newmapReleaseTracks()on top ofmapToSongMetadata(). The track's own position and its artist credit win, which matters for compilations and for a recording that appears twice on a release.POST /api/songs/bulk/musicbrainz/songs- resolves the bulk target and returns the fields needed for matching and comparing (at most 500 songs, since they are matched against a single release).PATCH /api/songs/bulk/musicbrainz/apply- NDJSON stream like the other bulk routes. Each item carries its own metadata, which is checked againstMUSIC_BRAINZ_FIELDS.src/features/musicbrainz/bulk-lookup.ts, with tests.Tested
vitest run: 317 tests pass, 15 of them new, for the matching, the comparison of current values, building the writes and validating an apply request.eslintclean on all new and changed files.tsc: only the two existing errors indetail-panel-preview-card.tsx, the same as on main.prettier: clean for the new files and the changed lines.bulk-action-bar.tsx,bulk-action-bar-pill.tsxandsongs.repository.tswere already flagged on main, so I only formatted my own lines there.