You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am writing a script that will go ask a server for the next song to play.
It works fine, as long as the http server is up and running when I start up liquid soap. If the server is not up, or crashes, there doesn't seem to be a way to tell Liquidsoap to quit trying to load the playlist. I put a little timer on the back for testing, and even after I issue the source.shutdown, the log still shows that Liquidsoap is trying to ask the server for a file.
Can somebody tell me what I'm doing wrong? Or how I can start and stop Liquidsoap polling the server for the file?
I am running 1.0.1 on a Raspberry Pi if that makes a difference.
Thanks.
#!/usr/bin/liquidsoap
#
#Put the log file in some directory where
#you have permission to write.
#set("log.file.path","./liquidtesting.log")
set("log.file",false)
#Print log messages to the console,
set("log.stdout", true)
#Use the telnet server for requests while testing
set("server.telnet", true)
#We have a dummy/blank source/output to keep things running
blanksource = blank(id='blanksource')
output.dummy(fallible=false, blanksource);
#A few functions/stuff we need to control the player
#we need a boolean reference to set (true|false), initially false
player_on = ref false
thelist = ref playlist("")
def turn_player_on()
#Only turn it on if it is currently off
log("Turning player on")
if !player_on == false then
#set the flag it is on
player_on := true
#create the playlist and then output it to the speakers.
pl=playlist(id="url_list", mode="normal", reload=1, reload_mode="rounds","http://localhost:3000/getNextSongFileName")
thelist := pl
#radio=fallback(id="the_radio",track_sensitive=false,
# [pl,blanksource])
myout = output.alsa(id='localAudio', device="hw: Set",pl)
end
end
#A function to create 'thelist' playlist when we have node all up and ready
def turn_player_off()
#Only turn it off if it is already on
log ("Turning Player off")
if !player_on == true then
#set the flag it is off
player_on := false
#Shutdown the node source
source.shutdown(!thelist)
log (source.id(!thelist))
else
shutdown()
end
#add_timeout expects a function that will return a float
0.5
end
turn_player_on()
add_timeout(0.5,turn_player_off)
The text was updated successfully, but these errors were encountered:
I am writing a script that will go ask a server for the next song to play.
It works fine, as long as the http server is up and running when I start up liquid soap. If the server is not up, or crashes, there doesn't seem to be a way to tell Liquidsoap to quit trying to load the playlist. I put a little timer on the back for testing, and even after I issue the source.shutdown, the log still shows that Liquidsoap is trying to ask the server for a file.
Can somebody tell me what I'm doing wrong? Or how I can start and stop Liquidsoap polling the server for the file?
I am running 1.0.1 on a Raspberry Pi if that makes a difference.
Thanks.
The text was updated successfully, but these errors were encountered: