savonet/liquidsoap

Track changes and update remote Playlist

iSerganov opened this issue · 1 comments

I am using liquidsoap 2.2.5 with remote playlist source

I need to reload the playlist from remote source once it is updated.
And unfortunately I cannot achieve the above behavior.

My config is as as follows:

#!/usr/bin/liquidsoap
# Log dir
log.file.path.set("/tmp/basic-radio.log")

# Music
myplaylist = playlist("https://some/remote/path/playlist.pls",reload_mode="watch",mode="normal")
myplaylist.on_track(print)
# If something goes wrong, we'll play this
noiseS = noise()

radio = myplaylist
# And finally the security
radio = fallback(track_sensitive = false, [radio, noiseS])

# Stream it out
output.icecast(%mp3,
  host = "host", port = 9550,
  password = "pass", mount = "/radio.mp3",
  radio)

I expect that every time I update the remote playlist under the above URL from config (e.g., https://some/remote/path/playlist.pls),
it will will be automatically reloaded due to reload_mode="watch" param. However this doesn't happen.

I also tried the following option: myplaylist = playlist("https://some/remote/path/playlist.pls",reload=5,mode="normal").
Which indeed reloads playlist every 5 seconds, but that leads to always playing the first 2(?!) songs in the playlist(no matter how long it is).

Can you please advise what am I doing wrong?
Maybe there is an option to fetch remote playlist every N seconds, compare it with the currently played playlist and reload if any change is detected?

Thank you.

Hi @iSerganov. Remote playlists don't support reload_mode="watch". That's how it is.

You can reload a playlist via telnet: myplaylist.reload or make a harbor function, just paste it after your playlist and then you can reload it via http://locahost:8008/reload_playlist

harbor.http.register.simple(port=8008, "/reload_playlist", fun(_) -> begin myplaylist.reload(); "myplaylist has been reloaded! Awesome!" end)