musicbrainz: fetch composer/lyricist aliases - #6904
Open
NoDancing wants to merge 2 commits into
Open
Conversation
Composer and lyrcist names were always read from the raw musicbrainz name, even when a preferred language was set. Because musicbrainz API doesn't include aliases for these credits, we need a per-artist lookup. This adds that, made to only run when import.languages is set up. see beetbox#5885
Contributor
There was a problem hiding this comment.
Pull request overview
PR make MusicBrainz plugin use preferred-language aliases for composer and lyricist credits too (not just main artist). Since MusicBrainz work relations do not include alias payload, PR add per-artist lookup, but only when user actually set import.languages, and cache results so extra calls not explode.
Changes:
- Add cached per-artist
get_artist(... includes=aliases)lookup to fill missing alias data for composer/lyricist relations. - Update docs + changelog to say
import.languagesaffects composer/lyricist names too, and warn about extra requests (cached). - Add tests for: cached single fetch across multiple relations, skip fetch when no languages, and 404 fallback to raw name.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
beetsplug/musicbrainz.py |
Add alias cache + fetch helper, and use it in work-relation composer/lyricist parsing when import.languages set. |
beetsplug/_utils/musicbrainz.py |
Add get_artist API wrapper that requests aliases by default. |
test/plugins/test_musicbrainz.py |
Add regression tests for alias fetching, caching behavior, skip-without-languages, and 404 fallback. |
docs/reference/config.rst |
Document that import.languages alias selection also applies to composer/lyricist names. |
docs/changelog.rst |
Add changelog entry for bugfix and note extra cached per-artist lookup. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6904 +/- ##
==========================================
+ Coverage 75.69% 75.71% +0.02%
==========================================
Files 163 163
Lines 21412 21431 +19
Branches 3384 3386 +2
==========================================
+ Hits 16208 16227 +19
Misses 4405 4405
Partials 799 799
🚀 New features to boost your workflow:
|
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.
Description
Composer and lyrcist names were always read from the raw musicbrainz name, even when a preferred language was set. Because musicbrainz API doesn't include aliases for these credits, we need a per-artist lookup. This adds that, made to only run when
import.languagesis set up.Worth noting that this comes at a cost! Additional API requests could slow things down, particularly if there are many different composers or lyricists.
Fixes #5885.
To Do