CC-3224: "On-the-fly" stream rebroadcasting

- frond-end implementation for master dj and live dj
- db implementation
- liquidsoap is broken on this commit
This commit is contained in:
James 2012-03-02 16:55:11 -05:00
parent 96c4462adc
commit 128a497059
16 changed files with 304 additions and 99 deletions

View file

@ -807,8 +807,6 @@ class ApiController extends Zend_Controller_Action
}
$info = Application_Model_StreamSetting::getStreamSetting();
$info[] = (array("keyname" =>"harbor_input_port", "value"=>Application_Model_Preference::GetLiveSteamPort(), "type"=>"integer"));
$info[] = (array("keyname" =>"harbor_input_mount_point", "value"=>Application_Model_Preference::GetLiveSteamMountPoint(), "type"=>"string"));
$this->view->msg = $info;
}
@ -988,6 +986,7 @@ class ApiController extends Zend_Controller_Action
$username = $request->getParam('username');
$password = $request->getParam('password');
$djtype = $request->getParam('djtype');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
{
@ -995,11 +994,57 @@ class ApiController extends Zend_Controller_Action
print 'You are not allowed to access this resource.';
exit;
}
//check against master
if($username == Application_Model_Preference::GetLiveSteamMasterUsername() && $password == Application_Model_Preference::GetLiveSteamMasterPassword()){
$this->view->msg = true;
}else{
$this->view->msg = false;
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'])){
$current_show_id = $showInfo[0]['id'];
$CcShow = CcShowQuery::create()->findPK($current_show_id);
// 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);
$hosts_ids = $show->getHostsIds();
// check against hosts auth
foreach( $hosts_ids as $host){
$h = new Application_Model_User($host['subjs_id']);
if($username == $h->getLogin() && md5($password) == $h->getPassword()){
$this->view->msg = true;
return;
}
}
// 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{
$this->view->msg = false;
}
}
}
}

View file

@ -205,23 +205,29 @@ class PreferenceController extends Zend_Controller_Action
$values['streamFormat'] = $form->getValue('streamFormat');
Application_Model_StreamSetting::setStreamSetting($values);
$data = array();
$info = Application_Model_StreamSetting::getStreamSetting();
$info[] = (array("keyname" =>"harbor_input_port", "value"=>$values["harbor_input_port"], "type"=>"integer"));
$info[] = (array("keyname" =>"harbor_input_mount_point", "value"=>$values["harbor_input_mount_point"], "type"=>"string"));
$data['setting'] = $info;
for($i=1;$i<=$num_of_stream;$i++){
Application_Model_StreamSetting::setLiquidsoapError($i, "waiting");
}
// this goes into cc_pref table
Application_Model_Preference::SetStreamLabelFormat($values['streamFormat']);
Application_Model_Preference::SetLiveSteamAutoEnable($values["auto_enable_live_stream"]);
Application_Model_Preference::SetLiveSteamMasterUsername($values["master_username"]);
Application_Model_Preference::SetLiveSteamMasterPassword($values["master_password"]);
Application_Model_Preference::SetLiveSteamPort($values["harbor_input_port"]);
Application_Model_Preference::SetLiveSteamMountPoint($values["harbor_input_mount_point"]);
// extra info that goes into cc_stream_setting
Application_Model_StreamSetting::SetMasterLiveSteamPort($values["master_harbor_input_port"]);
Application_Model_StreamSetting::SetMasterLiveSteamMountPoint($values["master_harbor_input_mount_point"]);
Application_Model_StreamSetting::SetDJLiveSteamPort($values["dj_harbor_input_port"]);
Application_Model_StreamSetting::SetDJLiveSteamMountPoint($values["dj_harbor_input_mount_point"]);
// store stream update timestamp
Application_Model_Preference::SetStreamUpdateTimestamp();
$data = array();
$info = Application_Model_StreamSetting::getStreamSetting();
$data['setting'] = $info;
for($i=1;$i<=$num_of_stream;$i++){
Application_Model_StreamSetting::setLiquidsoapError($i, "waiting");
}
Application_Model_RabbitMq::SendMessageToPypo("update_stream_setting", $data);
$this->view->statusMsg = "<div class='success'>Stream Setting Updated.</div>";
}