From e38c0adc57002171d3e4ad133f1a5b7244c032b0 Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Sun, 1 Mar 2026 11:39:04 -0800 Subject: [PATCH] Fix: Various artist compilations caused failure on acoustID check. --- core/acoustid_verification.py | 2 ++ web_server.py | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/core/acoustid_verification.py b/core/acoustid_verification.py index 4208ae74..a9d06ddb 100644 --- a/core/acoustid_verification.py +++ b/core/acoustid_verification.py @@ -46,6 +46,8 @@ def _normalize(text: str) -> str: s = re.sub(r'\s*\[(?:feat\.?|ft\.?|featuring|w/|with)\s+[^\]]*\]', '', s, flags=re.IGNORECASE) # Remove trailing featuring info: "feat. ...", "ft. ...", "featuring ..." s = re.sub(r'\s+(?:feat\.?|ft\.?|featuring)\s+.*$', '', s, flags=re.IGNORECASE) + # Remove soundtrack/source subtitles: ' - From "..." Soundtrack', ' - from the film ...' + s = re.sub(r'\s*-\s*from\s+.+$', '', s, flags=re.IGNORECASE) # Remove non-alphanumeric except spaces s = re.sub(r'[^\w\s]', '', s) # Collapse whitespace diff --git a/web_server.py b/web_server.py index 4cd281b3..bfb5f155 100644 --- a/web_server.py +++ b/web_server.py @@ -10558,7 +10558,21 @@ def _post_process_matched_download(context_key, context, file_path): track_info.get('name') or original_search.get('title', '') ) - expected_artist = spotify_artist.get('name', '') + + # Use track-level artist for verification, NOT album artist. + # For compilations, spotify_artist is "Various Artists" which + # will never match AcoustID's actual track artist. + expected_artist = '' + track_artists = track_info.get('artists', []) + if track_artists: + first = track_artists[0] + if isinstance(first, dict): + expected_artist = first.get('name', '') + elif isinstance(first, str): + expected_artist = first + # Fallback to album artist if no track artists available + if not expected_artist: + expected_artist = spotify_artist.get('name', '') if expected_track and expected_artist: print(f"🔍 Running AcoustID verification for: '{expected_track}' by '{expected_artist}'")