diff --git a/core/watchlist_scanner.py b/core/watchlist_scanner.py index 5c7ff482..697dc443 100644 --- a/core/watchlist_scanner.py +++ b/core/watchlist_scanner.py @@ -263,8 +263,8 @@ class WatchlistScanner: except Exception as img_error: logger.warning(f"Could not update artist image for {watchlist_artist.artist_name}: {img_error}") - # Get artist discography from Spotify (filtered by artist's album type preferences) - albums = self.get_artist_discography(watchlist_artist, watchlist_artist.last_scan_timestamp) + # Get artist discography from Spotify + albums = self.get_artist_discography(watchlist_artist.spotify_artist_id, watchlist_artist.last_scan_timestamp) if albums is None: return ScanResult( @@ -355,38 +355,22 @@ class WatchlistScanner: error_message=str(e) ) - def get_artist_discography(self, watchlist_artist: WatchlistArtist, last_scan_timestamp: Optional[datetime] = None) -> Optional[List]: + def get_artist_discography(self, spotify_artist_id: str, last_scan_timestamp: Optional[datetime] = None) -> Optional[List]: """ - Get artist's discography from Spotify, optionally filtered by release date and album type. + Get artist's discography from Spotify, optionally filtered by release date. Args: - watchlist_artist: WatchlistArtist object with configuration settings + spotify_artist_id: Spotify artist ID last_scan_timestamp: Only return releases after this date (for incremental scans) If None, uses lookback period setting from database """ try: - # Build album_type filter from artist configuration - album_types = [] - if watchlist_artist.include_albums: - album_types.append('album') - if watchlist_artist.include_eps: - album_types.append('ep') - if watchlist_artist.include_singles: - album_types.append('single') - - # Fallback to albums only if nothing is selected (shouldn't happen due to validation) - if not album_types: - logger.warning(f"Artist {watchlist_artist.artist_name} has no album types selected, defaulting to albums only") - album_types = ['album'] - - album_type_param = ','.join(album_types) - logger.info(f"Fetching discography for {watchlist_artist.artist_name} (types: {album_type_param})") - - # Get artist albums with configured types - this is rate limited in spotify_client - albums = self.spotify_client.get_artist_albums(watchlist_artist.spotify_artist_id, album_type=album_type_param, limit=50) + # Get all artist albums (albums + singles) - this is rate limited in spotify_client + logger.debug(f"Fetching discography for artist {spotify_artist_id}") + albums = self.spotify_client.get_artist_albums(spotify_artist_id, album_type='album,single', limit=50) if not albums: - logger.warning(f"No albums found for artist {watchlist_artist.artist_name}") + logger.warning(f"No albums found for artist {spotify_artist_id}") return [] # Add small delay after fetching artist discography to be extra safe @@ -418,7 +402,7 @@ class WatchlistScanner: return albums except Exception as e: - logger.error(f"Error getting discography for artist {watchlist_artist.artist_name}: {e}") + logger.error(f"Error getting discography for artist {spotify_artist_id}: {e}") return None def _get_lookback_period_setting(self) -> str: diff --git a/database/music_database.py b/database/music_database.py index dafad409..6ee0c645 100644 --- a/database/music_database.py +++ b/database/music_database.py @@ -2590,8 +2590,7 @@ class MusicDatabase: cursor.execute(""" SELECT id, spotify_artist_id, artist_name, date_added, - last_scan_timestamp, created_at, updated_at, image_url, - include_albums, include_eps, include_singles + last_scan_timestamp, created_at, updated_at, image_url FROM watchlist_artists ORDER BY date_added DESC """) @@ -2606,22 +2605,6 @@ class MusicDatabase: except (KeyError, IndexError): image_url = None - # Try to get album type filter settings, fallback to True (include all) if columns don't exist yet (migration) - try: - include_albums = bool(row['include_albums']) - except (KeyError, IndexError): - include_albums = True - - try: - include_eps = bool(row['include_eps']) - except (KeyError, IndexError): - include_eps = True - - try: - include_singles = bool(row['include_singles']) - except (KeyError, IndexError): - include_singles = True - watchlist_artists.append(WatchlistArtist( id=row['id'], spotify_artist_id=row['spotify_artist_id'], @@ -2630,10 +2613,7 @@ class MusicDatabase: last_scan_timestamp=datetime.fromisoformat(row['last_scan_timestamp']) if row['last_scan_timestamp'] else None, created_at=datetime.fromisoformat(row['created_at']) if row['created_at'] else None, updated_at=datetime.fromisoformat(row['updated_at']) if row['updated_at'] else None, - image_url=image_url, - include_albums=include_albums, - include_eps=include_eps, - include_singles=include_singles + image_url=image_url )) return watchlist_artists