Fix cover.jpg not using Cover Art Archive high-res source

The MusicBrainz release ID found by _embed_source_ids was stored in the
metadata dict but never propagated to album_info. The old code tried to
write album_info['musicbrainz_release_id'] inside _embed_source_ids, but
album_info wasn't in that function's scope — causing a silent NameError.

Fix: copy the MBID from metadata to album_info in _enhance_file_metadata
(where both are in scope) right after _embed_source_ids returns. This
makes _download_cover_art see the MBID and use Cover Art Archive for
cover.jpg instead of falling back to the smaller Spotify/iTunes thumbnail.
This commit is contained in:
Broque Thomas 2026-03-31 21:40:19 -07:00
parent f275a9831e
commit 87f17a1318

View file

@ -16014,6 +16014,11 @@ def _enhance_file_metadata(file_path: str, context: dict, artist: dict, album_in
# Cover Art Archive high-resolution lookup.
_embed_source_ids(audio_file, metadata)
# Propagate MusicBrainz release ID to album_info so _download_cover_art
# can use it for Cover Art Archive high-res cover.jpg
if album_info is not None and metadata.get('musicbrainz_release_id'):
album_info['musicbrainz_release_id'] = metadata['musicbrainz_release_id']
# ── Embed album art on the same object ──
if config_manager.get('metadata_enhancement.embed_album_art', True):
_embed_album_art_metadata(audio_file, metadata)
@ -16486,9 +16491,6 @@ def _embed_source_ids(audio_file, metadata: dict):
# Store release MBID in metadata for downstream use (e.g. Cover Art Archive)
if _rc_mbid:
metadata['musicbrainz_release_id'] = _rc_mbid
# Also store on album_info so _download_cover_art can use it for cover.jpg
if album_info is not None:
album_info['musicbrainz_release_id'] = _rc_mbid
# Write release year to file tags if not already present
if release_year and 'ORIGINALDATE' not in id_tags: