From 4bfa43bece36a6fff7a747bad05ac3ce155f213f Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Tue, 19 May 2026 12:34:35 -0700 Subject: [PATCH] Fix MusicBrainz artist detail showing MBID as name URL-driven routing (PR #644) no longer passes the display name as a query param to the artist-detail endpoint. The source-only detail builder fell back to artist_id when artist_name was empty, surfacing the raw MBID as the page title for MusicBrainz artists. Two fixes in build_source_only_artist_detail: - Drop the artist_id fallback in resolved_name so an MBID can never become the display name - Add a musicbrainz elif branch (matching the Spotify/Deezer/iTunes pattern) that calls MusicBrainzSearchClient.get_artist() to resolve the real name and genres from the MBID when no name is provided --- core/artist_source_detail.py | 13 ++++++++++++- webui/static/helper.js | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/artist_source_detail.py b/core/artist_source_detail.py index d8e8b45c..5576f224 100644 --- a/core/artist_source_detail.py +++ b/core/artist_source_detail.py @@ -52,7 +52,7 @@ def build_source_only_artist_detail( ``jsonify`` or equivalent. Status is 200 on success, 404 when the source's discography lookup returned no releases. """ - resolved_name = (artist_name or artist_id or "").strip() + resolved_name = (artist_name or "").strip() # 1. Image URL via the same helper /api/artist//image uses. image_url: Optional[str] = None @@ -101,6 +101,17 @@ def build_source_only_artist_detail( source_genres = az_artist.get("genres") or [] if not image_url and az_artist.get("images"): image_url = az_artist["images"][0].get("url") + elif source == "musicbrainz": + try: + from core.musicbrainz_search import MusicBrainzSearchClient + mb = MusicBrainzSearchClient() + mb_artist = mb.get_artist(artist_id) + if mb_artist: + if not artist_name and mb_artist.get("name"): + resolved_name = mb_artist["name"] + source_genres = mb_artist.get("genres") or [] + except Exception as e: + logger.debug(f"MusicBrainz artist info lookup failed for {artist_id}: {e}") except Exception as e: logger.debug(f"Source-side artist info lookup failed for {source}:{artist_id}: {e}") diff --git a/webui/static/helper.js b/webui/static/helper.js index fc8036d9..71d57a67 100644 --- a/webui/static/helper.js +++ b/webui/static/helper.js @@ -3416,6 +3416,7 @@ const WHATS_NEW = { '2.5.6': [ { date: 'May 18, 2026 — 2.5.6 release' }, { title: 'MusicBrainz as Primary Metadata Source', desc: 'MusicBrainz is now a full primary metadata source on equal footing with Deezer, iTunes, Spotify, and Discogs. switch to it in Settings → Metadata Source — always available, no account or API key needed, rate-limited to 1 req/sec. covers all primary source flows: search, album/track/artist lookup, watchlist scans, discover hero, similar artist backfill, artist map.', page: 'settings' }, + { title: 'Fix: MusicBrainz artist detail showing MBID as name', desc: 'clicking a MusicBrainz artist from search results was showing the raw MBID as the artist name on the detail page. URL-driven routing (PR #644) no longer passes the display name to the backend, so the source detail endpoint now looks it up directly from MusicBrainz by MBID.' }, ], '2.5.5': [ { date: 'May 17, 2026 — 2.5.5 release' },