Merge branch '2.1.x' of dev.sourcefabric.org:airtime into 2.1.x

This commit is contained in:
Martin Konecny 2012-06-05 22:30:50 -04:00
commit 68deba81d9
9 changed files with 101 additions and 29 deletions

View File

@ -805,9 +805,10 @@ class ApiController extends Zend_Controller_Action
$msg = $request->getParam('msg');
$sourcename = $request->getParam('sourcename');
$status = $request->getParam('status');
// on source disconnection sent msg to pypo to turn off the switch
if($status == "false"){
// Added AutoTransition option
if($status == "false" && Application_Model_Preference::GetAutoTransition()){
$data = array("sourcename"=>$sourcename, "status"=>"off");
Application_Model_RabbitMq::SendMessageToPypo("switch_source", $data);
Application_Model_Preference::SetSourceSwitchStatus($sourcename, "off");

View File

@ -214,6 +214,7 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetLiveSteamMasterUsername($values["master_username"]);
Application_Model_Preference::SetLiveSteamMasterPassword($values["master_password"]);
Application_Model_Preference::SetDefaultTransitionFade($values["transition_fade"]);
Application_Model_Preference::SetAutoTransition($values["auto_transition"]);
if (!$isSaas) {
$master_connection_url = "http://".$_SERVER['SERVER_NAME'].":".$values["master_harbor_input_port"]."/".$values["master_harbor_input_mount_point"];

View File

@ -8,14 +8,12 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
{
$cb_airtime_auth = new Zend_Form_Element_Checkbox("cb_airtime_auth");
$cb_airtime_auth->setLabel("Use Airtime Authentication:")
->setDescription($description1)
->setRequired(false)
->setDecorators(array('ViewHelper'));
$this->addElement($cb_airtime_auth);
$cb_custom_auth = new Zend_Form_Element_Checkbox("cb_custom_auth");
$cb_custom_auth ->setLabel("Use Custom Authentication:")
->setDescription($description2)
->setRequired(false)
->setDecorators(array('ViewHelper'));
$this->addElement($cb_custom_auth);

View File

@ -15,7 +15,14 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
$defaultFade = '00.000000';
}
//Default transition fade
// automatic switch off
$auto_transition = new Zend_Form_Element_Checkbox("auto_transition");
$auto_transition->setLabel("Auto Source Transition")
->setValue(Application_Model_Preference::GetAutoTransition())
->setDecorators(array('ViewHelper'));
$this->addElement($auto_transition);
// Default transition fade
$transition_fade = new Zend_Form_Element_Text("transition_fade");
$transition_fade->setLabel("Switch Transition Fade (s)")
->setFilters(array('StringTrim'))
@ -51,6 +58,22 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
->setDecorators(array('ViewHelper'));
$this->addElement($master_password);
//Master source connection url
$master_dj_connection_url = new Zend_Form_Element_Text('master_dj_connection_url');
$master_dj_connection_url->setAttrib('readonly', true)
->setLabel('Master Source Connection URL')
->setValue(Application_Model_StreamSetting::GetConnectionUrls('master'))
->setDecorators(array('ViewHelper'));
$this->addElement($master_dj_connection_url);
//Show source connection url
$live_dj_connection_url = new Zend_Form_Element_Text('live_dj_connection_url');
$live_dj_connection_url->setAttrib('readonly', true)
->setLabel('Show Source Connection URL')
->setValue(Application_Model_StreamSetting::GetConnectionUrls('show'))
->setDecorators(array('ViewHelper'));
$this->addElement($live_dj_connection_url);
//liquidsoap harbor.input port
if (!$isSaas) {
$m_port = Application_Model_StreamSetting::GetMasterLiveSteamPort();
@ -105,29 +128,12 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
public function updateVariables(){
global $CC_CONFIG;
$m_port = Application_Model_StreamSetting::GetMasterLiveSteamPort();
$m_mount = Application_Model_StreamSetting::GetMasterLiveSteamMountPoint();
$l_port = Application_Model_StreamSetting::GetDJLiveSteamPort();
$l_mount = Application_Model_StreamSetting::GetDJLiveSteamMountPoint();
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1;
$master_dj_connection_url = Application_Model_Preference::GetMasterDJSourceConnectionURL();
$live_dj_connection_url = Application_Model_Preference::GetLiveDJSourceConnectionURL();
$master_dj_connection_url = ($master_dj_connection_url == "")?("http://".$_SERVER['SERVER_NAME'].":".$m_port."/".$m_mount):$master_dj_connection_url;
$live_dj_connection_url = ($live_dj_connection_url == "")?"http://".$_SERVER['SERVER_NAME'].":".$l_port."/".$l_mount:$live_dj_connection_url;
if($m_port=="" || $m_mount==""){
$master_dj_connection_url = "N/A";
}
if($l_port=="" || $l_mount==""){
$live_dj_connection_url = "N/A";
}
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/preferences_livestream.phtml', 'master_dj_connection_url'=>$master_dj_connection_url, 'live_dj_connection_url'=>$live_dj_connection_url, 'isSaas' => $isSaas, 'isDemo' => $isDemo))
array('ViewScript', array('viewScript' => 'form/preferences_livestream.phtml', 'isSaas' => $isSaas, 'isDemo' => $isDemo))
));
}

View File

@ -40,7 +40,6 @@ class Application_Form_StreamSetting extends Zend_Form
$icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
$icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata')
->setDescription($description)
->setRequired(false)
->setValue(($setting['icecast_vorbis_metadata'] == "true")?1:0)
->setDecorators(array('ViewHelper'));

View File

@ -840,6 +840,14 @@ class Application_Model_Preference
return self::GetValue("live_dj_source_connection_url");
}
public static function SetAutoTransition($value){
self::SetValue("auto_transition", $value, false);
}
public static function GetAutoTransition(){
return self::GetValue("auto_transition");
}
public static function SetEnableSystemEmail($upload) {
self::SetValue("enable_system_email", $upload);
}

View File

@ -281,6 +281,28 @@ class Application_Model_StreamSetting {
}
return $out;
}
public static function GetConnectionUrls($p_source_type) {
if (strcmp($p_source_type, "master")==0) {
$m_port = Application_Model_StreamSetting::GetMasterLiveSteamPort();
$m_mount = Application_Model_StreamSetting::GetMasterLiveSteamMountPoint();
$master_dj_connection_url = Application_Model_Preference::GetMasterDJSourceConnectionURL();
$connection_url = ($master_dj_connection_url == "")?("http://".$_SERVER['SERVER_NAME'].":".$m_port."/".$m_mount):$master_dj_connection_url;
if($m_port=="" || $m_mount==""){
$connection_url = "N/A";
}
}
else if (strcmp($p_source_type, "show")==0) {
$l_port = Application_Model_StreamSetting::GetDJLiveSteamPort();
$l_mount = Application_Model_StreamSetting::GetDJLiveSteamMountPoint();
$live_dj_connection_url = Application_Model_Preference::GetLiveDJSourceConnectionURL();
$connection_url = ($live_dj_connection_url == "")?"http://".$_SERVER['SERVER_NAME'].":".$l_port."/".$l_mount:$live_dj_connection_url;
if($l_port=="" || $l_mount==""){
$connection_url = "N/A";
}
}
return $connection_url;
}
public static function SetMasterLiveSteamPort($value){
self::SetValue("master_live_stream_port", $value, "integer");

View File

@ -1,6 +1,22 @@
<fieldset class="padded stream-setting-global" style="margin-top: 15px">
<legend>Input Stream Settings</legend>
<dl class="zend_form">
<dt id="auto_transition-label">
<label class="optional" for="auto_transition"><?php echo $this->element->getElement('auto_transition')->getLabel() ?> :
<span class="icecast_metadata_help_icon" id="auto_transition_help">
</span>
</label>
</dt>
<dd id="auto_transition-element">
<?php echo $this->element->getElement('auto_transition') ?>
<?php if($this->element->getElement('auto_transition')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('auto_transition')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="transition_fade-label">
<label class="optional" for="transition_fade"><?php echo $this->element->getElement('transition_fade')->getLabel() ?> :
</label>
@ -78,7 +94,7 @@
</label>
</dt>
<dd id="master_dj_connection_url-element">
<span id="stream_url" class="static_text"><?php echo $this->master_dj_connection_url ?></span>
<span id="stream_url" class="static_text"><?php echo $this->element->getElement('master_dj_connection_url') ?></span>
<?php if( !$this->isSaas && !$this->isDemo){?>
<a href=# id="connection_url_override" style="font-size: 12px;">override</a>&nbsp;&nbsp;
<span class="override_help_icon">
@ -121,7 +137,7 @@
</label>
</dt>
<dd id="live_dj_connection_url-element">
<span id="stream_url" class="static_text"><?php echo $this->live_dj_connection_url ?></span>
<span id="stream_url" class="static_text"><?php echo $this->element->getElement('live_dj_connection_url') ?></span>
<?php if( !$this->isSaas && !$this->isDemo ){?>
<a href=# id="connection_url_override" style="font-size: 12px;">override</a>&nbsp;&nbsp;
<span class="override_help_icon">

View File

@ -260,7 +260,28 @@ $(document).ready(function() {
$(".icecast_metadata_help_icon").qtip({
content: {
text: "This option enables metadata for OGG streams (stream metadata is the track title, artist, and show name that is displayed in an audio player). VLC and mplayer have a serious bug when playing an OGG/VORBIS stream that has metadata information enabled: they will disconnect from the stream after every song. If you are using an OGG stream and your listeners do not require support for these audio players, then feel free to enable this option."
text: "Check this option to enable metadata for OGG streams (stream metadata is the track title, artist, and show name that is displayed in an audio player). VLC and mplayer have a serious bug when playing an OGG/VORBIS stream that has metadata information enabled: they will disconnect from the stream after every song. If you are using an OGG stream and your listeners do not require support for these audio players, then feel free to enable this option."
},
hide: {
delay: 500,
fixed: true
},
style: {
border: {
width: 0,
radius: 4
},
classes: "ui-tooltip-dark ui-tooltip-rounded"
},
position: {
my: "left bottom",
at: "right center"
},
})
$("#auto_transition_help").qtip({
content: {
text: "Check this box to allow automatic transitions between sources. If enabled, Airtime will fallback to the next available source upon current (Master or Show) source failure. The fallback hierarchy is Master Source > Show Source > Scheduled Play."
},
hide: {
delay: 500,