Skip to content

Display next tracks metadata - ai-radio #4215

Answered by gAlleb
WittyWidget asked this question in Q&A
Discussion options

You must be logged in to vote

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: radio = playlist("./music.m3u")

What you need to do is to add a check_next function to it so it will fetch and log your next song somewhere. In our case it will assign next song value to a var:

# 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
  f…

Replies: 4 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by WittyWidget
Comment options

You must be logged in to vote
3 replies
@gAlleb
Comment options

@WittyWidget
Comment options

@gAlleb
Comment options

Comment options

You must be logged in to vote
1 reply
@gAlleb
Comment options

Comment options

You must be logged in to vote
1 reply
@gAlleb
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants