/
/
/
1"""Constants for the TeddyCloud music provider."""
2
3from __future__ import annotations
4
5from typing import Final
6
7# Provider-specific config entry key (the TeddyCloud server base URL).
8CONF_URL: Final[str] = "url"
9
10# TeddyCloud HTTP API.
11TAG_INDEX_PATH: Final[str] = "/api/getTagIndex"
12CONTENT_DOWNLOAD_PATH: Final[str] = "/content/download"
13
14# A TAF (Tonie Audio Format) file is an OGG/Opus stream with a fixed 4096-byte protobuf
15# header prepended. TeddyCloud serves it header-stripped with ?skip_header=true; the raw
16# header is read (once, cached) to derive the total duration.
17TAF_HEADER_SIZE: Final[int] = 4096
18
19# Fallback author/publisher for tags without a recognised series (e.g. custom tonies).
20DEFAULT_ARTIST: Final[str] = "TeddyCloud"
21
22# How long (seconds) to keep the parsed tag index in memory before refetching.
23TAG_CACHE_TTL: Final[int] = 60
24
25# Derived total durations are persisted via mass.cache so they survive restarts. Tonie
26# content is immutable (the cache is keyed by audio_id), so keep it around for a long time.
27# Use a dedicated category (not the controller's default 0) to avoid any future overlap.
28CACHE_CATEGORY_DURATION: Final[int] = 2
29DURATION_CACHE_TTL: Final[int] = 86400 * 365
30