Phin Tech docs Rabbit Ears Manager in the store →

Channel modules, and the MBTA channel

Design agreed and built 2026-09-27.

A station channel used to be wired up in five places: a ChannelKind case, a branch in StationModel.advanceFlavor() for up/down, a settings struct with its own load and save, its key added by hand to SettingsSync.keys, and in the Manager a Pane case and hand-written assistant tools. A channel module puts all of that in one place. The MBTA channel was the first, then the World channel; Weather, Radio, Screensavers and the rest still wire themselves up by hand, and move over one at a time when they're next touched.

Decisions #

  1. New channels first. The framework is proved on the MBTA channel; the working channels aren't rewritten to use it now.
  2. A module declares everything once, in two parts (split 2026-10-29 so the server can know modules without their views; see docs/packages.md):
    • Its definition (ModuleDefinition, in StationCore's Station/ModuleDefinitions.swift; the MBTA's is TransitChannel):
      • id (kept forever: the channel's number and name are stored by it), name, guideTitle and toolName;
      • pages, which up/down steps through. The channel stays on the page picked, remembered on each device (modulePage.<id>, not synced);
      • Settings, a ModuleSettings type: Codable, stored under its key and synced automatically (ChannelModules.settingsKeys is added to SettingsSync.keys). Its fields describe each setting for the tools, and validated() tidies or refuses what it's given. Listing it in ChannelModules.all puts it on the dial (as ChannelKind.module(id)), in the TV Guide and in sync.
    • Its screen (ChannelModule, in Packages/Sources/StationUI/Station/ChannelModules.swift; the MBTA's is TransitModule): names its Definition, and has view(page:context:) and optionally playPause(page:). An on/off setting given a title is also a switch in the channel's Select menu. Listed in ModuleScreens.all.
  3. The Manager side is a ManagerModule (Packages/Sources/ManagerUI/ManagerModules.swift): its definition as Module, its icon and pane(), listed in ManagerModules.all. The sidebar shows modules under Channels.
  4. Its tools are mostly generated. Every module gets get_<toolName> (the settings, what each field means, and the pages) and set_<toolName> (only the fields given change; null puts one back to its default; validated() checks the result). A module adds hand-written tools only for what settings can't express, through tools(). The merge is ModuleSettingsJSON.apply, tested without touching real settings.
  5. Each module writes its own pane. A form generated from the fields would handle the MBTA's station search and line toggles badly.

The MBTA channel #

TransitModule (id transit, tools mbta) has three pages:

  1. Departures: the countdown board, as before, now from your stations.
  2. Nearby: a live map over a dark Apple Maps base, framed on your stations and the bus radius around the weather location. Lines are the MBTA's shapes in their colors (commuter rail's purple lifted a little to show on the dark map); trains are dots and buses are route-number tags, each with an arrow for its compass heading. It refreshes every 10 seconds while it's on screen, and vehicles glide between updates.
  3. Subway: a T-map style diagram (TransitSchematic, in RetroLineup) of the Red, Mattapan, Orange, Blue and Green (B–E) lines, with every train on it.

Settings (TransitSettings, key mbta): stations (MBTA place ids), busRadiusKm (0 for no buses, up to 10), systemRoutes (the diagram's lines; null for all of them), stationNames (names on both maps) and busNumbers (route numbers on the Nearby map's buses; off, they're plain yellow dots). Play/Pause on a map page steps through the four ways to label the maps and says which on screen: it's saved and synced, so the Manager shows it too, and the maps redraw at once (TransitLive watches the setting) rather than at their next refresh. Modules get Play/Pause through playPause(page:); the channel isn't live, so ad block has no use for it there. A 10 km radius holds over a thousand bus stops, so the routes serving them are looked up 150 stops at a time. The Manager's MBTA pane edits them; find_mbta_stations and list_mbta_lines find the ids the tools take.

The diagram #

We looked for an SVG to use. The best, MBTA_Rapid_Transit.svg by Mliu92 on Wikimedia Commons (CC BY-SA 4.0), is from 2018 (no Green Line Extension) and portrait, which is unreadable squeezed onto a TV. Generating a layout from the geography alone (a log-squeezed "fisheye") was tried and dropped for the same look. So the layout is modeled on that SVG and re-laid for a wide screen: the same style (lines at 45° and 90°, white station dots, bolder transfers) and arrangement, with the Extension added and the southern branches turned east. Being derived from it, the layout is CC BY-SA 4.0, credited on screen.

The World channel #

Built 2026-09-27. WorldModule (id world, tools world): the Earth by day (NASA's Blue Marble Next Generation) with its city lights by night (VIIRS Black Marble) showing through wherever the sun is down, easing through dusk from 3° above the horizon to 9° below. The line between day and night is drawn softly and moves with the sun (redrawn every minute; Sun in RetroLineup, NOAA's low-precision formulas), and a sun marks the point it's straight above.