Display next tracks metadata - ai-radio #4215
Unanswered
WittyWidget
asked this question in
Q&A
Replies: 1 comment
-
Hi! The logic is: You need to set the variable first and then populate it with data. When using Liquidsoap with one playlist it's pretty straightforward. Say you have 1 playlist: What you need to do is to add a # We set up an empty ref
next_song = ref("")
# Next we set up check function that will check playlist for the next song and assign a string with data to `next_song` ref.
def check(r)
if request.resolve(r) then
m = request.metadata(r)
next_song := "Next: #{metadata.artist(m)} - #{metadata.title(m)}"
true
else
false
end
end
# Within our playlist operator we then use the above function. So it will check the next track and log it to the ref.
radio = playlist(check_next=check,"./music/music.m3u")
# other stuff ...
# Then we use that ref to show it on screen
## Display for the next track's metadata
background =
video.add_text(
color=0xFCB900,
font=font,
size=rem(1.5),
x=px(234),
y=px(4800),
{next_song()},
background
) That was for def check(r)
m = request.metadata(r)
next := "Next: #{metadata.artist(m)} - #{metadata.title(m)}"
true
end |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using the ai-radio template from @gAlleb and @toots. I attempted to add the following code, but instead of displaying the upcoming track's metadata, it is showing the variables. I also tried using
next_song,
but it throws an error.next_song,
am trying hard to learn Liquidsoap, and I’m new to this field.
Beta Was this translation helpful? Give feedback.
All reactions