我对Liquidsoap有一个非常奇怪的问题。我有以下播放列表:
myplaylist = playlist(mode="normal",playlist_file,reload_mode="rounds",reload=1)
myplaylist = on_metadata(apply_metadata,myplaylist)
其中apply_metadata调用python脚本,该脚本在调用时立即更新播放列表,但有时Liquidsoap会在重新加载后继续播放旧的播放列表,即使调用了apply_metadata过程也是如此。
提前感谢您的帮助。
Liquidsoap脚本的整个代码:
# 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)
答案 0 :(得分:5)
我终于找到了the solution asking in the Liquidsoap's mailing list:
第一个虽然我想到的是你可能正在以某种方式使用播放列表()这不是...
你有关于使用requestdynamic的问题吗?此操作符可让您完全控制下一首正在播放的歌曲,并且可以使用您选择的任何语言编写下一首曲目回调,这样也更方便..
祝你好运!罗曼
答案 1 :(得分:1)
您也可以使用
myplaylist = playlist(mode="normal",playlist_file,reload_mode="watch")
一旦检测到任何更改,就会重新加载播放列表。