Fix: Various artist compilations caused failure on acoustID check.
This commit is contained in:
parent
c2119d4ecf
commit
e38c0adc57
2 changed files with 17 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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}'")
|
||||
|
|
|
|||
Loading…
Reference in a new issue