diff --git a/core/spotify_client.py b/core/spotify_client.py index 8e1823da..042b6ff5 100644 --- a/core/spotify_client.py +++ b/core/spotify_client.py @@ -432,6 +432,7 @@ class SpotifyClient: logger.error(f"Error fetching track features: {e}") return None + @rate_limited def get_album(self, album_id: str) -> Optional[Dict[str, Any]]: """Get album information including tracks""" if not self.is_authenticated(): @@ -445,6 +446,7 @@ class SpotifyClient: logger.error(f"Error fetching album: {e}") return None + @rate_limited def get_album_tracks(self, album_id: str) -> Optional[Dict[str, Any]]: """Get album tracks""" if not self.is_authenticated(): diff --git a/ui/components/watchlist_status_modal.py b/ui/components/watchlist_status_modal.py index 3f795da1..880d0392 100644 --- a/ui/components/watchlist_status_modal.py +++ b/ui/components/watchlist_status_modal.py @@ -115,6 +115,10 @@ class WatchlistScanWorker(QThread): total_albums += 1 else: total_singles_eps_releases += 1 # Count the release, not the tracks + + # Rate limiting: small delay between album fetches to avoid hitting Spotify limits + import time + time.sleep(0.1) # 100ms delay between albums except Exception as e: logger.warning(f"Error analyzing album {album.name} for totals: {e}") @@ -166,6 +170,10 @@ class WatchlistScanWorker(QThread): # Emit release completion signal self.release_completed.emit(watchlist_artist.artist_name, album.name, len(tracks)) + + # Rate limiting: small delay between album processing to avoid hitting Spotify limits + import time + time.sleep(0.1) # 100ms delay between albums except Exception as e: logger.warning(f"Error checking album {album.name}: {e}")