WZ: Add Plex play history across the fleet - #55
Merged
Merged
Conversation
- add a Plex probe that reads each server's own history, sections, accounts, and devices - store plays, viewers, and library inventory in the monitor database, keyed by host - run the history sweep every 5 minutes and the library inventory every 6 hours, alongside the vitals loop - serve six gated /plays routes: overview, viewers, viewer history, top titles, never played, sync status - reach vermithor and vhagar over https with verification off, since Plex presents a wildcard certificate on a LAN address - read the owner token from FM_PLEX_TOKEN, falling back to the bridge's PLEX_TOKEN - bound the first backfill with FM_PLEX_LOOKBACK_DAYS, defaulting to a year, and prune nothing after - move the gather error logger into fleet_monitor/tasks.py so both loops share it
- add /plays behind the same Supabase gate, lazily loaded like the other chart pages, and list it in the side menu - read the monitor's six play history routes through a shared playsApi module - build the page from overview tiles, a timeline, viewers, top titles, and never played panels - keep filter and view choices in a zustand prefs store, and keep the sync status out of query persistence - export fleetApi's requestJson so the 401 wording and the JSON check stay in one place - add play, unplayed, and users icons
- list the six /plays routes as gated, and say why the ledger is admin data - document FM_PLEX_TOKEN, its PLEX_TOKEN fallback, and FM_PLEX_LOOKBACK_DAYS - explain the https exception for vermithor and vhagar - describe what the first backfill does and how to watch it land - add three troubleshooting rows for no_token, refused, and an empty never played list - keep the plan and design spec for the feature
✅ Deploy Preview for westeroz ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a gated Play history page backed by a new collector in fleet-monitor.
/playsto the portal: five views behind one filter bar for range, type (movie, TV, audio), quality (4K, 1080p, 720p, other) and serverWhy not Tautulli: it only knows plays from the day it was installed and watches one server. The ledger already exists on all five.
Verified against the live fleet: 6,663 plays and 177k items, a full round in under three minutes, 399 backend and 507 portal tests green.
The NAS needs
bun run deploy:nasafter merge, or/plays/*answers 404. No new env is required; the monitor falls back to thePLEX_TOKENalready there.