diff --git a/core/spotify_client.py b/core/spotify_client.py index 3603e324..0b456fe4 100644 --- a/core/spotify_client.py +++ b/core/spotify_client.py @@ -1305,19 +1305,22 @@ class SpotifyClient: return None @rate_limited - def get_artist_albums(self, artist_id: str, album_type: str = 'album,single', limit: int = 10) -> List[Album]: - """Get albums by artist ID - falls back to iTunes if Spotify not authenticated""" - # Check cache first — keyed by artist_id + album_type + def get_artist_albums(self, artist_id: str, album_type: str = 'album,single', limit: int = 10, skip_cache: bool = False) -> List[Album]: + """Get albums by artist ID - falls back to iTunes if Spotify not authenticated. + Set skip_cache=True for watchlist scans that need fresh data to detect new releases.""" cache = get_metadata_cache() fallback_src = self._fallback_source source = fallback_src if self._is_itunes_id(artist_id) else 'spotify' cache_key = f"{artist_id}_albums_{album_type.replace(',', '_')}" - cached = cache.get_entity(source, 'artist', cache_key) - if cached: - try: - return [Album.from_spotify_album(ad) for ad in cached] - except Exception: - pass # Cache data incompatible, re-fetch + + # Check cache first (unless caller needs fresh data) + if not skip_cache: + cached = cache.get_entity(source, 'artist', cache_key) + if cached: + try: + return [Album.from_spotify_album(ad) for ad in cached] + except Exception: + pass # Cache data incompatible, re-fetch if self.is_spotify_authenticated(): try: diff --git a/web_server.py b/web_server.py index 240bcf9e..10528d66 100644 --- a/web_server.py +++ b/web_server.py @@ -42891,7 +42891,7 @@ def playlist_explorer_build_tree(): # Fetch albums try: - all_albums = active_client.get_artist_albums(artist_id, album_type='album,single', limit=50) + all_albums = active_client.get_artist_albums(artist_id, album_type='album,single', limit=50, skip_cache=True) except Exception as e: return {'success': False, 'error': f'Album fetch failed: {e}'}