Pin progress bar to bottom, add show/host line with new color scheme

This commit is contained in:
poprhythm committed 2026-09-28 23:11:12 -04:00
1 parent 1d2021e6f2
commit 607fe9abe4
2 files changed
+43 -16

No files matched your search

+7 -4
View File
@@ -2,8 +2,10 @@
Tronbyt/Tidbyt app showing the current track on a [SUB/WAVE](https://github.com/perminder-klair/subwave) Tronbyt/Tidbyt app showing the current track on a [SUB/WAVE](https://github.com/perminder-klair/subwave)
internet radio station: album art, track title, artist, the current show internet radio station: album art, track title, artist, the current show
name, and a progress bar for the track, with title/artist scrolling if they and host, and a progress bar for the track pinned to the bottom, with
don't fit. title/artist/show scrolling if they don't fit. Color scheme (cyan
title/artist, gray label, 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 Not tied to any specific station — set your own station's base URL in the
app's config when adding it to a device. app's config when adding it to a device.
@@ -25,8 +27,9 @@ app's config when adding it to a device.
instead of stale track info. instead of stale track info.
- If a track has no `subsonic_id`, or the cover fetch fails, falls back to a - 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. full-width layout with no art rather than a broken image.
- Shows the current show name (`context.activeShow.name`) below the artist, - Shows a "-- Show --" label, the current show name
and a track progress bar at the bottom. (`context.activeShow.name`), and host name (`dj.name`) below the artist,
and a track progress bar pinned to the very bottom.
**Progress bar caveat:** the now-playing API reports track `duration` but **Progress bar caveat:** the now-playing API reports track `duration` but
not elapsed/remaining time, so the app tracks playback position itself — not elapsed/remaining time, so the app tracks playback position itself —
+36 -12
View File
@@ -1,7 +1,7 @@
""" """
Applet: SUB/WAVE Now Playing Applet: SUB/WAVE Now Playing
Summary: Shows what's playing on a SUB/WAVE station Summary: Shows what's playing on a SUB/WAVE station
Description: Configure with your SUB/WAVE (github.com/perminder-klair/subwave) station's base URL to display the current track, artist, show, album art, and a progress bar. Description: Configure with your SUB/WAVE (github.com/perminder-klair/subwave) station's base URL to display the current track, artist, show, host, album art, and a progress bar.
Author: poprhythm Author: poprhythm
""" """
@@ -15,6 +15,14 @@ DEFAULT_STATION_URL = ""
NOWPLAYING_TTL = 20 NOWPLAYING_TTL = 20
COVER_TTL = 300 COVER_TTL = 300
COLOR_TITLE = "#22d3ee" # cyan
COLOR_ARTIST = "#22d3ee" # cyan
COLOR_LABEL = "#888888" # muted gray, for the "-- Show --" label
COLOR_SHOW = "#e0e0e0" # near-white
COLOR_HOST = "#ec4899" # magenta/pink
COLOR_BAR_FILLED = "#c026d3" # magenta/purple
COLOR_BAR_EMPTY = "#333333"
def main(config): def main(config):
station_url = config.get("station_url", DEFAULT_STATION_URL) station_url = config.get("station_url", DEFAULT_STATION_URL)
if station_url: if station_url:
@@ -33,16 +41,31 @@ def main(config):
art = _fetch_cover(station_url, now["subsonic_id"]) art = _fetch_cover(station_url, now["subsonic_id"])
progress = _track_progress(now["subsonic_id"], now["duration"]) progress = _track_progress(now["subsonic_id"], now["duration"])
lines = [ top_lines = [
render.Marquee(width = 32, child = render.Text(now["title"])), render.Marquee(width = 32, child = render.Text(now["title"], color = COLOR_TITLE)),
render.Marquee(width = 32, child = render.Text(now["artist"], color = "#aaaaaa")), render.Marquee(width = 32, child = render.Text(now["artist"], color = COLOR_ARTIST)),
] ]
if now["show"]: if now["show"]:
lines.append(render.Marquee(width = 32, child = render.Text(now["show"], font = "tom-thumb", color = "#666666"))) top_lines.append(render.Text("-- Show --", font = "tom-thumb", color = COLOR_LABEL))
if progress != None: show_host_row = [render.Text(now["show"], font = "tom-thumb", color = COLOR_SHOW)]
lines.append(_progress_bar(progress["fraction"], width = 32)) if now["host"]:
show_host_row.append(render.Text(" " + now["host"], font = "tom-thumb", color = COLOR_HOST))
top_lines.append(render.Marquee(width = 32, child = render.Row(children = show_host_row)))
text_column = render.Column(children = lines) children = [render.Column(children = top_lines)]
if progress != None:
children.append(_progress_bar(progress["fraction"], width = 32))
text_column = render.Box(
width = 32,
height = 32,
child = render.Column(
main_align = "space_between",
cross_align = "start",
expanded = True,
children = children,
),
)
if art: if art:
content = render.Row(children = [render.Image(src = art, width = 32, height = 32), text_column]) content = render.Row(children = [render.Image(src = art, width = 32, height = 32), text_column])
@@ -52,8 +75,8 @@ def main(config):
cross_align = "center", cross_align = "center",
expanded = True, expanded = True,
children = [ children = [
render.Marquee(width = 64, child = render.Text(now["title"])), render.Marquee(width = 64, child = render.Text(now["title"], color = COLOR_TITLE)),
render.Marquee(width = 64, child = render.Text(now["artist"], color = "#aaaaaa")), render.Marquee(width = 64, child = render.Text(now["artist"], color = COLOR_ARTIST)),
], ],
) )
@@ -72,9 +95,9 @@ def _progress_bar(fraction, width = 32, height = 2):
filled = max(0, min(filled, width)) filled = max(0, min(filled, width))
children = [] children = []
if filled > 0: if filled > 0:
children.append(render.Box(width = filled, height = height, color = "#66bb6a")) children.append(render.Box(width = filled, height = height, color = COLOR_BAR_FILLED))
if filled < width: if filled < width:
children.append(render.Box(width = width - filled, height = height, color = "#333333")) children.append(render.Box(width = width - filled, height = height, color = COLOR_BAR_EMPTY))
return render.Row(children = children) return render.Row(children = children)
def _fetch_now_playing(station_url): def _fetch_now_playing(station_url):
@@ -94,6 +117,7 @@ def _fetch_now_playing(station_url):
"duration": np.get("duration", 0), "duration": np.get("duration", 0),
"station": dj.get("station", "SUB/WAVE"), "station": dj.get("station", "SUB/WAVE"),
"show": active_show.get("name", ""), "show": active_show.get("name", ""),
"host": dj.get("name", ""),
"online": bool(data.get("streamOnline", False)), "online": bool(data.get("streamOnline", False)),
} }
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.