Skip to content

WZ: Add Plex play history across the fleet - #55

Merged
codebend3r merged 3 commits into
mainfrom
play-history
Sep 19, 2026
Merged

codebend3r merged 3 commits into
mainfrom
play-history

Conversation

@codebend3r

Copy link
Copy Markdown
Owner

Adds a gated Play history page backed by a new collector in fleet-monitor.

  • Reads each of the five Plex servers' own completed-play ledger: a year backfilled on first run, then polled every five minutes with a two day overlap so an outage is a delay rather than a hole
  • Enriches played items from metadata for show, album and source quality, and inventories every library for what has never been played
  • Serves six admin-gated routes: overview, viewers, one viewer's history, most played, most rewatched, never played, plus sync status
  • Adds /plays to the portal: five views behind one filter bar for range, type (movie, TV, audio), quality (4K, 1080p, 720p, other) and server
  • Runs the collector beside the vitals loop in the existing fleet-collector container; no new service and no new portal env var

Why 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:nas after merge, or /plays/* answers 404. No new env is required; the monitor falls back to the PLEX_TOKEN already there.

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

netlify Bot commented Sep 18, 2026

Copy link
Copy Markdown

Deploy Preview for westeroz ready!

Name Link
🔨 Latest commit 2f823dc
🔍 Latest deploy log https://app.netlify.com/projects/westeroz/deploys/6aad792cc68bff0008e9dc4b
😎 Deploy Preview https://deploy-preview-55--westeroz.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@codebend3r
codebend3r merged commit befbad9 into main Sep 19, 2026
5 checks passed
@codebend3r
codebend3r deleted the play-history branch September 19, 2026 03:24
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.

1 participant