Merge remote-tracking branch 'origin/saas-stream-settings' into saas-dev
This commit is contained in:
commit
e49d337db0
14 changed files with 240 additions and 170 deletions
|
@ -171,8 +171,7 @@ class LocaleController extends Zend_Controller_Action
|
|||
"Check this box to automatically switch on Master/Show source upon source connection." => _("Check this box to automatically switch on Master/Show source upon source connection."),
|
||||
"If your Icecast server expects a username of 'source', this field can be left blank." => _("If your Icecast server expects a username of 'source', this field can be left blank."),
|
||||
"If your live streaming client does not ask for a username, this field should be 'source'." => _("If your live streaming client does not ask for a username, this field should be 'source'."),
|
||||
"If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings). If Airtime is recording, and if the change causes a playout engine restart, the recording will be interrupted."
|
||||
=> _("If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings). If Airtime is recording, and if the change causes a playout engine restart, the recording will be interrupted."),
|
||||
"WARNING: This will restart your stream and may cause a short dropout for your listeners!" => _("WARNING: This will restart your stream and may cause a short dropout for your listeners!"),
|
||||
"This is the admin username and password for Icecast/SHOUTcast to get listener statistics." => _("This is the admin username and password for Icecast/SHOUTcast to get listener statistics."),
|
||||
//preferences/support-setting.js
|
||||
"Image must be one of jpg, jpeg, png, or gif" => _("Image must be one of jpg, jpeg, png, or gif"),
|
||||
|
|
|
@ -149,9 +149,6 @@ class PreferenceController extends Zend_Controller_Action
|
|||
|
||||
session_start(); //Open session for writing.
|
||||
|
||||
// get current settings
|
||||
$setting = Application_Model_StreamSetting::getStreamSetting();
|
||||
|
||||
$name_map = array(
|
||||
'ogg' => 'Ogg Vorbis',
|
||||
'fdkaac' => 'AAC+',
|
||||
|
@ -160,55 +157,14 @@ class PreferenceController extends Zend_Controller_Action
|
|||
'mp3' => 'MP3',
|
||||
);
|
||||
|
||||
// get predefined type and bitrate from pref table
|
||||
$temp_types = Application_Model_Preference::GetStreamType();
|
||||
$stream_types = array();
|
||||
foreach ($temp_types as $type) {
|
||||
$type = strtolower(trim($type));
|
||||
if (isset($name_map[$type])) {
|
||||
$name = $name_map[$type];
|
||||
} else {
|
||||
$name = $type;
|
||||
}
|
||||
$stream_types[$type] = $name;
|
||||
}
|
||||
|
||||
$temp_bitrate = Application_Model_Preference::GetStreamBitrate();
|
||||
$max_bitrate = intval(Application_Model_Preference::GetMaxBitrate());
|
||||
$stream_bitrates = array();
|
||||
foreach ($temp_bitrate as $type) {
|
||||
if (intval($type) <= $max_bitrate) {
|
||||
$stream_bitrates[trim($type)] = strtoupper(trim($type))." kbit/s";
|
||||
}
|
||||
}
|
||||
|
||||
$num_of_stream = intval(Application_Model_Preference::GetNumOfStreams());
|
||||
$form = new Application_Form_StreamSetting();
|
||||
|
||||
// $form->addElement('hash', 'csrf', array(
|
||||
// 'salt' => 'unique'
|
||||
// ));
|
||||
|
||||
$csrf_namespace = new Zend_Session_Namespace('csrf_namespace');
|
||||
$csrf_element = new Zend_Form_Element_Hidden('csrf');
|
||||
$csrf_element->setValue($csrf_namespace->authtoken)->setRequired('true')->removeDecorator('HtmlTag')->removeDecorator('Label');
|
||||
$form->addElement($csrf_element);
|
||||
|
||||
$form->setSetting($setting);
|
||||
$form->startFrom();
|
||||
|
||||
$live_stream_subform = new Application_Form_LiveStreamingPreferences();
|
||||
$form->addSubForm($live_stream_subform, "live_stream_subform");
|
||||
|
||||
for ($i=1; $i<=$num_of_stream; $i++) {
|
||||
$subform = new Application_Form_StreamSettingSubForm();
|
||||
$subform->setPrefix($i);
|
||||
$subform->setSetting($setting);
|
||||
$subform->setStreamTypes($stream_types);
|
||||
$subform->setStreamBitrates($stream_bitrates);
|
||||
$subform->startForm();
|
||||
$form->addSubForm($subform, "s".$i."_subform");
|
||||
}
|
||||
if ($request->isPost()) {
|
||||
$params = $request->getPost();
|
||||
/* Parse through post data and put in format
|
||||
|
@ -246,7 +202,6 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$values["s3_data"] = $s3_data;
|
||||
$values["s4_data"] = $s4_data;
|
||||
|
||||
$error = false;
|
||||
if ($form->isValid($values)) {
|
||||
|
||||
$values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata');
|
||||
|
@ -263,13 +218,8 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$s4_set_admin_pass = !empty($values["s4_data"]["admin_pass"]);
|
||||
|
||||
// this goes into cc_pref table
|
||||
Application_Model_Preference::SetStreamLabelFormat($values['streamFormat']);
|
||||
Application_Model_Preference::SetLiveStreamMasterUsername($values["master_username"]);
|
||||
Application_Model_Preference::SetLiveStreamMasterPassword($values["master_password"]);
|
||||
Application_Model_Preference::SetDefaultTransitionFade($values["transition_fade"]);
|
||||
Application_Model_Preference::SetAutoTransition($values["auto_transition"]);
|
||||
Application_Model_Preference::SetAutoSwitch($values["auto_switch"]);
|
||||
|
||||
$this->setStreamPreferences($values);
|
||||
|
||||
// compare new values with current value
|
||||
$changeRGenabled = Application_Model_Preference::GetEnableReplayGain() != $values["enableReplayGain"];
|
||||
$changeRGmodifier = Application_Model_Preference::getReplayGainModifier() != $values["replayGainModifier"];
|
||||
|
@ -294,34 +244,86 @@ class PreferenceController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
Application_Model_RabbitMq::SendMessageToPypo("update_stream_setting", $data);
|
||||
|
||||
$live_stream_subform->updateVariables();
|
||||
$this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf();
|
||||
$this->view->form = $form;
|
||||
$this->view->num_stream = $num_of_stream;
|
||||
$this->view->statusMsg = "<div class='success'>"._("Stream Setting Updated.")."</div>";
|
||||
$this->_helper->json->sendJson(array(
|
||||
"valid"=>"true",
|
||||
"html"=>$this->view->render('preference/stream-setting.phtml'),
|
||||
"s1_set_admin_pass"=>$s1_set_admin_pass,
|
||||
"s2_set_admin_pass"=>$s2_set_admin_pass,
|
||||
"s3_set_admin_pass"=>$s3_set_admin_pass,
|
||||
"s4_set_admin_pass"=>$s4_set_admin_pass,
|
||||
));
|
||||
} else {
|
||||
$live_stream_subform->updateVariables();
|
||||
$this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf();
|
||||
$this->view->form = $form;
|
||||
$this->view->num_stream = $num_of_stream;
|
||||
$this->_helper->json->sendJson(array("valid"=>"false", "html"=>$this->view->render('preference/stream-setting.phtml')));
|
||||
}
|
||||
}
|
||||
|
||||
// get predefined type and bitrate from pref table
|
||||
$temp_types = Application_Model_Preference::GetStreamType();
|
||||
$stream_types = array();
|
||||
foreach ($temp_types as $type) {
|
||||
$type = strtolower(trim($type));
|
||||
if (isset($name_map[$type])) {
|
||||
$name = $name_map[$type];
|
||||
} else {
|
||||
$name = $type;
|
||||
}
|
||||
$stream_types[$type] = $name;
|
||||
}
|
||||
|
||||
$temp_bitrate = Application_Model_Preference::GetStreamBitrate();
|
||||
$max_bitrate = intval(Application_Model_Preference::GetMaxBitrate());
|
||||
$stream_bitrates = array();
|
||||
foreach ($temp_bitrate as $type) {
|
||||
if (intval($type) <= $max_bitrate) {
|
||||
$stream_bitrates[trim($type)] = strtoupper(trim($type))." kbit/s";
|
||||
}
|
||||
}
|
||||
|
||||
// get current settings
|
||||
$setting = Application_Model_StreamSetting::getStreamSetting();
|
||||
|
||||
$form->setSetting($setting);
|
||||
$form->startFrom();
|
||||
|
||||
$live_stream_subform = new Application_Form_LiveStreamingPreferences();
|
||||
$form->addSubForm($live_stream_subform, "live_stream_subform");
|
||||
|
||||
for ($i=1; $i<=$num_of_stream; $i++) {
|
||||
$subform = new Application_Form_StreamSettingSubForm();
|
||||
$subform->setPrefix($i);
|
||||
$subform->setSetting($setting);
|
||||
$subform->setStreamTypes($stream_types);
|
||||
$subform->setStreamBitrates($stream_bitrates);
|
||||
$subform->startForm();
|
||||
$subform->toggleState();
|
||||
$form->addSubForm($subform, "s".$i."_subform");
|
||||
}
|
||||
|
||||
$live_stream_subform->updateVariables();
|
||||
|
||||
$this->view->num_stream = $num_of_stream;
|
||||
$this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf();
|
||||
$this->view->form = $form;
|
||||
if ($request->isPost()) {
|
||||
if ($form->isValid($values)) {
|
||||
$this->_helper->json->sendJson(array(
|
||||
"valid" => "true",
|
||||
"html" => $this->view->render('preference/stream-setting.phtml'),
|
||||
"s1_set_admin_pass" => $s1_set_admin_pass,
|
||||
"s2_set_admin_pass" => $s2_set_admin_pass,
|
||||
"s3_set_admin_pass" => $s3_set_admin_pass,
|
||||
"s4_set_admin_pass" => $s4_set_admin_pass,
|
||||
));
|
||||
} else {
|
||||
$this->_helper->json->sendJson(array("valid" => "false", "html" => $this->view->render('preference/stream-setting.phtml')));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set stream settings preferences
|
||||
*
|
||||
* @param array $values stream setting preference values
|
||||
*/
|
||||
private function setStreamPreferences($values) {
|
||||
Application_Model_Preference::setUsingCustomStreamSettings($values['customStreamSettings']);
|
||||
Application_Model_Preference::SetStreamLabelFormat($values['streamFormat']);
|
||||
Application_Model_Preference::SetLiveStreamMasterUsername($values["master_username"]);
|
||||
Application_Model_Preference::SetLiveStreamMasterPassword($values["master_password"]);
|
||||
Application_Model_Preference::SetDefaultTransitionFade($values["transition_fade"]);
|
||||
Application_Model_Preference::SetAutoTransition($values["auto_transition"]);
|
||||
Application_Model_Preference::SetAutoSwitch($values["auto_switch"]);
|
||||
}
|
||||
|
||||
public function serverBrowseAction()
|
||||
|
|
|
@ -41,6 +41,9 @@ class ProvisioningController extends Zend_Controller_Action
|
|||
if (isset($_POST['provisioning_status'])) {
|
||||
Application_Model_Preference::setProvisioningStatus($_POST['provisioning_status']);
|
||||
}
|
||||
if (isset($_POST['icecast_pass'])) {
|
||||
Application_Model_Preference::setDefaultIcecastPassword($_POST['icecast_pass']);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(400)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue