Files
retroLabs/HANDOFF.md

10 KiB

retroLabs Project Handoff

Updated: 2026-11-13

Status

The initial bridge, Compose stack, and Roku client are implemented. The backend runs on the current machine at 192.168.0.203:4242. See README.md to set up programming and build the Roku package. Tunarr programming and physical Roku acceptance remain open. The visionLabs reference checkout was unavailable on this machine.

Product goal

Build a Roku app that behaves like an old cable television system while using the owner's personal media library:

  • Automatically find its backend on the local network.
  • Tune channels with up/down controls and join programs already in progress.
  • Provide configurable channels, weekly schedules, sequential episodes, marathons, commercials, bumpers, and filler.
  • Provide a classic program guide and retro channel banner/static transitions.
  • Include an original WeatherSTAR-inspired channel with live current conditions, forecasts, and alerts.
  • Keep normal playback local to the LAN; internet access is only needed for live weather and optional metadata.
  • Run the backend on the current machine.

The user clarified that REA means “reverse engineer anything.” For this project, use that as permission to study behavior, protocols, and permissively licensed open-source implementations. Preserve license notices, build original branding/assets, and do not bypass DRM or copy protected branding.

Agreed technical direction

Use Tunarr as the scheduling and streaming core, with a small custom RetroTV Bridge and a custom Roku SceneGraph app.

Do not make FieldStation42's local player the primary runtime. FieldStation42 is a valuable design/configuration reference and may get an importer later, but its player renders locally through MPV and its WeatherStar integration is a web channel. A Roku client needs network HLS and cannot directly embed that browser experience.

Tunarr was selected because it already supplies:

  • Local-folder, Plex, Jellyfin, and Emby media sources.
  • Channel creation and EPG data.
  • Time-slot, sequential, cyclic, and randomized scheduling.
  • Filler, bumpers, commercials, and mid-roll breaks.
  • FFmpeg-backed HLS suitable for Roku.
  • Docker and Linux ARM64 support.

The RetroTV Bridge owns the Roku-specific integration and keeps Tunarr replaceable.

Target architecture

Roku SceneGraph app
        |
        | SSDP discovery (UDP 1900)
        | Roku JSON API + HLS (HTTP, externally exposed port 4242)
        v
RetroTV Bridge / reverse proxy on the current machine
        |-- stable server identity and health endpoint
        |-- device pairing/token management
        |-- Roku-friendly channel and guide API
        |-- live weather provider/cache
        |-- special-channel injection (weather initially)
        |-- proxy/rewrite Tunarr HLS and admin traffic
        v
Tunarr (internal-only port, expected 8000)
        |-- catalog and schedule database
        |-- FFmpeg/HLS channel workers
        `-- read-only media mounts

Only one configurable HTTP port should need to be exposed to the LAN. Use 4242 by default because it is memorable and matches FieldStation42's convention. Internal container ports do not count as externally exposed service ports.

Discovery behavior

Do not start with a blind scan of every LAN address.

  1. Try the last saved server URL and verify its stable server ID.
  2. Send an SSDP M-SEARCH request with a retroLabs-specific service type.
  3. The bridge responds with its identity and LOCATION, including its configured HTTP port.
  4. If multiple servers respond, show a server picker.
  5. Remember the selected server in the Roku registry.
  6. Provide manual IP/port entry when multicast is blocked by a guest network, VLAN, or AP isolation.
  7. A bounded fixed-port /24 probe may be added later as an optional fallback, not the primary method.

Proposed discovery identity:

ST: urn:retrolabs:service:retrotv:1
LOCATION: http://<server-ip>:4242/api/v1/device.xml
USN: uuid:<stable-server-uuid>::urn:retrolabs:service:retrotv:1

Initial bridge API contract

Keep this versioned and small:

GET  /api/v1/health
GET  /api/v1/server
POST /api/v1/pair/start
POST /api/v1/pair/complete
GET  /api/v1/channels
GET  /api/v1/channels/{channelId}/now
GET  /api/v1/guide?from=<iso>&hours=<n>
GET  /api/v1/weather
GET  /stream/{channelId}/master.m3u8
GET  /admin/...

The bridge should normalize Tunarr responses into compact JSON rather than making BrightScript parse M3U/XMLTV or depend on Tunarr's internal API shapes.

Roku app behavior

Use classic BrightScript and SceneGraph for broad device compatibility.

Core screens/components:

  • Discovery/pairing screen.
  • Full-screen tuner using a SceneGraph Video node and HLS.
  • Channel banner with number, name, now/next, progress, and clock.
  • Program guide.
  • Native weather channel.
  • Settings/server diagnostics.

Remote behavior for the first milestone:

  • Up/down: previous/next channel.
  • OK: show or extend the channel banner.
  • Star: open the guide/settings menu.
  • Replay or left: previous channel, if reliable across the target devices.
  • Back: leave the guide first, then exit playback/app.

The server clock is authoritative. Tuning a linear channel must join the current program at the correct wall-clock point rather than restarting it. Two Roku devices tuning the same channel should see approximately the same moment.

Weather channel

Implement weather natively in SceneGraph rather than attempting to embed a web page.

Initial rotation:

  • Current conditions.
  • Hourly forecast.
  • Extended forecast.
  • Sunrise/sunset and basic almanac values.
  • Active alerts with an interrupting crawl/banner.

Use a provider adapter. Start with the US National Weather Service when the configured location is in the United States, cache responses on the bridge, and retain the last good observation during temporary outages. Add an international provider later. Radar animation is a later milestone because it adds tile-provider, attribution, and performance decisions.

The visual treatment should evoke late-1980s/1990s cable weather systems while using an original name, layout, graphics, and licensed/user-supplied music.

FieldStation42 compatibility, later

An optional importer can map FieldStation42 concepts without running its player:

  • standard and loop stations -> Tunarr channels.
  • content_dir -> local media sources/playlists.
  • commercial_dir and bump_dir -> filler lists.
  • Hourly/day rules -> Tunarr time slots.
  • Streaming stations -> remote-stream channels.
  • Guide/weather/web stations -> native Roku special channels or a clear unsupported warning.

Do not block the first milestone on this importer.

Planned project layout

The new project may adjust names, but start near this shape:

retroLabs/
  roku/                 # manifest, source/, components/, images/
  bridge/               # discovery, normalized API, weather, proxy
  deploy/               # Compose/service configuration
  tests/                # API/contract tests and fixtures
  docs/
  README.md
  HANDOFF.md

Recommended bridge implementation: Python 3.12+ with FastAPI/uvicorn because the existing Roku workspace already uses Python bridges and it keeps SSDP, weather caching, and API work straightforward. Keep the reverse proxy/HLS path streaming; never buffer entire video segments into memory.

First vertical slice

The first milestone is complete only when all of the following work on a real Roku and the current machine:

  1. A Compose stack starts Tunarr and the RetroTV Bridge.
  2. The bridge exposes GET /api/v1/health on LAN port 4242.
  3. The Roku discovers the bridge automatically on the same subnet and remembers it.
  4. Tunarr indexes one small read-only test-media folder.
  5. Two channels appear in the Roku lineup.
  6. Both channels play through the Roku Video node as HLS.
  7. Up/down changes channels and shows a basic channel banner.
  8. Tuning joins the program in progress based on server time.
  9. A basic guide lists now/next programming.
  10. A placeholder native weather channel appears in the lineup and can later be wired to live data.
  11. Rebooting the Roku or backend recovers without reconfiguration.

Defer polished CRT effects, advanced guide styling, radar, a FieldStation importer, and Roku Store distribution until this slice is stable.

Current deployment

The current machine runs Linux x86-64 and Docker Compose. The bridge listens on LAN TCP port 4242, with Tunarr reached internally through host loopback port 14242. Compose mounts the configured media path read-only and persists application state in named volumes. The default media directory is data/media/. Use a compatible H.264/AAC sample first and verify playback before enabling hardware transcoding.

Existing local reference

The sibling project ../visionLabs already demonstrates:

  • Roku BrightScript/SceneGraph packaging.
  • LAN HLS playback through a Python/FFmpeg bridge.
  • A simple ZIP build script.
  • Real-device behavior when direct upstream streams are not Roku-compatible.

Study it as a reference, especially its HLS playback and packaging, but do not couple retroLabs to it or change its files.

Roku permits only one sideloaded development app at a time. Testing retroLabs will temporarily replace the installed development build of visionLabs on the device, but both source trees and ZIP artifacts remain independent. Move to a Roku beta/public package later if both apps need to remain installed concurrently.

Remaining setup and acceptance

Add a media source and program two channels in Tunarr, then sideload the Roku ZIP and run the first vertical slice checks. Set the weather location when connecting the live provider.

Primary references