/
/
/
1"""Constants for the Overcast provider."""
2
3from __future__ import annotations
4
5from music_assistant_models.enums import ProviderFeature
6
7BASE_URL = "https://overcast.fm"
8LOGIN_URL = f"{BASE_URL}/login"
9PODCASTS_URL = f"{BASE_URL}/podcasts"
10OPML_EXPORT_URL = f"{BASE_URL}/account/export_opml/extended"
11
12SESSION_COOKIE_NAME = "o"
13
14CONF_SESSION_COOKIE = "session_cookie"
15CONF_MAX_NUM_EPISODES = "max_num_episodes"
16
17CACHE_CATEGORY_OPML = 1
18# feed url -> ISO datetime of the newest progress applied for that feed
19CACHE_KEY_LAST_APPLIED = "last_applied_playback_ts"
20
21# Overcast rate limits this endpoint to roughly 10 requests a day, and we only
22# fetch when something needs the export (a library sync, browsing or playback),
23# so 4 hours works out at no more than 6 requests a day. The old export is still
24# used while the new one is on its way, so nothing has to wait for Overcast.
25OPML_CACHE_EXPIRATION = 4 * 3600
26RATE_LIMIT_FALLBACK_BACKOFF = 3600
27
28# Overcast answers a request carrying a rejected session cookie with a redirect to
29# the login page, so any redirect away from the export means the session is gone.
30AUTH_REJECT_STATUSES = (301, 302, 303, 307, 308)
31
32SUPPORTED_FEATURES = {
33 ProviderFeature.LIBRARY_PODCASTS,
34 ProviderFeature.BROWSE,
35}
36