Skip to content

Add Scrob (self-hosted media tracker) as a watch history source - #218

Open
DemianosHB wants to merge 3 commits into
TimilsinaBimal:mainfrom
DemianosHB:vibe/scrob-history-source
Open

DemianosHB wants to merge 3 commits into
TimilsinaBimal:mainfrom
DemianosHB:vibe/scrob-history-source

Conversation

@DemianosHB

Copy link
Copy Markdown
Contributor

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

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>
@vercel

vercel Bot commented Nov 16, 2026

Copy link
Copy Markdown

@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.

@Sberla996

Copy link
Copy Markdown
Contributor

Does this take into account the ratings the user gives in scrob?
For example, ignore movies rated under 4/10?

@DemianosHB

Copy link
Copy Markdown
Contributor Author

Short answer: Yes. The PR ( #218) does transmit user ratings from Scrob to Watchly.

  • Besides GET /history, the Scrob service also calls GET /ratings from your Scrob instance (auth via X-Api-Key).
  • Title-level ratings are attached to already-watched items or create "rated-only" entries, exactly the way the existing MDBList source handles it in Watchly.
  • So ratings feed into the taste profile just like with Trakt/Simkl/MDBList ("Ratings, watches, loves, and rewatches are all understood", per the updated README).
  • Implemented cleanly: episode ratings collapse to the show level (a series counts once), movies map 1:1.

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.
@DemianosHB

Copy link
Copy Markdown
Contributor Author

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 (in ("stremio", "nuvio", "scrob")). Included for the same reason Nuvio is proposed in #222 rather than being lumped with Trakt/Simkl:

  • ScrobService.get_history raises on failure instead of returning an empty history (same contract as Nuvio, per its docstring).
  • fetch_external_watch_history maps failures to None (401/403 additionally flags the key revoked and clears it), and cache_library_and_profiles never caches a failed fetch.

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add Scrob (self-hosted media tracker) as a watch history source

3 participants