rekordbox_set_list_manager.services.tidal_service#
Tidal integration service — authentication and playlist import.
Exceptions#
Raised when a Tidal API operation fails. |
Classes#
Wraps tidalapi for playlist import. |
Module Contents#
- exception rekordbox_set_list_manager.services.tidal_service.TidalServiceError[source]#
Bases:
ExceptionRaised when a Tidal API operation fails.
- class rekordbox_set_list_manager.services.tidal_service.TidalService[source]#
Bases:
rekordbox_set_list_manager.services.streaming_base.StreamingServiceWraps tidalapi for playlist import.
Call
authenticate()once before any other method. The session is cached to disk via tidalapi’s session file and reused across restarts — so the device-code browser flow is only needed on first run.- authenticate(link_callback=None)[source]#
Authenticate with Tidal using the device code flow.
On first run initiates the device-code flow. If link_callback is provided it is called with the login URL message so the caller can display it in the UI; otherwise the message is printed to stdout. Subsequent calls reuse the cached session (or refresh the token).
- Parameters:
link_callback (Callable[[str], None] | None) – If provided, called with the login URL for device-code flow display. Defaults to
print()ifNone.- Returns:
The authenticated user’s display name (username).
- Return type:
str
- Raises:
TidalServiceError – If auth fails or is not completed.
- is_authenticated()[source]#
Return
Trueif a Tidal session is active.- Returns:
Truewhen an authenticatedtidalapi.Sessionexists.- Return type:
bool
- get_playlists()[source]#
Return metadata for all the user’s playlists (owned + saved).
- Returns:
Each entry contains
"id"(str),"name"(str), and"track_count"(int) keys.- Return type:
list[dict]
- Raises:
TidalServiceError – If not authenticated or the API call fails.
- get_playlist_tracks(playlist_id)[source]#
Fetch all tracks from playlist_id and return as Track objects.
- Parameters:
playlist_id (str) – The Tidal playlist ID to fetch tracks from.
- Returns:
(tracks, 0)— Tidal does not skip items the way Spotify does, so the skipped count is always0.- Return type:
tuple[list[Track], int]
- Raises:
TidalServiceError – If not authenticated or the API call fails.