/
/
/
1"""Constants for the Tidal music provider."""
2
3# API URLs
4from typing import Final
5
6BASE_URL = "https://api.tidal.com/v1"
7OPEN_API_URL = "https://openapi.tidal.com/v2"
8BROWSE_URL = "https://tidal.com/browse"
9RESOURCES_URL = "https://resources.tidal.com/images"
10# Base host for the /pages/* feed.
11WEB_BASE_URL = "https://tidal.com/v1"
12SESSIONS_URL = f"{BASE_URL}/sessions"
13
14# Official API (JSON:API)
15JSONAPI_CONTENT_TYPE = "application/vnd.api+json"
16
17# Item payload errors that make one resource unusable without invalidating its collection.
18SKIPPABLE_ITEM_ERRORS: Final[tuple[type[Exception], ...]] = (
19 AttributeError,
20 KeyError,
21 TypeError,
22 ValueError,
23)
24
25# Authentication
26AUTH_URL = "https://auth.tidal.com/v1/oauth2"
27# OAuth scopes requested for the device flow (read, write, subscription).
28AUTH_SCOPE = "r_usr w_usr w_sub"
29
30# API paths (relative to BASE_URL unless used with an explicit base_url)
31PLAYLISTS = "playlists"
32PAGES_MIX = "pages/mix"
33
34# Config keys
35CONF_AUTH_TOKEN = "auth_token"
36CONF_REFRESH_TOKEN = "refresh_token"
37CONF_USER_ID = "user_id"
38CONF_EXPIRY_TIME = "expiry_time"
39CONF_QUALITY = "quality"
40
41# Cache keys
42CACHE_CATEGORY_RECOMMENDATIONS: Final[int] = 1
43CACHE_CATEGORY_ISRC_MAP: Final[int] = 2
44
45# Virtual playlist IDs
46FAVORITE_TRACKS_PLAYLIST_ID: Final[str] = "favorite_tracks"
47