Show album and year at 2x, below the artist line
New "album_year" field on the now-playing fetch, formatted as "Album · Year" (either half omitted if absent). 2x only, same reasoning as the show/host split and the time/temp de-marquee -- no spare row for it at 1x's tighter layout. Marquee, not a centered static line like the DJ name/time_temp: album titles can run as long as track titles, so there's no "assumed short enough to just fit" case here the way there was for those. Verified: renders between artist and the separator, no vertical overflow: title/artist/album/separator/show/host/time all fit within the available height with the progress bar still visible below. 1x unaffected (no album line, unchanged layout).
This commit is contained in:
1 parent
97b2546fb0
commit
887dbc7183
1 file changed
+21
@@ -311,9 +311,21 @@ def main(config):
|
||||
[render.Marquee(width = text_width, child = render.Row(children = show_host_row))]
|
||||
)
|
||||
|
||||
# Album/year only at 2x -- there's no spare row for it at 1x's tighter
|
||||
# layout, same reasoning as the show/host split above. Marquee, not a
|
||||
# centered static line like host/time_temp: album titles can run as
|
||||
# long as track titles, so there's no "assumed short" case here to
|
||||
# justify skipping it.
|
||||
album_year_lines = (
|
||||
[render.Marquee(width = text_width, child = render.Text(now["album_year"], font = "tom-thumb", color = colors["meta"]))]
|
||||
if scale == 2 else
|
||||
[]
|
||||
)
|
||||
|
||||
top_lines = [
|
||||
render.Marquee(width = text_width, child = render.Text(now["title"], font = title_font, color = colors["text"])),
|
||||
render.Marquee(width = text_width, child = render.Text(now["artist"], font = "tb-8", color = colors["text"])),
|
||||
] + album_year_lines + [
|
||||
render.Box(width = text_width, height = 1, color = colors["separator"]), # kept at a crisp 1px at every scale, per request, rather than growing to match
|
||||
] + show_lines + [time_temp_line]
|
||||
|
||||
@@ -950,9 +962,18 @@ def _fetch_now_playing(station_url):
|
||||
"show": active_show.get("name", ""),
|
||||
"host": dj.get("name", ""),
|
||||
"time_temp": _format_time_temp(context.get("clock", {}) or {}, context.get("weather", {}) or {}),
|
||||
"album_year": _format_album_year(np.get("album", ""), np.get("year", None)),
|
||||
"online": bool(data.get("streamOnline", False)),
|
||||
}
|
||||
|
||||
def _format_album_year(album, year):
|
||||
parts = []
|
||||
if album:
|
||||
parts.append(album)
|
||||
if year:
|
||||
parts.append(str(int(year)))
|
||||
return " · ".join(parts)
|
||||
|
||||
def _format_time_temp(clock, weather):
|
||||
parts = []
|
||||
display_time = clock.get("display", "")
|
||||
|
||||