WG/radio/Airtime Customization

From wiki.occupyboston.org
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The Airtime package's main Liquidsoap script is found by default in /usr/lib/airtime/pypo/bin/liquidsoap_bin/ls_script.liq.

We've made some changes to this script to add additional functionality:

(only the relevant bits of code are shown)


#we change this variable to true.
#web_stream_enabled = ref false
web_stream_enabled = ref true

#rather than monitor an http stream, we're going to use liquidsoap's built in functionality for collecting an http stream 
#(it emulates icecast's).  We'll define two streams, one for mono and another for stereo.
#web_stream_source = input.http(id="web_stream", autostart = false, buffer=0.5, max=20., "")
web_stream_source_mono = audio_to_stereo((input.harbor("oblive-mono", port=8001, password="xxx"):source(1,0,0)))
web_stream_source_stereo = input.harbor("oblive-stereo", port=8001, password="xxx")

#once the stream is started, give it a sink so that liquidsoap doesn't
#create buffer overflow warnings in the log file.
output.dummy(fallible=true, web_stream_source_mono)
output.dummy(fallible=true, web_stream_source_stereo)


#the next two blocks add the live streams to the fallback list.  We give priority to the stereo stream, then the mono stream, 
#then whatever happens to be scheduled in airtime.
#We'll use some transitions defined in ls_lib.liq.
s = switch(track_sensitive = false,
    transitions=[to_live,to_live],
    [
      ({ !web_stream_enabled }, web_stream_source_mono),
      ({ true }, s)
    ]
)

s = switch(track_sensitive = false,
    transitions=[to_live,to_live],
    [
      ({ !web_stream_enabled }, web_stream_source_stereo),
      ({ true }, s)
    ]
)

TODO: add a backup playlist at the bottom of the fallback list.