From dfe1671ac914cefb6c9955249f3ad2ac08f401ae Mon Sep 17 00:00:00 2001 From: Christophe Vila Date: Fri, 22 May 2026 22:27:14 +0200 Subject: [PATCH] fix: clarify search cap and batch completion semantics --- spotify_client.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spotify_client.py b/spotify_client.py index 11f1e38..704bb1e 100644 --- a/spotify_client.py +++ b/spotify_client.py @@ -120,6 +120,7 @@ def list_saved_tracks(limit: int = 50) -> list[dict]: def search_tracks(query: str, limit: int = 10) -> list[dict]: sp = get_client() + # Spotify's search endpoint returns at most 50 results per call; no pagination available response = sp.search(q=query, type="track", limit=min(limit, 50)) results = [] for track in response["tracks"]["items"]: @@ -156,4 +157,5 @@ def add_tracks_to_playlist(playlist_id: str, track_uris: list[str]) -> dict: sp = get_client() for i in range(0, len(track_uris), 100): sp.playlist_add_items(playlist_id, track_uris[i : i + 100]) + # Only reached if all batches succeed — any SpotifyException propagates to the caller return {"added": len(track_uris)}