CC-3406: Live Stream: Switch off live sources on disconnection

- done
This commit is contained in:
James 2012-03-09 12:27:04 -05:00
parent f193047a1c
commit efee025691
3 changed files with 19 additions and 10 deletions

View File

@ -871,6 +871,12 @@ class ApiController extends Zend_Controller_Action
$sourcename = $request->getParam('sourcename');
$status = $request->getParam('status');
// on source disconnection sent msg to pypo to turn off the switch
if($status == "false"){
$data = array("sourcename"=>$sourcename, "status"=>"off");
Application_Model_RabbitMq::SendMessageToPypo("switch_source", $data);
Application_Model_Preference::SetSourceSwitchStatus($sourcename, "off");
}
Application_Model_Preference::SetSourceStatus($sourcename, $status);
}
@ -1006,19 +1012,14 @@ class ApiController extends Zend_Controller_Action
exit;
}
Logging::log("user:".$username." pass:".$password." type:".$djtype);
if($djtype == 'master'){
//check against master
if($username == Application_Model_Preference::GetLiveSteamMasterUsername() && $password == Application_Model_Preference::GetLiveSteamMasterPassword()){
Logging::log("master true");
$this->view->msg = true;
}else{
Logging::log("master false");
$this->view->msg = false;
}
}elseif($djtype == "dj"){
Logging::log("djtype...");
//check against show dj auth
$showInfo = Application_Model_Show::GetCurrentShow();
if(isset($showInfo[0]['id'])){
@ -1028,9 +1029,6 @@ class ApiController extends Zend_Controller_Action
// get custom pass info from the show
$custom_user = $CcShow->getDbLiveStreamUser();
$custom_pass = $CcShow->getDbLiveStreamPass();
Logging::log("user:".$username." pass:".$password);
Logging::log("c_user:".$custom_user." c_pass:".$custom_pass);
// get hosts ids
$show = new Application_Model_Show($current_show_id);
@ -1047,10 +1045,8 @@ class ApiController extends Zend_Controller_Action
// check against custom auth
if($username == $custom_user && $password == $custom_pass){
Logging::log("custom true");
$this->view->msg = true;
}else{
Logging::log("custom false");
$this->view->msg = false;
}
}else{

View File

@ -323,14 +323,21 @@ class ScheduleController extends Zend_Controller_Action
Application_Model_Show::ConvertToLocalTimeZone($range["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
$source_status = array();
$switch_status = array();
$live_dj = Application_Model_Preference::GetSourceStatus("live_dj");
$master_dj = Application_Model_Preference::GetSourceStatus("master_dj");
$live_dj_switch = Application_Model_Preference::GetSourceSwitchStatus("live_dj");
$master_dj_switch = Application_Model_Preference::GetSourceSwitchStatus("master_dj");
//might not be the correct place to implement this but for now let's just do it here
$source_status['live_dj_source'] = $live_dj;
$source_status['master_dj_source'] = $master_dj;
$this->view->source_status = $source_status;
$switch_status['live_dj_source'] = $live_dj_switch;
$switch_status['master_dj_source'] = $master_dj_switch;
$this->view->switch_status = $switch_status;
$this->view->entries = $range;
}

View File

@ -237,10 +237,16 @@ function parseSourceStatus(obj){
}
}
function parseSwitchStatus(obj){
$("#live_dj.source-switch-button").find("span").html(obj.live_dj_source)
$("#master_dj.source-switch-button").find("span").html(obj.master_dj_source)
}
function getScheduleFromServer(){
$.ajax({ url: "/Schedule/get-current-playlist/format/json", dataType:"json", success:function(data){
parseItems(data.entries);
parseSourceStatus(data.source_status);
parseSwitchStatus(data.switch_status);
}, error:function(jqXHR, textStatus, errorThrown){}});
setTimeout(getScheduleFromServer, serverUpdateInterval);
}