From: Chris E. <chr...@gm...> - 2012-07-31 11:53:40
|
Hi Folks, I put together a quick on_demand function using some posts from previous discussions on this list. But I'm not sure how to get this on_demand stream to stop and shutdown when the single track or playlist is over. As it is written, the request.dynamic source will loop indefinitely and only stop with explicit call to name.stop via the telnet interface. Any tips from other users out there? dyn_out = output.icecast( %ogg(%vorbis(quality=1)), host = "<ip_address>", port = <port>, password = "<passwd>", genre= "Mixed", url= "http://vinylproject.com", fallible=true ) def play_on_demand(sname) s=request.dynamic({request.create("/path/to/myfile.mp3")}) # Dummy stop function f = ref { () } output = dyn_out( mount = (sname ^ ".ogg"), description = "On demand " ^ sname ^ " Liquidsoap Controller", name = sname ^ " Stream [ogg 1.0] - provided by liquidsoap", on_stop = { f = !f; f() }, s ) f := { source.shutdown(output) } "ok!" end server.register( namespace="ondemand", usage="play <stream_name>", description="Play URI on demand. Creates a new icecast mount to play", "play", play_on_demand ) -- Chris Everest |