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

+36 -12
View File
@@ -1,7 +1,7 @@
"""
Applet: SUB/WAVE Now Playing
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
"""
@@ -15,6 +15,14 @@ DEFAULT_STATION_URL = ""
NOWPLAYING_TTL = 20
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):
station_url = config.get("station_url", DEFAULT_STATION_URL)
if station_url:
@@ -33,16 +41,31 @@ def main(config):
art = _fetch_cover(station_url, now["subsonic_id"])
progress = _track_progress(now["subsonic_id"], now["duration"])
lines = [
render.Marquee(width = 32, child = render.Text(now["title"])),
render.Marquee(width = 32, child = render.Text(now["artist"], color = "#aaaaaa")),
top_lines = [
render.Marquee(width = 32, child = render.Text(now["title"], color = COLOR_TITLE)),
render.Marquee(width = 32, child = render.Text(now["artist"], color = COLOR_ARTIST)),
]
if now["show"]:
lines.append(render.Marquee(width = 32, child = render.Text(now["show"], font = "tom-thumb", color = "#666666")))
if progress != None:
lines.append(_progress_bar(progress["fraction"], width = 32))
top_lines.append(render.Text("-- Show --", font = "tom-thumb", color = COLOR_LABEL))
show_host_row = [render.Text(now["show"], font = "tom-thumb", color = COLOR_SHOW)]
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:
content = render.Row(children = [render.Image(src = art, width = 32, height = 32), text_column])
@@ -52,8 +75,8 @@ def main(config):
cross_align = "center",
expanded = True,
children = [
render.Marquee(width = 64, child = render.Text(now["title"])),
render.Marquee(width = 64, child = render.Text(now["artist"], color = "#aaaaaa")),
render.Marquee(width = 64, child = render.Text(now["title"], color = COLOR_TITLE)),
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))
children = []
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:
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)
def _fetch_now_playing(station_url):
@@ -94,6 +117,7 @@ def _fetch_now_playing(station_url):
"duration": np.get("duration", 0),
"station": dj.get("station", "SUB/WAVE"),
"show": active_show.get("name", ""),
"host": dj.get("name", ""),
"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.