Phin Tech docs Rabbit Ears Manager in the store →

On Demand fetched by the relay's Mac: playing and keeping

Superseded 2026-11-03. The Swift server (StationServer, RelayServer, antenna-tower-server, control-room, the Manager's launchd helper and MCP assistant) was replaced by the Go tower in tower/ (ADR 0005). What follows is history.

Design agreed 2026-10-17. Step 1 (buffer jobs, played from the Mac) is built: see "Built" below. Keeping into Plex is not.

Today a screen plays a provider's file by downloading it itself (read-ahead.md), and "download into Plex" is planned as a separate job on the relay's Mac (vod-relay.md, phase 2). Both are one thing: the Mac fetches a copy from its login. This doc makes them one mechanism.

Why move it:

The Mac mini is always on, so it is the default path. The screen's own read-ahead stays as the fallback.

Decisions #

  1. One fetch job per copy, on the relay's Mac. A job downloads a copy from its login with one request at a time, moved when the player skips (as ReadAheadSession does now, with the same runs map).
  2. Two kinds.
    • Buffer: started by Play. Held in the buffer folder, the bytes behind the picture let go, deleted when the last screen stops.
    • Keep: started by Download. Written whole into the Plex folder on the NAS under a temporary name, renamed when complete, then Plex is asked to scan, as vod-relay.md describes. The title gains its · Plex copy, first choice from then on, and screens don't read Plex ahead.
  3. Playing a title being kept is the same job. The screen reads the partial file as it fills. A skip past what has arrived moves the download there; once playback ends, a second pass fills the gaps (the runs map knows which).
  4. Playback comes first. A keep job on a login pauses when a screen plays from it, and carries on from what's held afterward. Keep jobs queue one at a time per login. A screen that falls back to the provider asks the relay (or IPTVLoad) first, so it doesn't meet a keep job on a one-stream login.
  5. One screen per job, for now. The player's place is whichever reader read last (ReadAheadPlayhead). Two screens at different places would pull the one download back and forth. A second screen on the same title gets its own job, or waits: per-screen places are a later change.
  6. The buffer folder is chosen in the Manager. It defaults to a folder on the Mac's own disk, not the NAS: a scratch buffer over SMB is one more way to fail. The Plex folders (movies, TV) are separate, set in the Plex pane.
  7. Keeping is manual. A Download button on a title's card (and on a series, for the whole show), in the Manager, and over MCP. Titles are not kept because they were watched.
  8. Fallback is today's read-ahead. No relay, a relay that doesn't answer, or a job it refuses: the screen downloads for itself as it does now. The relay's hello says vodPlay: true when it serves jobs, so an older screen or Mac carries on as before.

The protocol #

Same token and client tracking as the planes feed (docs/manager-relay.md). Over the LAN only; the address a screen opens carries a job name, never a login.

Request Answer
POST /v1/vod/jobs (copy, kind) Starts or joins a job: its name, the file's length, or why not.
GET http://<relay>:<port>/<job>.<container> The file, ranged, as ReadAheadServer answers VLC now.
GET /v1/vod/jobs/<job> How it stands (held ahead, starved, failed, requests, slow): the screen asks every 2 s.
DELETE /v1/vod/jobs/<job> The screen is done: a buffer is deleted, a keep carries on.
GET /v1/vod/jobs Every job: title, kind, login, bytes held, queued or paused.

The file isn't a Hummingbird route: VLC can't send the household token, and the read-ahead server already lets go of the read a player left waiting when it hangs up at a skip (a Hummingbird handler waiting on the download wouldn't notice until it next wrote, and would pull the download back to where it was).

In the code #

Built (2026-10-17): step 1 #

Not yet: Keep jobs, the per-login queue, the Relay pane's list (the route is there), MCP, and a play job counted against its login's streams.

Order #

  1. Know why it sticks first. The loading report now ends with requests N (how many requests VLC made of the screen's own server), and the app restarts that server on return from the background. A stuck load with requests 0 never reached the server; with more, VLC connected and stopped by itself, which moving the download to the Mac would not cure.
  2. Job table and play route on the Manager; screens opt in; one title tried.
  3. The Plex write path: the share checked and remounted, temporary name and rename, queue per login, section scan.
  4. Play while keeping, and the second pass.
  5. The UI: Download on the card, the Relay pane queue, MCP.

Risks #

Open #

Too slow #

The screen sends the title's running time with the job (seconds, when it knows it; for a movie it doesn't time, the tower asks the provider). With it the tower knows how fast the file has to come: its size over its running time. Once a job has been downloading 15 s, it is judged every look by the provider's rate over the latest 20 s: when what's still missing from the player's place to the end would take longer to bring than the picture takes to play, the job is slow (said once, and kept). The look also carries mb_per_s and needs_mb_per_s. A screen that sees slow moves to the title's next copy, from the same place; with no other copy it carries on, and its own stall watch still offers to buffer ahead.