From 7b3a32ccc5555640a1fca7398e64ba3a9c7d40f9 Mon Sep 17 00:00:00 2001 From: Antti Kettunen Date: Thu, 16 Apr 2026 09:14:07 +0300 Subject: [PATCH] Remove dead watchlist source helpers Drop the old active-provider artist lookup helpers from watchlist_scanner now that the web scan flow resolves sources through the shared metadata priority. Keep the Spotify-specific feature toggles in place for discovery and sync paths that still use them. --- core/watchlist_scanner.py | 60 --------------------------------------- 1 file changed, 60 deletions(-) diff --git a/core/watchlist_scanner.py b/core/watchlist_scanner.py index 6f3d1983..32399b71 100644 --- a/core/watchlist_scanner.py +++ b/core/watchlist_scanner.py @@ -648,66 +648,6 @@ class WatchlistScanner: image_url=image_url, ) - def _get_active_client_and_artist_id(self, watchlist_artist: WatchlistArtist): - """ - Get the appropriate client and artist ID based on active provider. - If iTunes ID is missing, searches by artist name to find and cache it. - - Returns: - Tuple of (client, artist_id, provider_name) or (None, None, None) if no valid ID - """ - provider = self.metadata_service.get_active_provider() - - if provider == 'spotify': - if watchlist_artist.spotify_artist_id: - return (self.metadata_service.spotify, watchlist_artist.spotify_artist_id, 'spotify') - else: - logger.warning(f"No Spotify ID for {watchlist_artist.artist_name}, cannot scan with Spotify") - return (None, None, None) - else: # itunes or deezer fallback - fallback_source = provider # 'itunes' or 'deezer' - fallback_client = self.metadata_service.itunes # May be iTunesClient or DeezerClient - # Pick the right stored ID for the active fallback source - stored_id = watchlist_artist.deezer_artist_id if fallback_source == 'deezer' else watchlist_artist.itunes_artist_id - if stored_id: - return (fallback_client, stored_id, fallback_source) - else: - # No ID stored for this source - search by name and cache it - logger.info(f"No {fallback_source} ID for {watchlist_artist.artist_name}, searching by name...") - try: - search_results = fallback_client.search_artists(watchlist_artist.artist_name, limit=1) - if search_results and len(search_results) > 0: - found_id = search_results[0].id - logger.info(f"Found {fallback_source} ID {found_id} for {watchlist_artist.artist_name}") - # Cache the ID in the database for future use - if fallback_source == 'deezer': - self.database.update_watchlist_artist_deezer_id( - watchlist_artist.spotify_artist_id or str(watchlist_artist.id), - found_id - ) - else: - self.database.update_watchlist_artist_itunes_id( - watchlist_artist.spotify_artist_id or str(watchlist_artist.id), - found_id - ) - return (fallback_client, found_id, fallback_source) - else: - logger.warning(f"Could not find {watchlist_artist.artist_name} on {fallback_source}") - return (None, None, None) - except Exception as e: - logger.error(f"Error searching {fallback_source} for {watchlist_artist.artist_name}: {e}") - return (None, None, None) - - def get_active_client_and_artist_id(self, watchlist_artist: WatchlistArtist): - """ - Public wrapper for _get_active_client_and_artist_id. - Gets the appropriate client and artist ID based on active provider. - - Returns: - Tuple of (client, artist_id, provider_name) or (None, None, None) if no valid ID - """ - return self._get_active_client_and_artist_id(watchlist_artist) - def get_artist_image_url(self, watchlist_artist: WatchlistArtist) -> Optional[str]: """ Get artist image URL using the configured source priority.