feat: implement librespot-powered search
This commit is contained in:
@@ -189,6 +189,24 @@ playlist_expanded = client.get_playlist("spotify:playlist:...", expand_items=Tru
|
||||
```
|
||||
|
||||
|
||||
### search(query, limit=10, country=None, locale=None, catalogue=None, image_size=None) -> dict
|
||||
Performs a full-featured search using librespot's SearchManager.
|
||||
|
||||
- Country precedence: explicit `country` > session country code > unset
|
||||
- Returns librespot's JSON-like mapping (tracks, albums, artists, playlists, etc.)
|
||||
|
||||
Usage:
|
||||
|
||||
```python
|
||||
res = client.search(
|
||||
"artist:daft punk track:one more time",
|
||||
limit=10,
|
||||
country="US",
|
||||
locale="en_US"
|
||||
)
|
||||
tracks = res.get("tracks", {}).get("items", [])
|
||||
```
|
||||
|
||||
## Concurrency and caching
|
||||
|
||||
- When expanding tracks for albums/playlists, the client concurrently fetches missing track objects using a `ThreadPoolExecutor` with up to `max_workers` threads (default 16).
|
||||
|
||||
Reference in New Issue
Block a user