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

- web interface
- auth script for liquidsoap
- DB changes
This commit is contained in:
James 2012-02-21 17:58:05 -05:00
parent 701ed82f40
commit 48bb19d758
26 changed files with 650 additions and 101 deletions

View file

@ -6,10 +6,6 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
public function init()
{
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/add-show-live-stream.phtml'))
));
$allow_live_stream = new Zend_Form_Element_Checkbox("allow_live_stream_override");
$allow_live_stream->setLabel("Allow Live Stream Override")
->setRequired(false)
@ -17,20 +13,20 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
$this->addElement($allow_live_stream);
$description1 = "This follows the same security pattern for the shows: if no users are explicitly set for the show, then anyone with a valid airtime login can connect to the stream, otherwise if there are users assigned to the show, then only those users can connect.";
$security_setting1 = new Zend_Form_Element_Checkbox("security_setting1");
$security_setting1->setLabel("Connect using Airtime username & password")
$cb_airtime_auth = new Zend_Form_Element_Checkbox("cb_airtime_auth");
$cb_airtime_auth->setLabel("Connect using Airtime username & password")
->setDescription($description1)
->setRequired(false)
->setDecorators(array('ViewHelper'));
$this->addElement($security_setting1);
$this->addElement($cb_airtime_auth);
$description2 = "Specifiy custom athentification which will work for only the show.";
$security_setting2 = new Zend_Form_Element_Checkbox("security_setting2");
$security_setting2 ->setLabel("Custom")
$cb_custom_auth = new Zend_Form_Element_Checkbox("cb_custom_auth");
$cb_custom_auth ->setLabel("Custom")
->setDescription($description2)
->setRequired(false)
->setDecorators(array('ViewHelper'));
$this->addElement($security_setting2);
$this->addElement($cb_custom_auth);
//custom username
$custom_username = new Zend_Form_Element_Text('custom_username');
@ -40,8 +36,8 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
->setLabel('Custom Username')
->setFilters(array('StringTrim'))
->setValidators(array(
new ConditionalNotEmpty(array("security_setting2"=>"1"))))
//fix//->setValue(Application_Model_Preference::GetLiveSteamMasterUsername())
new ConditionalNotEmpty(array("cb_custom_auth"=>"1"))))
->setValue(Application_Model_Preference::GetLiveSteamMasterUsername())
->setDecorators(array('ViewHelper'));
$this->addElement($custom_username);
@ -54,9 +50,18 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
->setLabel('Custom Password')
->setFilters(array('StringTrim'))
->setValidators(array(
new ConditionalNotEmpty(array("security_setting2"=>"1"))))
new ConditionalNotEmpty(array("cb_custom_auth"=>"1"))))
//fix//->setValue(Application_Model_Preference::GetLiveSteamMasterUsername())
->setDecorators(array('ViewHelper'));
$this->addElement($custom_password);
// hardcoded for now
$liquidsoap_host = 'localhost';
$liquidsoap_port = "8080";
$liquidsoap_mount_point = "test";
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/add-show-live-stream.phtml', "connection_url"=>"http://$liquidsoap_host:$liquidsoap_port/$liquidsoap_mount_point"))
));
}
}

View file

@ -19,8 +19,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
//Master username
$master_username = new Zend_Form_Element_Text('master_username');
$master_username->setAttrib('class', 'input_text')
->setAttrib('autocomplete', 'off')
$master_username->setAttrib('autocomplete', 'off')
->setAllowEmpty(true)
->setLabel('Master Username')
->setFilters(array('StringTrim'))
@ -30,14 +29,11 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
//Master password
$master_password = new Zend_Form_Element_Password('master_password');
$master_password->setAttrib('class', 'input_text')
->setAttrib('autocomplete', 'off')
$master_password->setAttrib('autocomplete', 'off')
->setAttrib('renderPassword','true')
->setAllowEmpty(true)
->setLabel('Master Password')
->setFilters(array('StringTrim'))
->setValue(Application_Model_Preference::GetLiveSteamMasterPassword())
->setDecorators(array('ViewHelper'));
$this->addElement($master_password);
}

View file

@ -20,9 +20,6 @@ class Application_Form_Preferences extends Zend_Form
$soundcloud_pref = new Application_Form_SoundcloudPreferences();
$this->addSubForm($soundcloud_pref, 'preferences_soundcloud');
/*$support_pref = new Application_Form_SupportPreferences();
$this->addSubForm($support_pref, 'preferences_support');*/
$this->addElement('submit', 'submit', array(
'class' => 'ui-button ui-state-default right-floated',

View file

@ -80,6 +80,7 @@ class Application_Form_StreamSetting extends Zend_Form
$d["streamFormat"] = $data['streamFormat'];
$this->populate($d);
}
return true;
$isValid = parent::isValid($data);
return $isValid;
}
}

View file

@ -177,20 +177,21 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
}
public function isValid ($data){
$isValid = parent::isValid($data);
if($data['enable'] == 1){
if($data['host'] == ''){
$f_data = $data['s'.$this->prefix."_data"];
$isValid = parent::isValid($f_data);
if($f_data['enable'] == 1){
if($f_data['host'] == ''){
$element = $this->getElement("host");
$element->addError("Server cannot be empty.");
$isValid = false;
}
if($data['port'] == ''){
if($f_data['port'] == ''){
$element = $this->getElement("port");
$element->addError("Port cannot be empty.");
$isValid = false;
}
if($data['output'] == 'icecast'){
if($data['mount'] == ''){
if($f_data['output'] == 'icecast'){
if($f_data['mount'] == ''){
$element = $this->getElement("mount");
$element->addError("Mount cannot be empty with Icecast server.");
$isValid = false;