-
With Liquidsoap 1.4.x we are using statements like this:
to queue new songs 90s before the last one ends. We need this to be able to change the next song just before it is needed. Imagine playing a mix track of 1 hour length and a news audio that should be played directly after. It makes no sense to load this news audio file 1 hour before it is played and in this case we can not provide the latest news file. How can we achieve a similar approach with the simplified API in Liquidsoap 2.x.x?
but it directly loads the next song and the new prefetch argument only controls the number of tracks. Thanks for any suggestions! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 10 replies
-
May i chime in with a question: how do you |
Beta Was this translation helpful? Give feedback.
-
Hi! Thanks for reporting. We have simplified the fetching logic with First, I would like to mention that queueing at the last minute can be tricky. Liquidsoap needs time to process and prepare a request and, if this is not done on time, this can lead to a moment when no requests are available, leading to the either the source failing or a transition to another source. That being said, the Eventually, the Here we go: queue_when_this_amount_is_left = 90.
r = request.dynamic.list(...)
def queue(remaining, _) =
log("Queueing with #{remaining} seconds remaining")
if not r.fetch() then
# You might want to recurse and/or handle errors here:
log("Fetching next query failed")
end
end
r = source.on_end(delay=queue_when_this_amount_is_left , r, queue) |
Beta Was this translation helpful? Give feedback.
-
@toots sorry for reviving such an old discussed topic, but I'm facing something similar myself. The way the script that returns the path to a song works, is it publishes the song name upon executing it, so I need to delay the Any help would be appreciated, thanks! set("log.stdout",true)
set("log.level",3)
enable_replaygain_metadata()
queue_when_this_amount_is_left = 10.
def get_request() =
uri = list.hd(default="", process.read.lines("node /home/radio/getSong.js"))
print("Uri: #{uri}")
[request.create(uri)]
end
s = request.dynamic.list(id="s", get_request)
s = amplify(1.,override="replay_gain",s)
def queue(remaining, _) =
log("Queueing with #{remaining} seconds remaining")
end
s = source.on_end(delay=queue_when_this_amount_is_left , s, queue)
output.icecast(%opus(
... This is a partial output of the log
|
Beta Was this translation helpful? Give feedback.
Hi!
Thanks for reporting. We have simplified the fetching logic with
2.0.0
, which should make it easier for the majority of users. However, more advanced cases like this one need a little lifting now.First, I would like to mention that queueing at the last minute can be tricky. Liquidsoap needs time to process and prepare a request and, if this is not done on time, this can lead to a moment when no requests are available, leading to the either the source failing or a transition to another source.
That being said, the
request
operators now have afetch
method that can be called whenever the user wants to queue a new request. If you combine that with aprefetch=0
argument, you should be ab…