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
This commit is contained in:
parent
c02cf15fdf
commit
4bfa43bece
2 changed files with 13 additions and 1 deletions
|
|
@ -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/<id>/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}")
|
||||
|
||||
|
|
|
|||
|
|
@ -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' },
|
||||
|
|
|
|||
Loading…
Reference in a new issue