From 8e283c9e02ba3bf822577eb4722349abc55d7e61 Mon Sep 17 00:00:00 2001 From: james Date: Sun, 13 Nov 2011 15:34:26 -0500 Subject: [PATCH] SAAS-66: Ability to set the stream values from the command line - done - extra fix: Fixed a javascript issue when it always changed bitrate to 48, when type is set to ogg --- .../application/models/StreamSetting.php | 21 +++++++++++++++++++ .../js/airtime/preferences/streamsetting.js | 4 +++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/StreamSetting.php b/airtime_mvc/application/models/StreamSetting.php index 5675de6c2..4486178ae 100644 --- a/airtime_mvc/application/models/StreamSetting.php +++ b/airtime_mvc/application/models/StreamSetting.php @@ -50,6 +50,13 @@ class Application_Model_StreamSetting { return $rows; } + /* + * function that take all the information of stream and sets them. + * This is used by stream setting via UI. + * + * @param $data - array that contains all the data. $data is [][] which + * contains multiple stream information + */ public static function setStreamSetting($data){ global $CC_DBC; foreach($data as $key=>$d){ @@ -76,6 +83,20 @@ class Application_Model_StreamSetting { } } + /* + * Sets indivisual stream setting. + * + * $data - data array. $data is []. + */ + public static function setIndivisualStreamSetting($data){ + global $CC_DBC; + + foreach($data as $keyname => $v){ + $sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$keyname'"; + $CC_DBC->query($sql); + } + } + public static function setLiquidsoapError($stream_id, $msg){ global $CC_DBC; diff --git a/airtime_mvc/public/js/airtime/preferences/streamsetting.js b/airtime_mvc/public/js/airtime/preferences/streamsetting.js index d4198868f..09cc06529 100644 --- a/airtime_mvc/public/js/airtime/preferences/streamsetting.js +++ b/airtime_mvc/public/js/airtime/preferences/streamsetting.js @@ -30,7 +30,9 @@ function rebuildStreamURL(ele){ function restrictOggBitrate(ele, on){ var div = ele.closest("div") if(on){ - div.find("select[id$=data-bitrate]").find("option[value='48']").attr('selected','selected'); + if(parseInt(div.find("select[id$=data-bitrate]").val(),10) < 48){ + div.find("select[id$=data-bitrate]").find("option[value='48']").attr("selected","selected"); + } div.find("select[id$=data-bitrate]").find("option[value='24']").attr("disabled","disabled"); div.find("select[id$=data-bitrate]").find("option[value='32']").attr("disabled","disabled"); }else{