Skip to content

musicbrainz: fetch composer/lyricist aliases - #6904

Open
NoDancing wants to merge 2 commits into
beetbox:masterfrom
NoDancing:composer-alias-api-lookup
Open

musicbrainz: fetch composer/lyricist aliases#6904
NoDancing wants to merge 2 commits into
beetbox:masterfrom
NoDancing:composer-alias-api-lookup

Conversation

@NoDancing

Copy link
Copy Markdown
Contributor

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.languages is 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

  • Documentation.
  • Changelog.
  • Tests.

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
@NoDancing
NoDancing requested a review from snejus as a code owner August 4, 2026 22:03
Copilot AI lite review requested due to automatic review settings August 4, 2026 22:03
@NoDancing
NoDancing requested a review from a team as a code owner August 4, 2026 22:03
@github-actions github-actions Bot added the musicbrainz musicbrainz plugin label Aug 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.languages affects 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

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.71%. Comparing base (74c2d98) to head (2c564ca).
✅ All tests successful. No failed tests found.

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              
Files with missing lines Coverage Δ
beetsplug/_utils/musicbrainz.py 97.66% <100.00%> (+0.31%) ⬆️
beetsplug/musicbrainz.py 95.23% <100.00%> (+0.23%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

musicbrainz musicbrainz plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

composer not translated from non western language with import/languages set to en

2 participants