Skip to content

feat(lookup): Replace labels matching the artist name with [no label] - #241

Open
po5 wants to merge 1 commit into
kellnerd:mainfrom
po5:self-published-label
Open

feat(lookup): Replace labels matching the artist name with [no label]#241
po5 wants to merge 1 commit into
kellnerd:mainfrom
po5:self-published-label

Conversation

@po5

@po5 po5 commented Aug 5, 2026

Copy link
Copy Markdown

@chaban-mb

chaban-mb commented Aug 6, 2026

Copy link
Copy Markdown

Just noting sometimes real labels appear in release artists. E.g.
https://harmony.pulsewidth.org.uk/release?spotify=1temg9hXAhOnpdEo1CAhwe&qobuz=yhekwetz6hx2b&gtin=199330794014&deezer=&itunes=&tidal=&region=US&ts=1785993872

I'd love to provide you with more test cases but I don't have more available right now.
This tag has more: https://musicbrainz.org/tag/label%20as%20artist

BTW, I have also such a feature in my Harmony enhancements userscript.
However it also suffers from the same problem when it's ambiguous whether a label is an artist or vice versa.

Details

High-Level Summary

  • PR kellnerd/harmony#241: Implements basic self-published label cleanup in Harmony by replacing any release label whose name exactly matches one of the credited release artist names (or credited aliases).
  • setNoLabel: Implements a significantly more flexible matching strategy in the userscript. It accounts for track-level artists, joint/collaboration artist names separated by feature/collaboration tokens (e.g. Artist A & Artist B), case-insensitivity, pre-existing MBIDs, and UI label consolidation.

Detailed Comparison Breakdown

Feature / Behavior PR kellnerd/harmony#241 setNoLabel in Harmony Enhancements
Matching Strategy Exact Equality (Array.includes)
Checks artistNames?.includes(label.name).
Fuzzy / Iterative Substring Removal
Removes artist names iteratively and checks if remaining chars are empty or only separators (&, x, feat., ,, etc.).
Collaborative / Multi-Artist Labels Misses joint self-releases
If release has artists [Artist A, Artist B] and label is "Artist A & Artist B", PR 241 fails to match.
Handles joint self-releases
Regex strips Artist A and Artist B, leaving &, which matches SEPARATORS_REGEX.
Artist Sources Release artists only (release.artists). Release artists + all track artists across media (release.artists + track.artists).
Case Sensitivity Case-sensitive (String.includes). Case-insensitive (new RegExp(escapedName, 'i')).
Existing MBID Safeguard No MBID check
Replaces the label even if label.mbid was already assigned.
MBID check
Skips evaluation if originalLabel.mbid is already present (if (originalLabel.mbid) return ...).
Multi-Label Consolidation Replaces each matching label individually with [no label]. If all labels are self-releases and count > 1, consolidates them into a single [no label] entry in data state and UI.

Key Observations & Edge Cases

  1. Collaboration Labels (e.g., Artist 1 & Artist 2):

    • PR 241 will fail when digital stores populate the label field with a combined artist string like "Artist A & Artist B" if release.artists contains individual artist objects for "Artist A" and "Artist B".
    • setNoLabel handles this using SEPARATORS_REGEX (/^(?:x|&|,|\/|-|\+|feat\.|ft\.|pres\.|presents|vs\.|vs|[\s\u200B\uFEFF])+$/i).
  2. Case Differences:

    • PR 241 will miss label entries with subtle casing differences (e.g., label "ARTIST NAME" vs artist "Artist Name").
  3. Pre-Existing MBIDs:

    • In PR 241, if Harmony's lookup or provider metadata assigned a specific label MBID that happens to match the artist's name, PR 241 will overwrite label.mbid with noLabel.mbid. setNoLabel guards against this.

@arsinclair

Copy link
Copy Markdown
Contributor

It is possible to discover if there's an actual label on MB pointing to a particular bandcamp page. If yes, in that case we probably shouldn't set it to [no label] and go with the old logic.

@kellnerd kellnerd left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thank you for the PR and the test cases @po5, and thank you for the feedback @chaban-mb and @arsinclair.

The feedback which @chaban-mb hides in the details pretty much covers everything I could have brought up and I would like to see those suggestions addressed. Especially the idea to "remove" artist names from the label name and see what remains and the safeguard for labels that could be matched against MB and therefore have an MBID (the Bandcamp example by @arsinclair is covered by this).

Regarding the opposite scenario of labels in the artist credits: Unfortunately we can only catch those if the label has an MBID (and could potentially "fix" the artist credit instead), which is rarely the case with the existing sources.
In all other cases, Harmony at least shows the original values of the label field for all providers since we are only overwriting them with [no label] at the post-merge stage.

@kellnerd kellnerd added feature New feature or request harmonizer Harmonized data representation and processing labels Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request harmonizer Harmonized data representation and processing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants