Files
plezy/lib/services/trackers/tracker_constants.dart
T
edde746 eaa1736c4e feat(mdblist): sync watched history, scrobbles and ratings with MDBList
Connects MDBList through its OAuth device-code grant, registered as a
Device Code app so no client secret or redirect URI ships in the binary
and TV, mobile and desktop all use the same flow.

MDBList omits `verification_uri_complete`, but its device page seeds the
code field from a `user_code` query parameter and the sign-in redirect
preserves the query string, so the activation link is built locally and
the dialog's open button lands on a filled-in form instead of an empty
one. A server-supplied complete URL still wins if one ever appears.

Poll state is read from the response body rather than the status code:
`authorization_pending` and `slow_down` both arrive as HTTP 400, and a
missing grant answers 404 `device_not_found`.

Writes go out as real-time `/scrobble/*` reports plus `/sync/watched`
for the marks that never pass through the player, with ratings on
`/sync/ratings`. Matching uses IMDb and TMDb only — MDBList's id block
has no `tvdb` field, so a TVDB-only item is skipped rather than written
under an empty id block.
2026-08-05 12:03:05 +02:00

26 lines
1.2 KiB
Dart

/// Shared constants for tracker integrations.
class TrackerConstants {
TrackerConstants._();
/// Fallback watched threshold (percent) used only until the active server's
/// threshold is known. The operative value follows
/// [MediaServerClient.watchedThreshold] (captured per playback in
/// [TrackerCoordinator]); this constant just seeds the field before playback.
static const double watchedThresholdPercent = 80.0;
static const Duration requestTimeout = Duration(seconds: 20);
static const Duration authRequestTimeout = Duration(seconds: 15);
static const Duration refreshTimeout = Duration(seconds: 15);
static const Duration revokeTimeout = Duration(seconds: 10);
static const Duration oauthProxyPollTimeout = Duration(seconds: 65);
static const Duration oauthProxyRetryDelay = Duration(seconds: 2);
}
/// Identifier used across the app to disambiguate per-service operations.
/// The enum's `.name` forms part of the persistence key — do not rename
/// without a migration.
enum TrackerService { mal, anilist, simkl, trakt, mdblist }
/// Blacklist+[] syncs every library (the default); whitelist+[] syncs nothing.
enum TrackerLibraryFilterMode { blacklist, whitelist }