/
/
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# Authentication
18AUTH_URL = "https://auth.tidal.com/v1/oauth2"
19# OAuth scopes requested for the device flow (read, write, subscription).
20AUTH_SCOPE = "r_usr w_usr w_sub"
21
22# API paths (relative to BASE_URL unless used with an explicit base_url)
23PLAYLISTS = "playlists"
24PAGES_MIX = "pages/mix"
25
26# Config keys
27CONF_AUTH_TOKEN = "auth_token"
28CONF_REFRESH_TOKEN = "refresh_token"
29CONF_USER_ID = "user_id"
30CONF_EXPIRY_TIME = "expiry_time"
31CONF_QUALITY = "quality"
32
33# Cache keys
34CACHE_CATEGORY_RECOMMENDATIONS: Final[int] = 1
35CACHE_CATEGORY_ISRC_MAP: Final[int] = 2
36
37# Virtual playlist IDs
38FAVORITE_TRACKS_PLAYLIST_ID: Final[str] = "favorite_tracks"
39