Add opt-in pref mergeContributorsByName for album-artist contributor matching#1579
Conversation
…matching When two tracks share the same ALBUMARTIST display string but carry different MusicBrainz Album Artist IDs, LMS creates duplicate contributor rows under the same visible name. This adds a server preference (mergeContributorsByName, default OFF) that makes Contributor::add look up by name first and fall back to MBID only if no name match exists, preventing the split. Default-off preserves existing behaviour for libraries that legitimately use MBIDs to distinguish same-name artists. - Slim/Schema/Contributor.pm: new lookup branch in sub add - Slim/Utils/Prefs.pm: default declaration + rescan trigger - HTML/EN/settings/server/behavior.html: checkbox in My Music section - strings.txt: EN strings for the new setting
- Slim/Web/Settings/Server/Behavior.pm: add mergeContributorsByName to the sub prefs whitelist so the setting page can read and save it - Changelog9.html: note the new preference under v9.0.4 New Features Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@darrell-k — tagging you as you've done the recent contributor/MusicBrainz work (#1325, #1331) and are likely the right person to review this. Happy to adjust the pref name, settings placement, or anything else based on your feedback. |
|
How is this different from "ignore MB tags" - which can easily be fixed by removing the tags? |
|
This definitely steps into territory @darrell-k has been working on and discussing recently. I'm tempted to decline this PR for the simple reason that it's just adding another pref to deal with some music files' incorrect tagging. Fix the tags and we don't need to maintain another code branch. Wait for @darrell-k's latest work. Join the community where I believe this topic has been discussed extensively recently in a larger and more comprehensive context. Oh, and certainly rebase on top of 9.2 to get started. Respect the project's expectations (DCO), declare the use of Claude or whatever other tool did the work, tell it to keep comments short and sweet. |
Add opt-in pref
mergeContributorsByNamefor album-artist contributor matchingFixes #1578.
Summary
Adds a server preference,
mergeContributorsByName, that changes the contributor lookup inSlim::Schema::Contributor::addfrom "MBID first, name fallback only if existing row has NULL MBID" to "name first, MBID fallback if no name match." Default is OFF; existing behavior is preserved.Motivation
Same display name, different MBID → two contributor rows under the same name in the browse UI. The most common trigger is band/collaboration credits on MusicBrainz that use the solo artist's name string in
ALBUMARTIST(e.g. "Stephen Malkmus" credited to "Stephen Malkmus & The Jicks" on MusicBrainz; "Mirah" credited to a multi-artist collaboration). See the linked issue for a full reproduction, source-code analysis, and empirical confirmation via a per-track tag experiment.Change
Slim/Schema/Contributor.pm: insub add, gate the existing MBID-first lookup on!$prefs->get('mergeContributorsByName'). When the pref is on, look up bynamefirst, tie-breaking by preferring rows with non-nullmusicbrainz_id(richer data) then byidascending (oldest first) for determinism. Fall back to MBID lookup only if no name match exists.Slim/Utils/Prefs.pm(or wherever scanner-related prefs are defaulted, depending on layout): defaultmergeContributorsByName => 0.Settings UI: add a checkbox under My Music → MP3 (or a more general "Contributor scanning" subsection) with the help text:
Tradeoffs and why default-OFF is correct
The current MBID-first behavior is the right default for libraries that contain legitimately distinct artists with the same display name (e.g. John Williams the composer vs. John Williams the guitarist) — those users want MBIDs to keep their rows separate, and a global "match by name" would regress them. Making the new behavior opt-in preserves both populations.
Alternatives considered
Test plan
Manual verification on a library exhibiting the bug (Stephen Malkmus and Mirah examples from the issue):
contributorstable still contains both rows (existing behavior preserved).contributorstable now has a single row per display name; the orphaned rows are pruned byContributor::rescanonce they have no remainingcontributor_trackreferences.Patch
See
Contributor.pm.diffalongside this PR description.Note on the existing no-MBID branch (
SELECT … LIMIT 1with noORDER BY)While debugging the underlying issue I also noticed that the existing no-MBID name lookup is non-deterministic across rescans because it uses
LIMIT 1withoutORDER BY. This makes the documented "strip MBID frames to merge" workaround unreliable — in my own library it picked the canonical contributor for one duplicate and the duplicate row for another. I have not changed that path in this PR (out of scope, conservative diff), but it would be a worthwhile follow-up to addORDER BY id LIMIT 1there as well for reproducibility. Happy to do that in a separate PR if the maintainers agree.