feat: jellyfin

This commit is contained in:
edde746
2026-05-01 01:20:36 +02:00
parent 4080c812d2
commit 31d2d9dc98
408 changed files with 56022 additions and 13747 deletions
+45
View File
@@ -0,0 +1,45 @@
/// Centralized HTTP timeout constants for both backends. The same
/// [MediaServerHttpClient] wrapper is used by Plex and Jellyfin clients —
/// timeouts are kept here so the budgets per phase are visible at a
/// glance.
class MediaServerTimeouts {
// ── Per-server HTTP request budgets (apply to both backends) ───
/// HTTP connect timeout for individual HTTP requests to a media server.
static const connect = Duration(seconds: 10);
/// HTTP receive timeout for streaming/large responses from a media server.
static const receive = Duration(seconds: 120);
// ── Plex server discovery / endpoint racing ────────────────────
/// Timeout for probing a cached/preferred endpoint before falling back to
/// the full candidate race (used in [PlexServer.findBestWorkingConnection]).
static const preferredEndpointProbe = Duration(milliseconds: 1500);
/// Timeout for the connection race where all candidates are tested in
/// parallel (used in [PlexServer.findBestWorkingConnection]).
static const connectionRace = Duration(seconds: 2);
/// Per-server connection budget: preferred probe + race + HTTPS upgrade
/// attempt + 1s buffer.
static const perServerConnect = Duration(milliseconds: 1500 + 2000 + 2000 + 1000);
/// HTTP timeout for the live-TV tune POST. Matches Plex web's value — the
/// default 10s connect budget is too tight on Fire-TV cold starts.
static const tune = Duration(seconds: 30);
// ── plex.tv (auth provider) ─────────────────────────────────────
/// HTTP connect timeout for plex.tv / clients.plex.tv API requests.
static const plexTvConnect = Duration(seconds: 5);
/// HTTP receive timeout for plex.tv / clients.plex.tv API responses.
static const plexTvReceive = Duration(seconds: 10);
// ── Jellyfin auth flow ──────────────────────────────────────────
/// Probe + token-validate timeout — Jellyfin servers respond fast on
/// `/System/Info/Public` and `/Users/Me`.
static const jellyfinProbe = Duration(seconds: 8);
/// Best-effort `/Sessions/Logout` timeout — short because the call is
/// fire-and-forget; the token is removed locally regardless.
static const jellyfinSignOut = Duration(seconds: 5);
}