CC-3224: "On-the-fly" stream rebroadcasting
- Form in preference section
This commit is contained in:
parent
309c6da83d
commit
ca04a7a686
6 changed files with 142 additions and 1 deletions
43
airtime_mvc/application/forms/LiveStreamingPreferences.php
Normal file
43
airtime_mvc/application/forms/LiveStreamingPreferences.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
require_once 'customvalidators/ConditionalNotEmpty.php';
|
||||
require_once 'customvalidators/PasswordNotEmpty.php';
|
||||
|
||||
class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/preferences_livestream.phtml'))
|
||||
));
|
||||
|
||||
//enable Auto-enable for all shows
|
||||
$auto_enable = new Zend_Form_Element_Checkbox('auto_enable_live_stream');
|
||||
$auto_enable->setLabel('Auto-enable for all shows')
|
||||
->setRequired(false)
|
||||
->setValue(Application_Model_Preference::GetLiveSteamAutoEnable())
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($auto_enable);
|
||||
|
||||
//Master username
|
||||
$master_username = new Zend_Form_Element_Text('master_username');
|
||||
$master_username->setAttrib('class', 'input_text')
|
||||
->setLabel('Master Username')
|
||||
->setFilters(array('StringTrim'))
|
||||
->setValue(Application_Model_Preference::GetLiveSteamMasterUsername())
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($master_username);
|
||||
|
||||
//Master password
|
||||
$master_password = new Zend_Form_Element_Text('master_password');
|
||||
$master_password->setAttrib('class', 'input_text')
|
||||
->setAttrib('autocomplete', 'off')
|
||||
->setAttrib('renderPassword', true)
|
||||
->setLabel('Master Password')
|
||||
->setFilters(array('StringTrim'))
|
||||
->setValidators(array(new ConditionalNotEmpty(array('auto_enable_live_stream'=>'1'))))
|
||||
->setValue(Application_Model_Preference::GetLiveSteamMasterUsername())
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($master_password);
|
||||
}
|
||||
}
|
|
@ -15,6 +15,9 @@ class Application_Form_Preferences extends Zend_Form
|
|||
$general_pref = new Application_Form_GeneralPreferences();
|
||||
$this->addSubForm($general_pref, 'preferences_general');
|
||||
|
||||
$livestream_pref = new Application_Form_LiveStreamingPreferences();
|
||||
$this->addSubForm($livestream_pref, 'preferences_livestream');
|
||||
|
||||
$soundcloud_pref = new Application_Form_SoundcloudPreferences();
|
||||
$this->addSubForm($soundcloud_pref, 'preferences_soundcloud');
|
||||
|
||||
|
|
|
@ -700,6 +700,36 @@ class Application_Model_Preference
|
|||
return $val;
|
||||
}
|
||||
|
||||
/*
|
||||
* $value should be 1 or 0
|
||||
*/
|
||||
public static function SetLiveSteamAutoEnable($value){
|
||||
self::SetValue("live_stream_auto_enable", $value, false);
|
||||
}
|
||||
|
||||
public static function GetLiveSteamAutoEnable(){
|
||||
if(self::GetValue("live_stream_auto_enable") == Null){
|
||||
return 0;
|
||||
}
|
||||
return self::GetValue("live_stream_auto_enable");
|
||||
}
|
||||
|
||||
public static function SetLiveSteamMasterUsername($value){
|
||||
self::SetValue("live_stream_master_username", $value, false);
|
||||
}
|
||||
|
||||
public static function GetLiveSteamMasterUsername(){
|
||||
return self::GetValue("live_stream_master_username");
|
||||
}
|
||||
|
||||
public static function SetLiveSteamMasterPassword($value){
|
||||
self::SetValue("live_stream_master_password", $value, false);
|
||||
}
|
||||
|
||||
public static function GetLiveSteamMasterPassword(){
|
||||
return self::GetValue("live_stream_master_username");
|
||||
}
|
||||
|
||||
/* User specific preferences end */
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
<?php echo $this->element->getSubform('preferences_general') ?>
|
||||
|
||||
<h3 class="collapsible-header" id="livestream-heading"><span class="arrow-icon"></span>On-the-fly Live Stream Settings</h3>
|
||||
|
||||
<div class="collapsible-content" id="livestream-settings" style="display: none;">
|
||||
<?php echo $this->element->getSubform('preferences_livestream') ?>
|
||||
</div>
|
||||
|
||||
<h3 class="collapsible-header" id="soundcloud-heading"><span class="arrow-icon"></span>SoundCloud Settings</h3>
|
||||
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<fieldset class="padded">
|
||||
<dl class="zend_form">
|
||||
<dd id="auto_enable_live_stream-element" class="block-display" style=" margin:6px 0 10px 0">
|
||||
<label class="optional" for="auto_enable_live_stream">
|
||||
<?php echo $this->element->getElement('auto_enable_live_stream') ?>
|
||||
<strong><?php echo $this->element->getElement('auto_enable_live_stream')->getLabel() ?></strong>
|
||||
</label>
|
||||
<?php if($this->element->getElement('auto_enable_live_stream')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<?php foreach($this->element->getElement('auto_enable_live_stream')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt id="master_username-label" class="block-display">
|
||||
<label class="optional" for="master_username"><?php echo $this->element->getElement('master_username')->getLabel() ?>
|
||||
<span class="info-text-small">(Required)</span> :
|
||||
</label>
|
||||
</dt>
|
||||
<dd id="master_username-element" class="block-display">
|
||||
<?php echo $this->element->getElement('master_username') ?>
|
||||
<?php if($this->element->getElement('master_username')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<?php foreach($this->element->getElement('master_username')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt id="master_password-label" class="block-display">
|
||||
<label class="optional" for="master_password"><?php echo $this->element->getElement('master_password')->getLabel() ?>
|
||||
<span class="info-text-small">(Required)</span> :
|
||||
</label>
|
||||
</dt>
|
||||
<dd id="master_password-element" class="block-display">
|
||||
<?php echo $this->element->getElement('master_password') ?>
|
||||
<?php if($this->element->getElement('master_password')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<?php foreach($this->element->getElement('master_password')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
|
@ -38,7 +38,20 @@ server.register(namespace="streams", "connection_status", fun (s) -> begin "1:#{
|
|||
default = amplify(0.00001, noise())
|
||||
default = rewrite_metadata([("artist","Airtime"), ("title", "offline")],default)
|
||||
|
||||
s = fallback(track_sensitive=false, [queue, default])
|
||||
#live stream setup
|
||||
set("harbor.bind_addr", "0.0.0.0")
|
||||
#auth function for live stream
|
||||
def auth(user, password) =
|
||||
if user == 'james' and password == 'james' then
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
live = input.harbor("test", port=8080, auth=auth)
|
||||
|
||||
s = fallback(track_sensitive=false, [live, queue, default])
|
||||
|
||||
s = on_metadata(notify, s)
|
||||
s = crossfade(s)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue