Replies: 2 comments 3 replies
-
Hi @boyska!
s1 = playlist(id="s1","/music")
s2 = input.http(self_sync=false,"http://192.168.1.1:8000/radio")
def stopInputHttp() =
s2.stop()
end
def startInputHttp() =
s2.start()
end
s = switch(track_sensitive=false, [ ({ 00h00m-00h30m }, s2), ({true}, s1) ])
# on liquidsoap start - stop input.http
thread.run(delay=10.0, fun() -> stopInputHttp())
# start and stop input.http somewhere before the switch activates and after you resume to normal rotation
thread.when(predicate.activates({ 00h00m00s }), fun() -> startInputHttp())
thread.when(predicate.activates({ 00h30m10s }), fun() -> stopInputHttp())
output.dummy(mksafe(s)) Changing urls is also an option with
Finally it can look like this: ...
# remote playlist
s1 = input.http(self_sync=false,"https://other.stream:80/radio.mp3")
def startup_check() =
if ( (0w) and 17h0m-22h0m ) then
null()
else
s1.stop()
end
end
thread.run(delay=10.0, fun() -> startup_check())
thread.when(predicate.activates({ (0w) and 17h0m }), fun() -> s1.start())
thread.when(predicate.activates({ (0w) and 22h0m }), fun() -> s2.stop())
radio = switch(id="schedule_switch", track_sensitive=false, [ ({ (0w) and 17h0m-22h0m }, s1), ({true}, radio) ])
... |
Beta Was this translation helpful? Give feedback.
-
Hey, thanks for that, this sounds really promising! I'll test this ASAP. Ideally, I'd like all of this a bit more encapsulated (ie: I'd like to write something like I'm surprised that this answer wasn't easy to find, as this sounds like a very common thing people might want to do. |
Beta Was this translation helpful? Give feedback.
-
I'm handling part of a radio automation with liquidsoap, and a large part of our setup relies on sth like this:
This works perfectly. However, those HTTP streams are always on. We don't need this to be the case, as it uselessly consume bandwidth.
That's not just about efficiency, though. For some reason, we sometimes need to follow dynamic http links. For example, we could have
http://some.whe.re/localnews
which is actually redirecting (at the HTTP level) to the actual stream we want to relay:In this case, the eager evaluation done by liquidsoap is actually producing bad behavior: the redirect is followed just once. I want this to be followed again every day.
Is there a way I can make sources start and stop based on a time predicate? switch doesn't seem to be doing this, it's just "muting" sources but not stopping them.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions