Repository navigation
Add Scrob (self-hosted media tracker) as a watch history source - #218
DemianosHB wants to merge 3 commits into
Conversation
Reads watched movies, shows and ratings from a self-hosted Scrob instance via its REST API, using the per-user API key (X-Api-Key) and the instance URL as credentials. Episodes collapse into their show, TMDB-only ids resolve through TMDB, and title-level ratings ride along as they do for MDBList. Co-authored-by: DemianosHB <DemianosHB@users.noreply.github.com>
|
@mistral-vibe is attempting to deploy a commit to the Bimal Timilsina's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Does this take into account the ratings the user gives in scrob? |
|
Short answer: Yes. The PR ( #218) does transmit user ratings from Scrob to Watchly.
The PR does not change the way Watchly handles these ratings internaly. |
The daily refetch gate covers sources whose fetch pipeline fails hard instead of degrading to an empty history. Scrob has the same contract as Nuvio: ScrobService.get_history raises on failure, and a failed fetch is never cached, so an outage keeps serving the previous library instead of caching an empty one over it. Without the gate entry, new Scrob watches only reach the home rows through a manual dashboard refresh, because everything the scheduled refresh rebuilds reads the cached library. The tuple is the end state also proposed in TimilsinaBimal#222 (Nuvio): whichever lands first makes the other a no-op, so the gate line cannot diverge.
|
One gap in the original branch, now addressed in b492b23: the scheduled background refresh never refetched the Scrob library, so new watches would only have reached the home rows through a manual dashboard refresh (the daily task rebuilds everything from the cached library, and cache TTLs renew on every read). Scrob now joins the daily refetch gate alongside Stremio and Nuvio (
So during a Scrob outage the scheduled refresh keeps serving the previous library; it cannot cache an empty history over the user's real one the way a Trakt/Simkl outage would (#172). Note on merge order: the tuple equals #222's end state. Whichever lands first makes the other a no-op, so the gate line cannot diverge between the two PRs. |
Scrob's FastAPI backend serves /history and /ratings but is internal-only (localhost). External API clients go through the web UI's /api/proxy prefix; the UI's session middleware only exempts that prefix when an X-Api-Key header is present. Calling /history on the web URL served the login page HTML (status 200), so the probe passed silently and every history fetch parsed zero items. All calls now use /api/proxy/<path>, and the probe additionally rejects non-JSON responses so a wrong base URL fails loudly at configure time instead of leaving the library silently empty.
Adds Scrob as a sixth watch history source, next to Stremio, Trakt, Simkl, MDBList and Nuvio. Credentials are the instance URL plus the per-user Scrob API key, sent as an X-Api-Key header against the instance's own REST API (GET /history, GET /ratings) — no cloud service involved. Movies map 1:1 (repeat plays keep the rewatch signal); episodes collapse into their show so a series counts once; title-level ratings attach to watched items or create rated-only items, as MDBList does; TMDB-only ids resolve to IMDb ids via TMDB, as the Nuvio source does. Account identity is a SHA-256 hash of instance URL + key (Scrob's API-key surface exposes no user id), so the raw key stays out of stored identities; the key itself is encrypted at rest and masked on the configure page. New Scrob card on the Accounts page, Scrob in the source picker, /scrob/validation probe, dashboard badge, README updates. 5 new tests in tests/test_scrob_history.py (all pass; full suite 218 passed, 8 pre-existing failures caused by the missing live TMDB_API_KEY in this environment). Pre-commit hooks pass.
Closes #203