3.9 KiB
subwave-nowplaying
Tronbyt/Tidbyt app showing the current track on a SUB/WAVE internet radio station: album art, track title/artist (scrolling), a thin separator, the current show and host, and a full-width footer with time/temperature and a track progress bar pinned to the bottom edge. Color scheme (cyan title/artist, white show name, magenta host/progress bar) is loosely modeled on SUB/WAVE's own web now-playing display.
Not tied to any specific station — set your own station's base URL in the app's config when adding it to a device.
Configuration
- Station URL — the base URL of your SUB/WAVE instance, e.g.
https://radio.example.com. No trailing slash needed (stripped automatically). No auth required — SUB/WAVE's now-playing and cover-art endpoints are public.
How it works
GET {station_url}/api/now-playing— track title, artist,subsonic_id, DJ/station name, and stream online status. Cached 20s.GET {station_url}/api/cover/{subsonic_id}— album art JPEG, proxied by SUB/WAVE itself (no Navidrome credentials needed). Cached 300s.- If the station reports
streamOnline: false, shows " offline" instead of stale track info. - If a track has no
subsonic_id, or the cover fetch fails, falls back to a full-width layout with no art rather than a broken image. - Shows the current show name (
context.activeShow.name) and host name (dj.name) below the artist, separated by a thin divider line. - Shows the local time and temperature (
context.clock/context.weather) and the track progress bar as a full-width (64px) footer overlaid on the bottom of the layout — not confined to the 32px-wide text column, which gives roughly 2x the character budget for the time/temp line (at the cost of covering the bottom ~9px of the album art with a translucent bar).
Why show/host/time-temp are plain Text, not Marquee: pixlet's Marquee runs its own internal scroll-cycle animation regardless of whether the text actually needs to scroll, and combining multiple Marquees with very different cycle lengths in one Root desyncs them — confirmed via an isolated repro where a short Marquee'd line intermittently collapsed to a single character on frames where the long title/artist marquees were mid-cycle. Only title/artist (which actually benefit from scrolling for long names) use Marquee; the shorter supplementary fields use plain Text/Row and just clip if too wide, which is an acceptable tradeoff.
Progress bar caveat: the now-playing API reports track duration but
not elapsed/remaining time, so the app tracks playback position itself —
the first time it sees a given subsonic_id, it stamps the current
wall-clock time in pixlet's cache, then diffs against that stamp on later
renders to compute elapsed seconds. This only works correctly on a
long-lived server process with a persistent cache (true for
tronbyt/server's in-memory cache) — a one-shot pixlet render CLI
invocation always starts a fresh process with an empty cache, so the bar
will always show 0% when testing locally. This is expected, not a bug.
Note on unreachable hosts: if the station URL is wrong or the host is
completely unreachable (DNS failure, connection refused), http.get raises
a hard error and the render fails for that cycle — this is normal pixlet/
Starlark behavior (no try/except in the language), not a bug. Only
HTTP-level errors (404, 500, etc.) are something the app can catch and
display a message for, which it does.
Dev/test
pixlet render subwave_nowplaying.star station_url=https://your-station.example.com
pixlet serve subwave_nowplaying.star
Deploy
Upload subwave_nowplaying.star directly through your Tronbyt server's
"Upload app" button on a device's Add App page (single file, no bundled
assets — no need to zip). Configure the Station URL field when adding it to
your device's schedule.