From 87db94554ab92165af8bc5208ae9253689e0d9f6 Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Tue, 10 Mar 2026 10:38:52 -0700 Subject: [PATCH] Fix Genius search blind fallback matching wrong artists/songs --- core/genius_client.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/core/genius_client.py b/core/genius_client.py index 0fc1093b..2da1cbca 100644 --- a/core/genius_client.py +++ b/core/genius_client.py @@ -154,12 +154,8 @@ class GeniusClient: logger.debug(f"Found song match: {result.get('title')} by {result.get('artist_names')}") return result - # Fall back to first result - first = hits[0].get('result') - if first: - logger.debug(f"Using first result: {first.get('title')} by {first.get('artist_names')}") - return first - + # No confident match — let the worker mark as not_found and retry later + logger.debug(f"No song match found in search results for: {artist_name} - {track_title}") return None # ── Song Methods ── @@ -206,15 +202,13 @@ class GeniusClient: for hit in hits: result = hit.get('result', {}) primary = result.get('primary_artist', {}) - if primary and artist_lower in (primary.get('name') or '').lower(): + primary_name = (primary.get('name') or '').lower() + if primary and (artist_lower in primary_name or primary_name in artist_lower): logger.debug(f"Found artist: {primary.get('name')}") return primary - # Fall back to first result's primary artist - first_artist = hits[0].get('result', {}).get('primary_artist') - if first_artist: - return first_artist - + # No confident match — let the worker mark as not_found and retry later + logger.debug(f"No artist match found in search results for: {artist_name}") return None @rate_limited