liquidsoap doesn't reload the playlist file

3.6k views Asked by At

I have a very weird problem with Liquidsoap. I have the following playlist:

myplaylist = playlist(mode="normal",playlist_file,reload_mode="rounds",reload=1)

myplaylist = on_metadata(apply_metadata,myplaylist)

where apply_metadata calls a python script that updates the playlist immediately when called, but sometimes Liquidsoap keeps playing the old playlist after reload, even if the apply_metadata procedure was called.

Thanks in advance for your help.

The whole code of the Liquidsoap script:

# This function is called when
# a new metadata block is passed in
# the stream.
def apply_metadata(m) =
  title = m["filename"]
  artist = m["artist"]
  print("Now playing: #{title} by #{artist}")

  filename = string.split(separator="/",title) # rozdelime cestu po lomitkach
  filename = list.nth(list.rev(filename),0) # vezmeme meno suboru
  filename = list.nth(string.split(separator="\.",filename),0) # odpojime koncovku .mp3

  command = "python3.3 feedback.py " ^ filename
  system(command)

end

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

#tidy up before playing playlist
playlist_file = "playlist.m3u"
system("python3.3 feedback.py -init")


# Music 
myplaylist = playlist(mode="normal",playlist_file,reload_mode="rounds",reload=1)

myplaylist = on_metadata(apply_metadata,myplaylist)

# Stream it out 
output.icecast(%mp3, host = "localhost", port = 8080, password = "baldur", mount = "stream", myplaylist, fallible=true)
2

There are 2 answers

0
Rafael Korbas On BEST ANSWER

I finally found the solution asking in the Liquidsoap's mailing list:

The first though that comes to my mind is that you are perhaps using playlist() in a way this is not intended to be..

Have you though about using request.dynamic? This operator gives you full control over which song is being played next and the next track callback can be written in any language of your choice, which also makes is more convenient..

Good luck!

Romain

0
spacebiker On

You could also use

myplaylist = playlist(mode="normal",playlist_file,reload_mode="watch")

This would reload the playlist as soon as it detects any change.