Files
retroLabs/README.md

70 lines
5.7 KiB
Markdown

# retroLabs
retroLabs runs a private cable-style TV lineup from your media library. Tunarr handles programming and linear HLS. The RetroTV Bridge serves the Roku app and forwards Tunarr's web UI over the same LAN port.
## Set up programming
The stack on this machine uses [Tunarr at 192.168.0.203:4242](http://192.168.0.203:4242/web/).
1. Put a few compatible test videos in `data/media/`, or set `RETROTV_MEDIA_DIR` in `.env` to an existing library and run `docker compose up -d`. The directory is mounted read-only at `/media` inside Tunarr.
2. In Tunarr's media sources, add a Local source and a library under `/media`. Start a scan. You can also connect an existing Plex, Jellyfin, or Emby source.
3. Create two channels with different numbers. Use HLS as the channel's stream mode for the initial Roku test. Add programming to each channel, save, and use Tunarr's Guide and Watch actions to verify the schedule and playback.
4. Open the [Roku channel lineup](http://192.168.0.203:4242/api/v1/channels) to check that both channels and the native weather channel are present.
See the [Tunarr setup walkthrough](https://tunarr.com/getting-started/setup/) and [scheduling documentation](https://tunarr.com/configure/scheduling/) for time slots, sequential programming, and filler.
## Commercials and short videos
Place commercial clips in `data/commercials/`. Compose mounts that folder read-only at `/commercials` in Tunarr. On this host the **Commercials** Local source already points there. On a new deployment, create an **Other Videos** Local source with that path.
Scan the source after adding clips, then create a **Commercials** filler list under **Library → Fillers**. For breaks between episodes, assign the list as **Post** filler in a slot schedule. For breaks during episodes, assign it as **Mid** filler and set the break timing. Channel-level Flex uses filler only when the lineup contains Flex time.
YouTube watch links use YouTube's web player. To put videos in a retroLabs channel, obtain playable files from the creator or another authorized download source and add them to a Tunarr **Other Videos** library. Keep a separate library for clips intended as regular programming.
## Start the stack on another checkout
Requires Linux, Docker with Compose, and an available LAN IPv4 address.
```sh
mkdir -p data/media
cp .env.example .env
# Set RETROTV_LAN_IP in .env to this machine's LAN IPv4.
docker compose up -d --build
docker compose ps
docker compose logs -f bridge tunarr
```
Use `http://<LAN-IP>:4242/web/` for the programming UI and `/api/v1/health` for the bridge health check. Tunarr's internal port 8000 is published only on host loopback port 14242. The bridge uses host networking for SSDP on UDP 1900 and binds HTTP to the configured LAN IP. Admin and device access currently share the trusted LAN with no bridge-level authentication. Compose persists Tunarr's configuration and the bridge's UUID in named volumes. Tunarr defaults to two CPU cores of capacity to limit the impact of scans and transcoding on the host. Set `TUNARR_CPUS` in `.env` to change the limit. Tunarr also defaults to a 2800 MiB memory cap without container swap to contain memory pressure during concurrent streams. Set `TUNARR_MEMORY_LIMIT` to adjust it. Idle HLS connections become eligible for cleanup after 15 seconds, with Tunarr checking on its scheduled cleanup pass.
## NVIDIA transcoding on this host
The current host uses the NVIDIA Compose override for Tunarr's CUDA transcode profile. The local `.env` selects it with `COMPOSE_FILE=compose.yaml:deploy/compose.nvidia.yaml`. The override maps NVIDIA device nodes and the host's x86-64 driver libraries into Tunarr. If the host driver version changes, set `TUNARR_NVIDIA_DRIVER_VERSION` in `.env` to the version shown by `nvidia-smi` and recreate Tunarr with `docker compose up -d --no-deps tunarr`.
## Weather channel
Tune to channel 99 in the retroLabs Roku app. This host is configured for Dunnellon, FL (34431). The screen rotates through current conditions, six hourly periods, three extended forecast cards with daily highs and lows, and sunrise/sunset. Active NWS alerts appear across the rotation. The bridge caches data and marks delayed responses.
To set a location on another host, set `RETROTV_WEATHER_POINT` (latitude,longitude) and `RETROTV_WEATHER_LOCATION` in `.env`, then run `docker compose up -d --no-deps bridge`. The bridge serves the feed at `/api/v1/weather`. Weather is rendered by the Roku app.
To add background music, place a local MP3 at `data/weather/forecast.mp3` on the bridge host. The file is served over the LAN and loops while the weather channel is open. The directory is mounted read-only in the bridge and ignored by Git.
## Roku
Run `./roku/build.sh` to produce `roku/dist/retroLabs.zip`. See [Roku setup and controls](roku/README.md) for sideloading and manual server entry.
## Backend contract tests
```sh
python3 -m venv .venv
.venv/bin/pip install -r bridge/requirements.txt
.venv/bin/python -m unittest discover -s tests -v
```
The tests exercise lineup and guide normalization, server ID persistence, Tunarr admin writes, and HLS manifest/segment forwarding. Physical Roku discovery, playback, live tuning, and reboot recovery are the remaining device acceptance checks. Pairing is deferred.
## IPTV channels
Add direct Roku-compatible HLS feeds to `data/iptv/channels.json`. Each entry has a stable lowercase `id`, a positive `number`, a `name`, and a `url`. The file stays local. Restart the bridge with `docker compose restart bridge` after changes, then refresh channels in the Roku app. Tunarr numbers take precedence when a number overlaps, and 99 is reserved for weather.
The Roku plays the feed directly. These channels appear in the retroLabs guide with a live label. Program listings require a separate schedule feed.