Alright, I've been puling my hair out for hours
Liquidsoap just isn't working for me, and I know this should work, sub for one appearently obvious error...
set("log.file",false)
set("log.stdout",true)
set("log.level",3)
podcasts = playlist("/home/user/icecast/ham.txt")
# This function turns a fallible
# source into an infallible source
# by playing a static single when
# the original song is not available
def my_safe(radio) =
# We assume that festival is installed and
# functional in liquidsoap
security = single("say:Hello, we are currently having some technical difficulties but we'll be back soon so stay tuned!")
# We return a fallback where the original
# source has priority over the security
# single. We set track_sensitive to false
# to return immediately to the original source
# when it becomes available again.
fallback(track_sensitive=false,[radio, security])
end
radio= podcasts
radio= my_safe(podcasts)
# A function that contains all the output
# we want to create with the final stream
def outputs(s) =
# First, we partially apply output.icecast
# with common parameters. The resulting function
# is stored in a new definition of output.icecast,
# but this could be my_icecast or anything.
output.icecast = output.icecast(host="localhost", password="foobar")
# An output in mp3 to the "live" mountpoint:
output.icecast(%mp3, mount="live",radio)
end
And the error
At line 23, character 6: The variable radio defined here is not used anywhere
in its scope. Use ignore(...) instead of radio = ... if you meant
to not use it. Otherwise, this may be a typo or a sign that your script
does not do what you intend.
If someone could also fix another issue I'm having
I would like to find how to run two sources to two separate mountpoints
set("log.file",false)
set("log.stdout",true)
set("log.level",3)
podcasts = playlist("/home/user/icecast/ham.txt")
songlist = playlist("/home/user/icecast/otherplaylist.txt")
# This function turns a fallible
# source into an infallible source
# by playing a static single when
# the original song is not available
def my_safe(radio) =
# We assume that festival is installed and
# functional in liquidsoap
security = single("say:Hello, we are currently having some technical difficulties but we'll be back soon so stay tuned!")
# We return a fallback where the original
# source has priority over the security
# single. We set track_sensitive to false
# to return immediately to the original source
# when it becomes available again.
fallback(track_sensitive=false,[radio, security])
end
radio= podcasts
radio= my_safe(podcasts)
def my_safe(songlist) =
# We assume that festival is installed and
# functional in liquidsoap
security = single("say:Hello, we are currently having some technical difficulties but we'll be back soon so stay tuned!")
# We return a fallback where the original
# source has priority over the security
# single. We set track_sensitive to false
# to return immediately to the original source
# when it becomes available again.
fallback(track_sensitive=false,[songlist, security])
end
moarradio= songlist
moarradio= my_safe(songlist)
# A function that contains all the output
# we want to create with the final stream
def outputs(s) =
# First, we partially apply output.icecast
# with common parameters. The resulting function
# is stored in a new definition of output.icecast,
# but this could be my_icecast or anything.
output.icecast = output.icecast(host="localhost", password="foobar")
# An output in mp3 to the "live" mountpoint:
output.icecast(%mp3, mount="live",radio)
output.icecast(%mp3, mount="otherlive",moarmusic)
end
And I get the same error, but it tells me the second variable isn't used (moarradio)
The
liquidsoap
configuration file is basically a script, which means it will be run from top to bottom.Upon reading the configuration file, it is complaining that you are not using the
radio
variable defined line 23, the reason being you are using the one defined line 24. Unlike many other languages, there are no assignments, only definitions in a liquidsoap scriptOther than that, you seem to not understand the difference between global and local variables, and their respective scopes.
You are declaring a
my_safe
function, which takes an argument. Within the scope of the function, refer to your argument with its name. Then call themy_safe
function with your global variables as the argument, and what you are expecting will actually happen.Your sources will not get registered if you do not call the
outputs
function. Simply drop the function construct.Here is how I rewrote your second example: