stream: link the now-playing title to its source page
For yt-dlp tracks the locator is the original web page, so pass it as a url annotation, carry it through the stream metadata and history, and turn the track title into a link back to that page (both live and in the history). Subsonic ids are opaque and stay plain text. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
fa1be6df77
commit
c12e522fee
3 changed files with 37 additions and 22 deletions
|
|
@ -127,8 +127,8 @@ radio.on_metadata(
|
|||
now_playing := m
|
||||
# `file` : nom de base du fichier à l'antenne, servant de jeton de
|
||||
# téléchargement (/download?file=…). Vide si la métadonnée manque.
|
||||
entry = {title=m["title"], artist=m["artist"], file=path.basename(m["filename"])}
|
||||
head = list.hd(default={title="", artist="", file=""}, history())
|
||||
entry = {title=m["title"], artist=m["artist"], url=m["url"], file=path.basename(m["filename"])}
|
||||
head = list.hd(default={title="", artist="", url="", file=""}, history())
|
||||
is_dup = head.title == entry.title and head.artist == entry.artist
|
||||
if not is_dup and (entry.title != "" or entry.artist != "") then
|
||||
history := list.prefix(history_max, list.add(entry, history()))
|
||||
|
|
@ -159,7 +159,7 @@ harbor.http.register(
|
|||
port=8000, method="GET", "/nowplaying",
|
||||
fun(_, resp) -> begin
|
||||
m = now_playing()
|
||||
resp.json({title=m["title"], artist=m["artist"]})
|
||||
resp.json({title=m["title"], artist=m["artist"], url=m["url"]})
|
||||
end
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue