diff --git a/python_apps/pypo/liquidsoap_scripts/ls_lib.liq b/python_apps/pypo/liquidsoap_scripts/ls_lib.liq index d9dc3469d..cdb99facb 100644 --- a/python_apps/pypo/liquidsoap_scripts/ls_lib.liq +++ b/python_apps/pypo/liquidsoap_scripts/ls_lib.liq @@ -1,10 +1,14 @@ def notify(m) - #current_media_id := string_of(m['schedule_table_id']) command = "/usr/lib/airtime/pypo/bin/liquidsoap_scripts/notify.sh --media-id=#{m['schedule_table_id']} &" log(command) system(command) end +def notify_queue(m) + queue_metadata := m + notify(m) +end + def notify_stream(m) json_str = string.replace(pattern="\n",(fun (s) -> ""), json_of(m)) #if a string has a single apostrophe in it, let's comment it out by ending the string before right before it @@ -27,6 +31,10 @@ def append_title(m) = end end +def queue_metadata_callback(m) = + append_title(!queue_metadata) +end + def crossfade_airtime(s) #duration is automatically overwritten by metadata fields passed in #with audio diff --git a/python_apps/pypo/liquidsoap_scripts/ls_script.liq b/python_apps/pypo/liquidsoap_scripts/ls_script.liq index c2b898f3a..15ffeffa1 100644 --- a/python_apps/pypo/liquidsoap_scripts/ls_script.liq +++ b/python_apps/pypo/liquidsoap_scripts/ls_script.liq @@ -24,6 +24,8 @@ default_dj_fade = ref 0. station_name = ref '' show_name = ref '' +queue_metadata = ref [] + s1_connected = ref '' s2_connected = ref '' s3_connected = ref '' @@ -47,7 +49,7 @@ def create_source() # the crossfade function controls fade in/out l = crossfade_airtime(l) - l = on_metadata(notify, l) + l = on_metadata(notify_queue, l) sources := list.append([l], !sources) server.register(namespace="queues", "s#{!source_id}_skip", @@ -70,6 +72,8 @@ create_source() queue = add(!sources, normalize=false) +queue = map_metadata(update=false, queue_metadata_callback, queue) + output.dummy(fallible=true, queue) http = input.http_restart(id="http")