Phin Tech docs Rabbit Ears Manager in the store →

Plan: a dumb TV, and the station on Linux

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.

Written 2026-11-01, to pick up on the Mac mini. Self-contained: the notes Claude keeps are per machine, so what matters from them is here. Background: packages.md, linux-server.md, sport-channels.md, ADR 0003.

Where it stands #

All committed and pushed; 3149625 is the latest code. Nothing since 4e6b294 has been installed or tried on a real TV, a real provider or R2.

Done Commit
StationCore: models and clients out of Sources/Shared dea6f24
StationServer: the tower's parts 4d3f3a0
The packages build and test on Linux (just linux-check) 1c06abd
public narrowed to what another module uses 140a004
antenna-tower-server, Tower.serve(), just tower-image 20df8b3
StationJobs: the Manager's jobs 56adabd
Screens only play what the control room sorted aedc8f3
Sport rules out of the screens' apps: RetroSports 3149625

Install order matters. Update the Manager before the TVs. Until it has run one refresh with the new code, always-on sport streams stay off on an updated TV, because they wait for the published shows.

Status, 2026-11-02 #

Built in one unattended pass, each step its own commit on main. Built and type-checked on the Mac; none of it run on a TV, against a real tower or provider, on Linux, or by the Manager's signed tests (no Docker, and the keychain was locked to codesign).

Section State
1. ChannelSchedule Done, including removing eventGames (no backward compatibility, by decision) and moving Game, Event, EventSchedule, Showing to RetroSports. The TV app's dependencies hold no RetroSports or StationJobs. The strings check on a tvOS binary wasn't run (no tvOS runtime).
2. Fewer keys to screens Done: app=screen on GET settings, stationOnlyKeys, the R2 watch snapshot. iCloud and a manager-profile phone's full snapshot still carry them, as decided.
3. UI packages StationUI (all of Sources/Shared) and ManagerUI (Sources/Manager) are packages; the apps are shells; the tower builds from its own sources, with no UI and no VLCKit. Players (On Demand's engines and VLC) is its own package too. Not done: narrowing public (everything is public for now, see docs/packages.md).
4. Control room control-room pairs, runs the jobs and serves MCP with the settings-only tools (JobToolkit). Not done: the lineup's tools (channels, groups, numbers, feeds, test_stream, add_sport_channel) still need StationModel, so AssistantServer stays in the Manager. The protocol is shared.
5. Live Read-ahead on BSD sockets, STATION_PROXY, the Linux CI workflow and images, deploy/docker-compose.yml, antenna-tower export (the tower helper writes the bundle, as it holds the station on the Mac) and import, both untested. Not done, and not mine to do: pushing to the homelab GitOps repo, the test station, the move.

just linux-check has since run (Swift 6.3 on Ubuntu, in OrbStack): RetroLineup (237 tests), RetroRelay (43) and Station (8, including the socket listener and the MCP server over real sockets) pass, and every Station product, the control room included, builds. Still never run on Linux: pairing, avahi-publish, import, a real provider.

Next, in order: run just linux-check (needs Docker); pair the control room with a test tower; install the Manager, then the TVs; then narrowing public.

Decisions already made #

1. ChannelSchedule replaces eventGames #

The next job. The goal is that "games" is gone from the screens: on a TV a sport channel is just a multi channel with a schedule. Option (A) was agreed: sport and always-on channels only, shaped so groups can fold in later.

/// What a channel has on, as the control room worked it out.
public struct ChannelSchedule: Codable, Equatable, Sendable {
    var channel: IPTVChannel   // as scheduled for, like EventGames.channel
    public var asOf: Date
    public var items: [Item]   // in the channel's order: by entry, then start

    public struct Item: Codable, Equatable, Sendable {
        public var id: String      // stable: "game-<streamID>" or "stream-<id>", as OnAir.id
        public var title: String
        public var detail: String? // the source's own note on the row: "MLB 04"
        public var entry: Int      // index in channel.entries, for the order of onAir
        public var start: Date?    // nil: no time (an always-on stream, or a group's member)
        public var end: Date?      // "live until 5:00 PM"
        public var dated: Bool     // false: the day wasn't given
        public var plays: [Play]   // best first
    }
    public struct Play: Codable, Equatable, Sendable {
        public var source: Source
        public var broadcast: String  // "NFL PPV 4K", "Rangers Broadcast"; copies on other logins share it
        public var foreign: Bool      // commentary in another language
    }
    public enum Source: Codable, Equatable, Sendable {
        case channel(id: String)   // a group's member: unused for now
        case stream(id: String)    // one of the channel's own streams
        case feed(IPTVFeed)        // login, stream id and name: all `feeds(for:)` and `FeedChoice` read
    }
}

Checked against what the TV reads, the sketch needed these, now in it:

Users to change, all TV-linked:

PlexLibrary.swift is unrelated: it only matches on the genre "Game Show".

Steps:

  1. Add ChannelSchedule to StationCore, and a builder in StationJobs that turns [Game] and shows into it.
  2. Publish both eventGames and a new channelSchedules key from EventRefresher, so TVs and the Manager can update apart. Add the key to SettingsSync.
  3. Move the TV callers to ChannelSchedule. Rename while there: event channel view to a multi-channel name, GameRowView to an item row, and on-screen "Game" to something neutral.
  4. Move Game, Games.blocks, Event, EventSchedule and Showing to RetroSports. The guide's block layout needs a generic version over items. IPTVEntry.folder(EventSource) stays: it's only a folder reference.
  5. Once every TV has updated, stop publishing eventGames and remove its key.

Check when done: search the tvOS binary, as for 3149625:

strings -a ".build/Build/Products/Debug-appletvos/Rabbit Ears.app/Rabbit Ears.debug.dylib" \
  | grep -cE 'SportSorter|SportJudge|EventParser|ScheduleIndex|RetroSports'

Do the same for EventGames, Game and on-screen words such as "PPV".

2. Stop sending sports data to screens #

sportSettings, eventSchedules, sportSchedule, sportJudged and sportGuides still reach TVs, which don't read them. This is tidying, not a review matter: review never sees synced data unless given a demo station. eventSchedules and sportGuides are the large ones.

3. Finish the reorganization: UI packages #

This is what started the work: Sources/Shared shouldn't be a grab bag. The models, clients, server and jobs have left it, but it still holds 67 files and about 18,600 lines of views, players and view models, and every app compiles all of it. Agreed end state: per-app UI packages, Sources/Shared gone, and the app folders holding only @main, plists and assets.

Do it after sections 1 and 2, so views aren't moved and then rewritten.

Today:

Folder Lines Goes to
Sources/Shared 18,600 StationUI and Players, by who uses each file
Sources/Manager 9,900 ManagerUI (done 2026-11-02)
Sources/iOS 2,200 stays the phone's, or a PhoneUI
Sources/TVApp, Remote, AntennaTower under 150 stay as thin shells

Likely packages, in Packages/Station or a new Packages/StationUI:

Decide from the code, not this list:

  1. List which app actually uses each file in Sources/Shared. A file only one app needs goes with that app. The Manager compiles Shared today, but may use little of it: 13 Manager files name StationModel.
  2. StationModel is the knot (about 1,300 lines). Everything UI reaches it, and it reaches players, audio, modules and RemoteLink. Move it with StationUI, and put players behind a protocol so StationUI doesn't link VLC. Check whether the Manager needs all of it: the assistant was the main reason, and that goes in section 4.
  3. Split Players first: it's the most isolated (11 files import AVKit, AVFoundation or VLC), and the cleanest dependency to cut.
  4. Then StationUI, then ManagerUI. One commit per move, every app building.
  5. Rename as you go, using the three kinds of channel: linear, app, multi.
  6. Move the channel screens onto ChannelModule when touched (docs/channel-modules.md); don't rewrite them for this.

Watch for:

Done when Sources/Shared is deleted, Sources/Manager is a shell, the tower links no UI, and all four apps build with the checks below.

4. The control room on Linux #

Plan in linux-server.md, stage 6. A headless Manager client:

  1. control-room, an executable in Packages/Station, built like antenna-tower-server: AppKind.current = .controlRoom, the same STATION_DATA handling (move it to a shared helper), and an image.
  2. First start pairs with the tower, from environment: say STATION_SERVER and STATION_PAIR_CODE, using RemoteLink. It needs a manager profile.
  3. It runs EventRefresher; isControlRoom already says yes for .controlRoom. Check RemoteLink.start() and SettingsSync work with no app around, and that a Mac Manager doesn't also run the jobs.
  4. Jev's key needs nothing new: typesafeAPIKey is manager-only and already syncs for the jobs, wherever they run.
  5. The assistant, the largest piece: rewrite AssistantTools (1,400 lines) against the settings and jobs instead of StationModel, on Hummingbird. Same tool names and arguments (docs/mcp.md). Then remove AssistantServer.

Done: the tower's Xcode target builds from Sources/AntennaTower alone.

5. Getting the server live #

  1. Read-ahead on Hummingbird. ReadAheadServer's listener is NWListener behind #if canImport(Network); on Linux startListener returns nil, so titles play from their address. Add a Linux route with range requests. Leave the Apple path alone at first.
  2. CI and deploy. A Forgejo job for just linux-check and the image, then the homelab GitOps repo (the deploy-app-to-homelab skill): network_mode: host, a /data volume, and the host's /var/run/dbus and /var/run/avahi-daemon/socket for avahi-publish.
  3. A test station beside the Mac mini, with its own R2 prefix and keys, until screens, invites and the mirror check out.
  4. The move: antenna-tower import <bundle> from the Mac mini (not written), the new address published, and the Mac's Manager joining as a client. See linux-server.md, stage 4.

Decided:

6. Later #

Never run yet: the Linux gunzip in GuideFiles, avahi-publish against a real daemon, and StreamingFetch against a real provider.

How to work here #

just linux-check                  # needs Docker; makes rabbit-swift-linux:6.3 once
just check-tvos
swift test --package-path Packages/RetroLineup
swift test --package-path Packages/RetroRelay
xcodegen generate

Build each app without signing; the tvOS and iOS schemes need -destination generic/platform=tvOS or iOS:

xcodebuild -project RetroTV.xcodeproj -scheme RetroTV-Manager -destination platform=macOS \
  -configuration Debug -derivedDataPath .build CODE_SIGNING_ALLOWED=NO build -quiet

The Manager's tests must be signed, or the host hangs:

xcodebuild -project RetroTV.xcodeproj -scheme RetroTV-Manager -destination platform=macOS \
  -derivedDataPath .build DEVELOPMENT_TEAM=J35P7AJDN7 BUNDLE_PREFIX=tech.phin \
  -allowProvisioningUpdates test

Pitfalls met so far: