From d4a387e113ac209d0c5ad9f909bed9d9a586aea4 Mon Sep 17 00:00:00 2001 From: James Date: Mon, 5 Mar 2012 17:04:13 -0500 Subject: [PATCH] - adding switch to liquidsoap --- .../application/models/StreamSetting.php | 2 - .../pypo/liquidsoap_scripts/ls_script.liq | 51 ++++++++++++++++--- 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/airtime_mvc/application/models/StreamSetting.php b/airtime_mvc/application/models/StreamSetting.php index 283085f41..59a1adc54 100644 --- a/airtime_mvc/application/models/StreamSetting.php +++ b/airtime_mvc/application/models/StreamSetting.php @@ -121,8 +121,6 @@ class Application_Model_StreamSetting { } } - Logging::log(print_r($exits, true)); - if(!isset($exists["master_live_stream_port"])){ $rows[] = (array("keyname" =>"master_live_stream_port", "value"=>self::GetMasterLiveSteamPort(), "type"=>"integer")); } diff --git a/python_apps/pypo/liquidsoap_scripts/ls_script.liq b/python_apps/pypo/liquidsoap_scripts/ls_script.liq index bce4076ff..3774db0b1 100644 --- a/python_apps/pypo/liquidsoap_scripts/ls_script.liq +++ b/python_apps/pypo/liquidsoap_scripts/ls_script.liq @@ -38,6 +38,25 @@ server.register(namespace="streams", "connection_status", fun (s) -> begin "1:#{ default = amplify(0.00001, noise()) default = rewrite_metadata([("artist","Airtime"), ("title", "offline")],default) +master_dj_enabled = ref false; +live_dj_enabled = ref false; + +def make_master_dj_available() + master_dj_enabled := true +end + +def make_master_dj_unavailable() + master_dj_enabled := false +end + +def make_live_dj_available() + live_dj_enabled := true +end + +def make_live_dj_unavailable() + live_dj_enabled := false +end + #live stream setup set("harbor.bind_addr", "0.0.0.0") @@ -68,15 +87,12 @@ def check_dj_client(user,password) = end end -#master_dj = ref default -#dj_live = ref default - def append_master_dj_input(master_harbor_input_port, master_harbor_input_mount_point, s) = if master_harbor_input_port != 0 and master_harbor_input_mount_point != "" then master_dj = input.harbor(master_harbor_input_mount_point, port=master_harbor_input_port, auth=check_master_dj_client, buffer=0.5,max=15.) - ignore(output.dummy(master_dj, fallible=true)) - fallback(track_sensitive=false, [master_dj, s]) + stopable_master_dj = switch(track_sensitive=false, [({!master_dj_enabled},master_dj)]) + fallback(track_sensitive=false, [stopable_master_dj, s]) else s end @@ -85,9 +101,9 @@ end def append_dj_input(dj_harbor_input_port, dj_harbor_input_mount_point, s) = if dj_harbor_input_port != 0 and dj_harbor_input_mount_point != "" then dj_live = input.harbor(dj_harbor_input_mount_point, port=dj_harbor_input_port, auth=check_dj_client, buffer=0.5,max=15.) - ignore(output.dummy(dj_live, fallible=true)) - fallback(track_sensitive=false, [dj_live, s]) + stopable_live_dj = switch(track_sensitive=false, [({!live_dj_enabled},dj_live)]) + fallback(track_sensitive=false, [stopable_live_dj, s]) else s end @@ -119,6 +135,27 @@ s = crossfade(s) add_skip_command(s) +server.register(namespace="streams", + description="Stop Master DJ source.", + usage="master_dj_stop", + "master_dj_stop", + fun (s) -> begin make_master_dj_unavailable() "Done." end) +server.register(namespace="streams", + description="Start Master DJ source.", + usage="master_dj_start", + "master_dj_start", + fun (s) -> begin make_master_dj_available() "Done." end) +server.register(namespace="streams", + description="Stop Live DJ source.", + usage="live_dj_stop", + "live_dj_stop", + fun (s) -> begin make_live_dj_unavailable() "Done." end) +server.register(namespace="streams", + description="Start Live DJ source.", + usage="live_dj_start", + "live_dj_start", + fun (s) -> begin make_live_dj_available() "Done." end) + if output_sound_device then success = ref false