From f7dfc3aab2c3f64c4752b72eff9337a9dc60a7b0 Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Mon, 18 May 2026 21:16:35 -0700 Subject: [PATCH] Fix MusicBrainz cover art using release-level CAA scope when available Include cover-art-archive in the get_release call so _render_release_as_album can check whether the representative release actually has front art before building the URL. Prefer release-scope when confirmed present; fall back to release-group scope otherwise. Prevents storing a release-group URL that CAA reports as having no art. --- core/musicbrainz_search.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/core/musicbrainz_search.py b/core/musicbrainz_search.py index 0047e6c5..21001118 100644 --- a/core/musicbrainz_search.py +++ b/core/musicbrainz_search.py @@ -857,7 +857,7 @@ class MusicBrainzSearchClient: metadata (type, artist credits) when resolving from a release-group whose releases may be lightly populated.""" release = self._client.get_release( - release_mbid, includes=['recordings', 'artist-credits', 'release-groups'] + release_mbid, includes=['recordings', 'artist-credits', 'release-groups', 'cover-art-archive'] ) if not release: return None @@ -876,7 +876,18 @@ class MusicBrainzSearchClient: album_type = _map_release_type(primary_type, secondary_types) rg_mbid = rg.get('id', '') - image_url = self._cached_art(release_mbid, rg_mbid) + # Use cover-art-archive metadata to pick the right CAA scope. + # release-group scope is preferred (covers all editions), but only + # if the release itself actually has front art — otherwise that URL + # will 404. `cover-art-archive.front` is authoritative with no + # extra network call (returned as part of the release fetch above). + caa = release.get('cover-art-archive') or {} + if caa.get('front'): + image_url = _cover_art_url(release_mbid, scope='release') + elif rg_mbid: + image_url = _cover_art_url(rg_mbid, scope='release-group') + else: + image_url = None tracks = [] total_tracks = 0