From 78db3fda2bb727bff00a7563dca696e5b4112ac0 Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Thu, 16 Apr 2026 12:58:57 -0700 Subject: [PATCH] Fix source ID embedding broken by missing context parameter The MusicBrainz consistency change referenced 'context' inside _embed_source_ids(), but that variable was never passed to the function. Every download since that commit silently skipped ALL source ID tags (Spotify, MusicBrainz, Deezer, AudioDB, Tidal, Qobuz, Last.fm, Genius) with the error 'name context is not defined' caught as non-fatal. Fix: pass context from _enhance_file_metadata to _embed_source_ids, with None default for backward compatibility. --- web_server.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web_server.py b/web_server.py index dd6a0db1..4d46656e 100644 --- a/web_server.py +++ b/web_server.py @@ -18596,7 +18596,7 @@ def _enhance_file_metadata(file_path: str, context: dict, artist: dict, album_in # ── Embed source IDs (Spotify, MusicBrainz, etc.) on the same object ── # Runs before album art so MusicBrainz release ID is available for # Cover Art Archive high-resolution lookup. - _embed_source_ids(audio_file, metadata) + _embed_source_ids(audio_file, metadata, context) # Propagate MusicBrainz release ID to album_info so _download_cover_art # can use it for Cover Art Archive high-res cover.jpg @@ -18944,7 +18944,7 @@ def _embed_album_art_metadata(audio_file, metadata: dict): except Exception as e: print(f"Error embedding album art: {e}") -def _embed_source_ids(audio_file, metadata: dict): +def _embed_source_ids(audio_file, metadata: dict, context: dict = None): """ Lookup MusicBrainz, Deezer, AudioDB, Tidal, Qobuz, Last.fm, and Genius metadata, then embed them along with Spotify/iTunes source IDs as custom @@ -19038,7 +19038,7 @@ def _embed_source_ids(audio_file, metadata: dict): # Extract batch-level artist name for stable MB release cache keys. # When downloading an album batch, all tracks should use the same artist key # to guarantee they hit the same preflight-cached release MBID. - _track_info_for_pp = context.get('track_info', {}) or {} + _track_info_for_pp = (context or {}).get('track_info', {}) or {} _explicit_artist_for_pp = _track_info_for_pp.get('_explicit_artist_context') if isinstance(_track_info_for_pp, dict) else None _batch_artist_name = None if isinstance(_explicit_artist_for_pp, dict) and _explicit_artist_for_pp.get('name'):