CC-3963: If DJ is scheduled to broadcast for show, then automatically

enable source when DJ connects.

- done
This commit is contained in:
James 2012-06-12 15:38:03 -04:00
parent 22453f3820
commit 57397312f2
6 changed files with 62 additions and 3 deletions

View file

@ -814,6 +814,12 @@ class ApiController extends Zend_Controller_Action
Application_Model_Preference::SetSourceSwitchStatus($sourcename, "off"); Application_Model_Preference::SetSourceSwitchStatus($sourcename, "off");
Application_Model_LiveLog::SetEndTime($sourcename == 'scheduled_play'?'S':'L', Application_Model_LiveLog::SetEndTime($sourcename == 'scheduled_play'?'S':'L',
new DateTime("now", new DateTimeZone('UTC'))); new DateTime("now", new DateTimeZone('UTC')));
}elseif($status == "true" && Application_Model_Preference::GetAutoSwitch()){
$data = array("sourcename"=>$sourcename, "status"=>"on");
Application_Model_RabbitMq::SendMessageToPypo("switch_source", $data);
Application_Model_Preference::SetSourceSwitchStatus($sourcename, "on");
Application_Model_LiveLog::SetNewLogTime($sourcename == 'scheduled_play'?'S':'L',
new DateTime("now", new DateTimeZone('UTC')));
} }
Application_Model_Preference::SetSourceStatus($sourcename, $status); Application_Model_Preference::SetSourceStatus($sourcename, $status);
} }

View file

@ -215,6 +215,7 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetLiveSteamMasterPassword($values["master_password"]); Application_Model_Preference::SetLiveSteamMasterPassword($values["master_password"]);
Application_Model_Preference::SetDefaultTransitionFade($values["transition_fade"]); Application_Model_Preference::SetDefaultTransitionFade($values["transition_fade"]);
Application_Model_Preference::SetAutoTransition($values["auto_transition"]); Application_Model_Preference::SetAutoTransition($values["auto_transition"]);
Application_Model_Preference::SetAutoSwitch($values["auto_switch"]);
if (!$isSaas) { if (!$isSaas) {
if (!Application_Model_Preference::GetMasterDjConnectionUrlOverride()) { if (!Application_Model_Preference::GetMasterDjConnectionUrlOverride()) {

View file

@ -15,13 +15,20 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
$defaultFade = '00.000000'; $defaultFade = '00.000000';
} }
// automatic switch off // automatic trasition on source disconnection
$auto_transition = new Zend_Form_Element_Checkbox("auto_transition"); $auto_transition = new Zend_Form_Element_Checkbox("auto_transition");
$auto_transition->setLabel("Auto Source Transition") $auto_transition->setLabel("Auto Switch Off")
->setValue(Application_Model_Preference::GetAutoTransition()) ->setValue(Application_Model_Preference::GetAutoTransition())
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
$this->addElement($auto_transition); $this->addElement($auto_transition);
// automatic switch on upon source connection
$auto_switch = new Zend_Form_Element_Checkbox("auto_switch");
$auto_switch->setLabel("Auto Switch On")
->setValue(Application_Model_Preference::GetAutoSwitch())
->setDecorators(array('ViewHelper'));
$this->addElement($auto_switch);
// Default transition fade // Default transition fade
$transition_fade = new Zend_Form_Element_Text("transition_fade"); $transition_fade = new Zend_Form_Element_Text("transition_fade");
$transition_fade->setLabel("Switch Transition Fade (s)") $transition_fade->setLabel("Switch Transition Fade (s)")

View file

@ -877,6 +877,14 @@ class Application_Model_Preference
return self::GetValue("auto_transition"); return self::GetValue("auto_transition");
} }
public static function SetAutoSwitch($value){
self::SetValue("auto_switch", $value, false);
}
public static function GetAutoSwitch(){
return self::GetValue("auto_switch");
}
public static function SetEnableSystemEmail($upload) { public static function SetEnableSystemEmail($upload) {
self::SetValue("enable_system_email", $upload); self::SetValue("enable_system_email", $upload);
} }

View file

@ -17,6 +17,22 @@
</ul> </ul>
<?php endif; ?> <?php endif; ?>
</dd> </dd>
<dt id="auto_switch-label">
<label class="optional" for="auto_transition"><?php echo $this->element->getElement('auto_switch')->getLabel() ?> :
<span class="icecast_metadata_help_icon" id="auto_switch_help">
</span>
</label>
</dt>
<dd id="auto_switch-element">
<?php echo $this->element->getElement('auto_switch') ?>
<?php if($this->element->getElement('auto_switch')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('auto_switch')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="transition_fade-label"> <dt id="transition_fade-label">
<label class="optional" for="transition_fade"><?php echo $this->element->getElement('transition_fade')->getLabel() ?> : <label class="optional" for="transition_fade"><?php echo $this->element->getElement('transition_fade')->getLabel() ?> :
</label> </label>

View file

@ -292,7 +292,28 @@ $(document).ready(function() {
$("#auto_transition_help").qtip({ $("#auto_transition_help").qtip({
content: { 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." text: "Check this box to automatically switch off Master/Show source upon source disconnection."
},
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_switch_help").qtip({
content: {
text: "Check this box to automatically switch on Master/Show source upon source disconnection."
}, },
hide: { hide: {
delay: 500, delay: 500,