From f7fb6ddff0eb56739c42ea352a80eed09785fa8d Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Fri, 11 Nov 2011 22:24:37 -0500 Subject: [PATCH 1/5] -better naming of show instance functions --- .../application/controllers/ApiController.php | 2 +- .../controllers/ScheduleController.php | 16 ++++----- airtime_mvc/application/models/Dashboard.php | 24 ++++++------- airtime_mvc/application/models/Nowplaying.php | 4 +-- .../application/models/ShowInstance.php | 34 +++++++++---------- 5 files changed, 40 insertions(+), 40 deletions(-) diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 2fb9173b5..c6d845b5b 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -415,7 +415,7 @@ class ApiController extends Zend_Controller_Action $show_inst->setRecordedFile($file_id); $show_name = $show_inst->getName(); $show_genre = $show_inst->getGenre(); - $show_start_time = ConvertToLocalDateTimeString($show_inst->getShowStart()); + $show_start_time = ConvertToLocalDateTimeString($show_inst->getShowInstanceStart()); } catch (Exception $e){ //we've reached here probably because the show was diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index 194fc0df0..05255ea5a 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -182,8 +182,8 @@ class ScheduleController extends Zend_Controller_Action $params = '/format/json/id/#id#'; - $showStartDateHelper = Application_Model_DateHelper::ConvertToLocalDateTime($show->getShowStart()); - $showEndDateHelper = Application_Model_DateHelper::ConvertToLocalDateTime($show->getShowEnd()); + $showStartDateHelper = Application_Model_DateHelper::ConvertToLocalDateTime($show->getShowInstanceStart()); + $showEndDateHelper = Application_Model_DateHelper::ConvertToLocalDateTime($show->getShowInstanceEnd()); $menu = array(); @@ -356,8 +356,8 @@ class ScheduleController extends Zend_Controller_Action return false; } - $start_timestamp = $show->getShowStart(); - $end_timestamp = $show->getShowEnd(); + $start_timestamp = $show->getShowInstanceStart(); + $end_timestamp = $show->getShowInstanceEnd(); //check to make sure show doesn't overlap. if(Application_Model_Show::getShows(new DateTime($start_timestamp, new DateTimeZone("UTC")), @@ -409,7 +409,7 @@ class ScheduleController extends Zend_Controller_Action return false; } $originalShowName = $originalShow->getName(); - $originalShowStart = $originalShow->getShowStart(); + $originalShowStart = $originalShow->getShowInstanceStart(); $timestamp = strtotime($originalShowStart); $this->view->additionalShowInfo = @@ -466,8 +466,8 @@ class ScheduleController extends Zend_Controller_Action 'add_show_genre' => $show->getGenre(), 'add_show_description' => $show->getDescription())); - $startsDateTime = new DateTime($showInstance->getShowStart(), new DateTimeZone("UTC")); - $endsDateTime = new DateTime($showInstance->getShowEnd(), new DateTimeZone("UTC")); + $startsDateTime = new DateTime($showInstance->getShowInstanceStart(), new DateTimeZone("UTC")); + $endsDateTime = new DateTime($showInstance->getShowInstanceEnd(), new DateTimeZone("UTC")); $startsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get())); $endsDateTime->setTimezone(new DateTimeZone(date_default_timezone_get())); @@ -761,7 +761,7 @@ class ScheduleController extends Zend_Controller_Action } $show = new Application_Model_Show($showInstance->getShowId()); - $show->cancelShow($showInstance->getShowStart()); + $show->cancelShow($showInstance->getShowInstanceStart()); } } diff --git a/airtime_mvc/application/models/Dashboard.php b/airtime_mvc/application/models/Dashboard.php index fedadda44..9236ab2c6 100644 --- a/airtime_mvc/application/models/Dashboard.php +++ b/airtime_mvc/application/models/Dashboard.php @@ -26,21 +26,21 @@ class Application_Model_Dashboard if ($showInstance->isRecorded()){ //last item is a show instance return array("name"=>$showInstance->getName(), - "starts"=>$showInstance->getShowStart(), - "ends"=>$showInstance->getShowEnd()); + "starts"=>$showInstance->getShowInstanceStart(), + "ends"=>$showInstance->getShowInstanceEnd()); } else { return null; } } else { //return the one that started later. - if ($row[0]["starts"] >= $showInstance->getShowStart()){ + if ($row[0]["starts"] >= $showInstance->getShowInstanceStart()){ return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"], "starts"=>$row[0]["starts"], "ends"=>$row[0]["ends"]); } else { return array("name"=>$showInstance->getName(), - "starts"=>$showInstance->getShowStart(), - "ends"=>$showInstance->getShowEnd()); + "starts"=>$showInstance->getShowInstanceStart(), + "ends"=>$showInstance->getShowInstanceEnd()); } } } @@ -75,8 +75,8 @@ class Application_Model_Dashboard //last item is a show instance if ($showInstance->isRecorded()){ return array("name"=>$showInstance->getName(), - "starts"=>$showInstance->getShowStart(), - "ends"=>$showInstance->getShowEnd(), + "starts"=>$showInstance->getShowInstanceStart(), + "ends"=>$showInstance->getShowInstanceEnd(), "media_item_played"=>false, "record"=>true); } else { @@ -114,22 +114,22 @@ class Application_Model_Dashboard if ($showInstance->isRecorded()){ //last item is a show instance return array("name"=>$showInstance->getName(), - "starts"=>$showInstance->getShowStart(), - "ends"=>$showInstance->getShowEnd()); + "starts"=>$showInstance->getShowInstanceStart(), + "ends"=>$showInstance->getShowInstanceEnd()); } else { return null; } } else { //return the one that starts sooner. - if ($row[0]["starts"] <= $showInstance->getShowStart()){ + if ($row[0]["starts"] <= $showInstance->getShowInstanceStart()){ return array("name"=>$row[0]["artist_name"]." - ".$row[0]["track_title"], "starts"=>$row[0]["starts"], "ends"=>$row[0]["ends"]); } else { return array("name"=>$showInstance->getName(), - "starts"=>$showInstance->getShowStart(), - "ends"=>$showInstance->getShowEnd()); + "starts"=>$showInstance->getShowInstanceStart(), + "ends"=>$showInstance->getShowInstanceEnd()); } } } diff --git a/airtime_mvc/application/models/Nowplaying.php b/airtime_mvc/application/models/Nowplaying.php index 17c531fec..50aafd72b 100644 --- a/airtime_mvc/application/models/Nowplaying.php +++ b/airtime_mvc/application/models/Nowplaying.php @@ -81,8 +81,8 @@ class Application_Model_Nowplaying $showId = $si->getShowId(); $show = new Application_Model_Show($showId); - $showStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowStart()); - $showEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowEnd()); + $showStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowInstanceStart()); + $showEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowInstanceEnd()); //append show header row $data[] = self::CreateHeaderRow($show->getName(), $showStartDateTime->format("Y-m-d H:i:s"), $showEndDateTime->format("Y-m-d H:i:s")); diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php index e26532a93..7d1f81d1b 100644 --- a/airtime_mvc/application/models/ShowInstance.php +++ b/airtime_mvc/application/models/ShowInstance.php @@ -56,7 +56,7 @@ class Application_Model_ShowInstance { * @return string in format "Y-m-d H:i:s" (PHP time notation) * TODO: make this function return a DateTime object instead. */ - public function getShowStart() + public function getShowInstanceStart() { return $this->_showInstance->getDbStarts(); } @@ -66,21 +66,21 @@ class Application_Model_ShowInstance { * @return string in format "Y-m-d H:i:s" (PHP time notation) * TODO: make this function return a DateTime object instead. */ - public function getShowEnd() + public function getShowInstanceEnd() { return $this->_showInstance->getDbEnds(); } public function getStartDate() { - $showStart = $this->getShowStart(); + $showStart = $this->getShowInstanceStart(); $showStartExplode = explode(" ", $showStart); return $showStartExplode[0]; } public function getStartTime() { - $showStart = $this->getShowStart(); + $showStart = $this->getShowInstanceStart(); $showStartExplode = explode(" ", $showStart); return $showStartExplode[1]; @@ -150,7 +150,7 @@ class Application_Model_ShowInstance { if (!is_null($scheduleStarts)){ $scheduleStartsEpoch = strtotime($scheduleStarts); - $showStartsEpoch = strtotime($this->getShowStart()); + $showStartsEpoch = strtotime($this->getShowInstanceStart()); $diff = $showStartsEpoch - $scheduleStartsEpoch; @@ -183,8 +183,8 @@ class Application_Model_ShowInstance { $mins = abs($deltaMin%60); $today_timestamp = time(); - $starts = $this->getShowStart(); - $ends = $this->getShowEnd(); + $starts = $this->getShowInstanceStart(); + $ends = $this->getShowInstanceEnd(); $startsDateTime = new DateTime($starts, new DateTimeZone("UTC")); @@ -247,8 +247,8 @@ class Application_Model_ShowInstance { $mins = abs($deltaMin%60); $today_timestamp = date("Y-m-d H:i:s"); - $starts = $this->getShowStart(); - $ends = $this->getShowEnd(); + $starts = $this->getShowInstanceStart(); + $ends = $this->getShowInstanceEnd(); if(strtotime($today_timestamp) > strtotime($starts)) { return "can't resize a past show"; @@ -303,7 +303,7 @@ class Application_Model_ShowInstance { $lastGroupId = $this->getLastGroupId(); if (is_null($lastGroupId)) { - $groupId = $sched->add($this->_instanceId, $this->getShowStart(), null, $plId); + $groupId = $sched->add($this->_instanceId, $this->getShowInstanceStart(), null, $plId); } else { $groupId = $sched->addPlaylistAfter($this->_instanceId, $lastGroupId, $plId); @@ -323,7 +323,7 @@ class Application_Model_ShowInstance { $lastGroupId = $this->getLastGroupId(); if (is_null($lastGroupId)) { - $groupId = $sched->add($this->_instanceId, $this->getShowStart(), $file_id); + $groupId = $sched->add($this->_instanceId, $this->getShowInstanceStart(), $file_id); } else { $groupId = $sched->addFileAfter($this->_instanceId, $lastGroupId, $file_id); @@ -440,8 +440,8 @@ class Application_Model_ShowInstance { public function getPercentScheduled() { - $start_timestamp = $this->getShowStart(); - $end_timestamp = $this->getShowEnd(); + $start_timestamp = $this->getShowInstanceStart(); + $end_timestamp = $this->getShowInstanceEnd(); $time_filled = $this->getTimeScheduled(); $s_epoch = strtotime($start_timestamp); @@ -460,8 +460,8 @@ class Application_Model_ShowInstance { { global $CC_DBC; - $start_timestamp = $this->getShowStart(); - $end_timestamp = $this->getShowEnd(); + $start_timestamp = $this->getShowInstanceStart(); + $end_timestamp = $this->getShowInstanceEnd(); $sql = "SELECT TIMESTAMP '{$end_timestamp}' - TIMESTAMP '{$start_timestamp}' "; $length = $CC_DBC->GetOne($sql); @@ -596,11 +596,11 @@ class Application_Model_ShowInstance { } public function getShowEndGapTime(){ - $showEnd = $this->getShowEnd(); + $showEnd = $this->getShowInstanceEnd(); $lastItemEnd = $this->getLastAudioItemEnd(); if (is_null($lastItemEnd)){ - $lastItemEnd = $this->getShowStart(); + $lastItemEnd = $this->getShowInstanceStart(); } From 1a45a38055b5eaf7ce39d06f3477d08757d0188a Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Fri, 11 Nov 2011 22:55:46 -0500 Subject: [PATCH 2/5] -add function comments to Show.php --- airtime_mvc/application/models/Show.php | 50 +++++++++++++++++-------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index a3413b854..dc72674eb 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -134,12 +134,17 @@ class Application_Model_Show { } /** - * Remove Show Instances that occur on days of the week specified + * This function is called when a repeating show is edited and the + * days that is repeats on have changed. More specifically, a day + * that the show originally repeated on has been "unchecked". + * + * Removes Show Instances that occur on days of the week specified * by input array. For example, if array contains one value of "0", - * then all show instances that occur on Sunday are removed. + * (0 = Sunday, 1=Monday) then all show instances that occur on + * Sunday are removed. * * @param array p_uncheckedDays - * An array specifying which days + * An array specifying which days should be removed. */ public function removeUncheckedDaysInstances($p_uncheckedDays) { @@ -307,8 +312,13 @@ class Application_Model_Show { /** * Deletes all future instances of the current show object - * from the show_instances table. - * + * from the show_instances table. This function is used when + * a show is being edited - in some cases, when a show is edited + * we just destroy all future show instances, and let another function + * regenerate them later on. Note that this isn't always the most + * desirable thing to do. Deleting a show instance and regenerating + * it cause any scheduled playlists within those show instances to + * be gone for good. */ public function deleteAllInstances(){ global $CC_DBC; @@ -327,7 +337,6 @@ class Application_Model_Show { /** * Deletes all future rebroadcast instances of the current * show object from the show_instances table. - * */ public function deleteAllRebroadcasts(){ global $CC_DBC; @@ -346,7 +355,9 @@ class Application_Model_Show { /** * Deletes all show instances of current show after a - * certain date. + * certain date. Note that although not enforced, $p_date + * should never be in the past, as we never want to allow + * deletion of shows that have already occured. * * @param string $p_date * The date which to delete after, if null deletes from the current timestamp. @@ -370,17 +381,16 @@ class Application_Model_Show { $CC_DBC->query($sql); - /* - CcShowInstancesQuery::create() - ->filterByDbShowId($showId) - ->filterByDbStartTime($p_date, Criteria::GREATER_EQUAL) - ->delete(); - */ } /** * Deletes all show instances of current show before a - * certain date. + * certain date. + * + * This function is used in the case where a repeating show is being + * edited and the start date of the first show has been changed more + * into the future. In this case, delete any show instances that + * exist before the new start date. * * @param string $p_date * The date which to delete before @@ -494,14 +504,15 @@ class Application_Model_Show { public function isStartDateTimeInPast(){ $date = new Application_Model_DateHelper; $current_timestamp = $date->getTimestamp(); - return ($current_timestamp > $this->getStartDate()." ".$this->getStartTime()); + return ($current_timestamp > ($this->getStartDate()." ".$this->getStartTime())); } /** * Get the ID's of future instance of the current show. * * @return array - * A simple array containing all future instance ID's + * A simple array containing all ID's of show instance + * scheduled in the future. */ public function getAllFutureInstanceIds(){ global $CC_DBC; @@ -523,6 +534,13 @@ class Application_Model_Show { return $instance_ids; } + /* Called when a show's duration is changed (edited). + * + * @param array $p_data + * array containing the POST data about the show from the + * browser. + * + */ private function updateDurationTime($p_data){ //need to update cc_show_instances, cc_show_days From 20fc49b7bee997aadb90ab2d58ff680b43a24a84 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Sat, 12 Nov 2011 00:04:37 -0500 Subject: [PATCH 3/5] CC-3027: Current Show progress bar is wrong -looks like it's working. --- airtime_mvc/application/models/Schedule.php | 2 +- airtime_mvc/application/models/Show.php | 6 +++--- airtime_mvc/public/js/airtime/dashboard/playlist.js | 10 ++++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index d5db0c091..3fb7df805 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -144,7 +144,7 @@ class Application_Model_Schedule { global $CC_CONFIG; $date = new Application_Model_DateHelper; - $timeNow = $date->getUtcTimestamp(); + $timeNow = $date->getTimestamp(); return array("env"=>APPLICATION_ENV, "schedulerTime"=>$timeNow, "previous"=>Application_Model_Dashboard::GetPreviousItem($timeNow), diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index dc72674eb..38c911bb0 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -1383,7 +1383,7 @@ class Application_Model_Show { // Convert back to local timezone $rows = $CC_DBC->GetAll($sql); - Application_Model_Show::ConvertToLocalTimeZone($rows, array("start_timestamp", "end_timestamp")); + Application_Model_Show::ConvertToLocalTimeZone($rows, array("starts", "ends", "start_timestamp", "end_timestamp")); return $rows; } @@ -1424,7 +1424,7 @@ class Application_Model_Show { // Convert timestamps to local timezone $rows = $CC_DBC->GetAll($sql); - Application_Model_Show::ConvertToLocalTimeZone($rows, array("start_timestamp", "end_timestamp")); + Application_Model_Show::ConvertToLocalTimeZone($rows, array("starts", "ends", "start_timestamp", "end_timestamp")); return $rows; } @@ -1478,7 +1478,7 @@ class Application_Model_Show { */ public static function ConvertToLocalTimeZone(&$rows, $columnsToConvert) { $timezone = date_default_timezone_get(); - + foreach($rows as &$row) { foreach($columnsToConvert as $column) { $row[$column] = Application_Model_DateHelper::ConvertToLocalDateTimeString($row[$column]); diff --git a/airtime_mvc/public/js/airtime/dashboard/playlist.js b/airtime_mvc/public/js/airtime/dashboard/playlist.js index d58b8b9f7..070ac4686 100644 --- a/airtime_mvc/public/js/airtime/dashboard/playlist.js +++ b/airtime_mvc/public/js/airtime/dashboard/playlist.js @@ -13,7 +13,7 @@ var currentElem; var serverUpdateInterval = 5000; var uiUpdateInterval = 200; -var timezoneOffset = 0; +//var timezoneOffset = 0; //set to "development" if we are developing :). Useful to disable alerts //when entering production mode. @@ -167,11 +167,13 @@ function updatePlaybar(){ $('#show-length').empty(); if (currentShow.length > 0){ - $('#show-length').text(convertDateToHHMM(currentShow[0].showStartPosixTime + timezoneOffset) + " - " + convertDateToHHMM(currentShow[0].showEndPosixTime + timezoneOffset)); + //$('#show-length').text(convertDateToHHMM(currentShow[0].showStartPosixTime + timezoneOffset) + " - " + convertDateToHHMM(currentShow[0].showEndPosixTime + timezoneOffset)); + $('#show-length').text(convertDateToHHMM(currentShow[0].showStartPosixTime) + " - " + convertDateToHHMM(currentShow[0].showEndPosixTime)); } /* Column 2 update */ - $('#time').text(convertDateToHHMMSS(estimatedSchedulePosixTime + timezoneOffset)); + //$('#time').text(convertDateToHHMMSS(estimatedSchedulePosixTime + timezoneOffset)); + $('#time').text(convertDateToHHMMSS(estimatedSchedulePosixTime)); } function calcAdditionalData(currentItem){ @@ -211,7 +213,7 @@ function parseItems(obj){ calcAdditionalShowData(obj.nextShow); var schedulePosixTime = convertDateToPosixTime(obj.schedulerTime); - timezoneOffset = parseInt(obj.timezoneOffset)*1000; + //timezoneOffset = parseInt(obj.timezoneOffset)*1000; var date = new Date(); localRemoteTimeOffset = date.getTime() - schedulePosixTime; } From 68f142470abb974ef261f0bb58a8aaad472c889f Mon Sep 17 00:00:00 2001 From: james Date: Sun, 13 Nov 2011 13:58:47 -0500 Subject: [PATCH 4/5] SAAS-67: "Hardware Audio Out" shows when SaaS is enabled - "Hardware Audio Out" is not visible when plan-level is not diabled --- .../application/controllers/PreferenceController.php | 6 ++++-- .../views/scripts/preference/stream-setting.phtml | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index 414f3dae2..6a8237ccf 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -160,8 +160,10 @@ class PreferenceController extends Zend_Controller_Action $num_of_stream = intval(Application_Model_Preference::GetNumOfStreams()); $form = new Application_Form_StreamSetting(); - $form->setSetting($setting); - $form->startFrom(); + if(Application_Model_Preference::GetPlanLevel() == 'disabled'){ + $form->setSetting($setting); + $form->startFrom(); + } for($i=1; $i<=$num_of_stream; $i++){ $subform = new Application_Form_StreamSettingSubForm(); $subform->setPrefix($i); diff --git a/airtime_mvc/application/views/scripts/preference/stream-setting.phtml b/airtime_mvc/application/views/scripts/preference/stream-setting.phtml index b86bbc855..d250be0cd 100644 --- a/airtime_mvc/application/views/scripts/preference/stream-setting.phtml +++ b/airtime_mvc/application/views/scripts/preference/stream-setting.phtml @@ -8,6 +8,7 @@
statusMsg;?> +form->getElement('output_sound_device') != null){?>
Hardware Audio Out
@@ -21,6 +22,7 @@
+ num_stream;$i++){ echo $this->form->getSubform("s".$i."_subform"); From 8e283c9e02ba3bf822577eb4722349abc55d7e61 Mon Sep 17 00:00:00 2001 From: james Date: Sun, 13 Nov 2011 15:34:26 -0500 Subject: [PATCH 5/5] 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{