From 0193f53d28e9e2e67c8f6d8179f06c4eb41e3b11 Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Sat, 28 Feb 2026 11:04:50 -0800 Subject: [PATCH] Improve Spotify artist search for short names using field filter --- core/spotify_client.py | 3 ++- web_server.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/spotify_client.py b/core/spotify_client.py index 2d81eb81..0a366bad 100644 --- a/core/spotify_client.py +++ b/core/spotify_client.py @@ -596,7 +596,8 @@ class SpotifyClient: """Search for artists - falls back to iTunes if Spotify not authenticated""" if self.is_spotify_authenticated(): try: - results = self.sp.search(q=query, type='artist', limit=min(limit, 10)) + search_query = f'artist:{query}' if len(query.strip()) <= 4 else query + results = self.sp.search(q=search_query, type='artist', limit=min(limit, 10)) artists = [] for artist_data in results['artists']['items']: diff --git a/web_server.py b/web_server.py index 619d5d03..dfe11c65 100644 --- a/web_server.py +++ b/web_server.py @@ -23350,7 +23350,8 @@ def search_artists_for_playlist(): if hydrabase_worker and dev_mode_enabled: hydrabase_worker.enqueue(query, 'artist') - results = spotify_client.sp.search(q=query, type='artist', limit=10) + search_query = f'artist:{query}' if len(query.strip()) <= 4 else query + results = spotify_client.sp.search(q=search_query, type='artist', limit=10) if results and 'artists' in results and 'items' in results['artists']: for artist in results['artists']['items']: artists.append({