Merge branch '2.1.x' of dev.sourcefabric.org:airtime into 2.1.x
This commit is contained in:
commit
e26ea19fdb
|
@ -814,6 +814,12 @@ class ApiController extends Zend_Controller_Action
|
|||
Application_Model_Preference::SetSourceSwitchStatus($sourcename, "off");
|
||||
Application_Model_LiveLog::SetEndTime($sourcename == 'scheduled_play'?'S':'L',
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -118,8 +118,12 @@ class LoginController extends Zend_Controller_Action
|
|||
if (!empty($user)) {
|
||||
$auth = new Application_Model_Auth();
|
||||
|
||||
$auth->sendPasswordRestoreLink($user, $this->view);
|
||||
$this->_helper->redirector('password-restore-after', 'login');
|
||||
$success = $auth->sendPasswordRestoreLink($user, $this->view);
|
||||
if ($success) {
|
||||
$this->_helper->redirector('password-restore-after', 'login');
|
||||
} else {
|
||||
$form->email->addError($this->view->translate("Email could not be sent. Check your mail server settings and ensure it has been configured properly."));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$form->email->addError($this->view->translate("Given email not found."));
|
||||
|
|
|
@ -215,6 +215,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
Application_Model_Preference::SetLiveSteamMasterPassword($values["master_password"]);
|
||||
Application_Model_Preference::SetDefaultTransitionFade($values["transition_fade"]);
|
||||
Application_Model_Preference::SetAutoTransition($values["auto_transition"]);
|
||||
Application_Model_Preference::SetAutoSwitch($values["auto_switch"]);
|
||||
|
||||
if (!$isSaas) {
|
||||
if (!Application_Model_Preference::GetMasterDjConnectionUrlOverride()) {
|
||||
|
@ -265,7 +266,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
$live_stream_subform->updateVariables();
|
||||
$this->view->confirm_pypo_restart_text = "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).";
|
||||
$this->view->confirm_pypo_restart_text = "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.";
|
||||
|
||||
$this->view->num_stream = $num_of_stream;
|
||||
$this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf();
|
||||
|
|
|
@ -49,6 +49,7 @@ class Application_Form_AddUser extends Zend_Form
|
|||
$email->setLabel('Email:');
|
||||
$email->setAttrib('class', 'input_text');
|
||||
$email->addFilter('StringTrim');
|
||||
$email->setRequired(true);
|
||||
$email->addValidator('EmailAddress');
|
||||
$this->addElement($email);
|
||||
|
||||
|
|
|
@ -15,13 +15,20 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
|
|||
$defaultFade = '00.000000';
|
||||
}
|
||||
|
||||
// automatic switch off
|
||||
// automatic trasition on source disconnection
|
||||
$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())
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$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
|
||||
$transition_fade = new Zend_Form_Element_Text("transition_fade");
|
||||
$transition_fade->setLabel("Switch Transition Fade (s)")
|
||||
|
|
|
@ -31,7 +31,9 @@ class Application_Model_Auth {
|
|||
|
||||
$message = "Click this link: {$e_link_protocol}://{$e_link_base}{$e_link_path}";
|
||||
|
||||
Application_Model_Email::send('Airtime Password Reset', $message, $user->getDbEmail());
|
||||
$success = Application_Model_Email::send('Airtime Password Reset', $message, $user->getDbEmail());
|
||||
|
||||
return $success;
|
||||
}
|
||||
|
||||
public function invalidateTokens($user, $action)
|
||||
|
@ -97,4 +99,4 @@ class Application_Model_Auth {
|
|||
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ class Application_Model_Email {
|
|||
*/
|
||||
public static function send($subject, $message, $tos, $from = null)
|
||||
{
|
||||
$success = true;
|
||||
$mail = new Zend_Mail('utf-8');
|
||||
$mail->setSubject($subject);
|
||||
$mail->setBodyText($message);
|
||||
|
@ -21,6 +22,12 @@ class Application_Model_Email {
|
|||
$mail->addTo($to);
|
||||
}
|
||||
|
||||
$mail->send();
|
||||
try {
|
||||
$mail->send();
|
||||
} catch (Exception $e) {
|
||||
$success = false;
|
||||
}
|
||||
|
||||
return $success;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -877,6 +877,14 @@ class Application_Model_Preference
|
|||
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) {
|
||||
self::SetValue("enable_system_email", $upload);
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ class Application_Model_User {
|
|||
|
||||
public function setEmail($email){
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbEmail($email);
|
||||
$user->setDbEmail(strtolower($email));
|
||||
}
|
||||
|
||||
public function setSkype($skype){
|
||||
|
|
|
@ -17,6 +17,22 @@
|
|||
</ul>
|
||||
<?php endif; ?>
|
||||
</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">
|
||||
<label class="optional" for="transition_fade"><?php echo $this->element->getElement('transition_fade')->getLabel() ?> :
|
||||
</label>
|
||||
|
|
|
@ -292,7 +292,28 @@ $(document).ready(function() {
|
|||
|
||||
$("#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."
|
||||
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: {
|
||||
delay: 500,
|
||||
|
|
|
@ -12,7 +12,7 @@ function startDpSelect(dateText, inst) {
|
|||
date = new Date(time[0], time[1] - 1, time[2]);
|
||||
|
||||
if (inst.input)
|
||||
inst.input.trigger('change');
|
||||
inst.input.trigger('input');
|
||||
}
|
||||
|
||||
function endDpSelect(dateText, inst) {
|
||||
|
@ -22,19 +22,19 @@ function endDpSelect(dateText, inst) {
|
|||
date = new Date(time[0], time[1] - 1, time[2]);
|
||||
|
||||
if (inst.input)
|
||||
inst.input.trigger('change');
|
||||
inst.input.trigger('input');
|
||||
}
|
||||
|
||||
function createDateInput(el, onSelect) {
|
||||
var date;
|
||||
|
||||
el.datepicker({
|
||||
minDate: adjustDateToServerDate(new Date(), timezoneOffset),
|
||||
onSelect: onSelect,
|
||||
dateFormat: 'yy-mm-dd',
|
||||
closeText: 'Close',
|
||||
showButtonPanel: true,
|
||||
firstDay: weekStart
|
||||
minDate: adjustDateToServerDate(new Date(), timezoneOffset),
|
||||
onSelect: onSelect,
|
||||
dateFormat: 'yy-mm-dd',
|
||||
closeText: 'Close',
|
||||
showButtonPanel: true,
|
||||
firstDay: weekStart
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -83,6 +83,14 @@ function beginEditShow(data){
|
|||
openAddShowForm();
|
||||
}
|
||||
|
||||
function onStartTimeSelect(){
|
||||
$("#add_show_start_time").trigger('input');
|
||||
}
|
||||
|
||||
function onEndTimeSelect(){
|
||||
$("#add_show_end_time").trigger('input');
|
||||
}
|
||||
|
||||
function setAddShowEvents() {
|
||||
|
||||
var form = $("#add-show-form");
|
||||
|
@ -255,12 +263,14 @@ function setAddShowEvents() {
|
|||
createDateInput(form.find("#add_show_end_date_no_repeat"), endDpSelect);
|
||||
createDateInput(form.find("#add_show_end_date"), endDpSelect);
|
||||
|
||||
form.find("#add_show_start_time").timepicker({
|
||||
$("#add_show_start_time").timepicker({
|
||||
amPmText: ['', ''],
|
||||
defaultTime: '00:00'
|
||||
defaultTime: '00:00',
|
||||
onSelect: onStartTimeSelect
|
||||
});
|
||||
form.find("#add_show_end_time").timepicker({
|
||||
amPmText: ['', '']
|
||||
$("#add_show_end_time").timepicker({
|
||||
amPmText: ['', ''],
|
||||
onSelect: onEndTimeSelect
|
||||
});
|
||||
|
||||
form.find('input[name^="add_show_rebroadcast_date_absolute"]').datepicker({
|
||||
|
@ -438,72 +448,81 @@ function setAddShowEvents() {
|
|||
});
|
||||
});
|
||||
|
||||
var regDate = new RegExp(/^[0-9]{4}-[0-1][0-9]-[0-3][0-9]/);
|
||||
var regTime = new RegExp(/^[0-2][0-9]:[0-5][0-9]/);
|
||||
|
||||
// when start date/time changes, set end date/time to start date/time+1 hr
|
||||
$('#add_show_start_date, #add_show_start_time').change(function(){
|
||||
$('#add_show_start_date, #add_show_start_time').bind('input', 'change', function(){
|
||||
var startDateString = $('#add_show_start_date').val();
|
||||
var startTimeString = $('#add_show_start_time').val();
|
||||
var startDate = startDateString.split('-');
|
||||
var startTime = startTimeString.split(':');
|
||||
var startDateTime = new Date(startDate[0], parseInt(startDate[1], 10)-1, startDate[2], startTime[0], startTime[1], 0, 0);
|
||||
|
||||
var endDateString = $('#add_show_end_date_no_repeat').val();
|
||||
var endTimeString = $('#add_show_end_time').val()
|
||||
var endDate = endDateString.split('-');
|
||||
var endTime = endTimeString.split(':');
|
||||
var endDateTime = new Date(endDate[0], parseInt(endDate[1], 10)-1, endDate[2], endTime[0], endTime[1], 0, 0);
|
||||
|
||||
if(startDateTime.getTime() >= endDateTime.getTime()){
|
||||
var duration = $('#add_show_duration').val();
|
||||
// parse duration
|
||||
var time = 0;
|
||||
var info = duration.split(' ');
|
||||
var h = parseInt(info[0], 10);
|
||||
time += h * 60 * 60* 1000;
|
||||
if(info.length >1 && $.trim(info[1]) !== ''){
|
||||
var m = parseInt(info[1], 10);
|
||||
time += m * 60 * 1000;
|
||||
}
|
||||
endDateTime = new Date(startDateTime.getTime() + time);
|
||||
}
|
||||
|
||||
var endDateFormat = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth()+1,2) + '-' + pad(endDateTime.getDate(),2);
|
||||
var endTimeFormat = pad(endDateTime.getHours(),2) + ':' + pad(endDateTime.getMinutes(),2);
|
||||
|
||||
$('#add_show_end_date_no_repeat').val(endDateFormat);
|
||||
$('#add_show_end_time').val(endTimeFormat);
|
||||
|
||||
// calculate duration
|
||||
var startDateTimeString = startDateString + " " + startTimeString;
|
||||
var endDateTimeString = $('#add_show_end_date_no_repeat').val() + " " + $('#add_show_end_time').val();
|
||||
calculateDuration(startDateTimeString, endDateTimeString);
|
||||
|
||||
if(regDate.test(startDateString) && regTime.test(startTimeString)){
|
||||
var startDate = startDateString.split('-');
|
||||
var startTime = startTimeString.split(':');
|
||||
var startDateTime = new Date(startDate[0], parseInt(startDate[1], 10)-1, startDate[2], startTime[0], startTime[1], 0, 0);
|
||||
|
||||
var endDateString = $('#add_show_end_date_no_repeat').val();
|
||||
var endTimeString = $('#add_show_end_time').val()
|
||||
var endDate = endDateString.split('-');
|
||||
var endTime = endTimeString.split(':');
|
||||
var endDateTime = new Date(endDate[0], parseInt(endDate[1], 10)-1, endDate[2], endTime[0], endTime[1], 0, 0);
|
||||
|
||||
if(startDateTime.getTime() >= endDateTime.getTime()){
|
||||
var duration = $('#add_show_duration').val();
|
||||
// parse duration
|
||||
var time = 0;
|
||||
var info = duration.split(' ');
|
||||
var h = parseInt(info[0], 10);
|
||||
time += h * 60 * 60* 1000;
|
||||
if(info.length >1 && $.trim(info[1]) !== ''){
|
||||
var m = parseInt(info[1], 10);
|
||||
time += m * 60 * 1000;
|
||||
}
|
||||
endDateTime = new Date(startDateTime.getTime() + time);
|
||||
}
|
||||
|
||||
var endDateFormat = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth()+1,2) + '-' + pad(endDateTime.getDate(),2);
|
||||
var endTimeFormat = pad(endDateTime.getHours(),2) + ':' + pad(endDateTime.getMinutes(),2);
|
||||
|
||||
$('#add_show_end_date_no_repeat').val(endDateFormat);
|
||||
$('#add_show_end_time').val(endTimeFormat);
|
||||
|
||||
// calculate duration
|
||||
var startDateTimeString = startDateString + " " + startTimeString;
|
||||
var endDateTimeString = $('#add_show_end_date_no_repeat').val() + " " + $('#add_show_end_time').val();
|
||||
calculateDuration(startDateTimeString, endDateTimeString);
|
||||
}
|
||||
});
|
||||
|
||||
// when end date/time changes, check if the changed date is in past of start date/time
|
||||
$('#add_show_end_date_no_repeat, #add_show_end_time').change(function(){
|
||||
var startDateString = $('#add_show_start_date').val();
|
||||
var startTimeString = $('#add_show_start_time').val();
|
||||
var startDate = startDateString.split('-');
|
||||
var startTime = startTimeString.split(':');
|
||||
var startDateTime = new Date(startDate[0], parseInt(startDate[1], 10)-1, startDate[2], startTime[0], startTime[1], 0, 0);
|
||||
|
||||
var endDateString = $('#add_show_end_date_no_repeat').val();
|
||||
$('#add_show_end_date_no_repeat, #add_show_end_time').bind('input', 'change', function(){
|
||||
var endDateString = $('#add_show_end_date_no_repeat').val();
|
||||
var endTimeString = $('#add_show_end_time').val()
|
||||
var endDate = endDateString.split('-');
|
||||
var endTime = endTimeString.split(':');
|
||||
var endDateTime = new Date(endDate[0], parseInt(endDate[1], 10)-1, endDate[2], endTime[0], endTime[1], 0, 0);
|
||||
|
||||
if(regDate.test(endDateString) && regTime.test(endTimeString)){
|
||||
var startDateString = $('#add_show_start_date').val();
|
||||
var startTimeString = $('#add_show_start_time').val();
|
||||
var startDate = startDateString.split('-');
|
||||
var startTime = startTimeString.split(':');
|
||||
var startDateTime = new Date(startDate[0], parseInt(startDate[1], 10)-1, startDate[2], startTime[0], startTime[1], 0, 0);
|
||||
|
||||
if(startDateTime.getTime() > endDateTime.getTime()){
|
||||
$('#add_show_end_date_no_repeat').css('background-color', '#F49C9C');
|
||||
$('#add_show_end_time').css('background-color', '#F49C9C');
|
||||
}else{
|
||||
$('#add_show_end_date_no_repeat').css('background-color', '');
|
||||
$('#add_show_end_time').css('background-color', '');
|
||||
}
|
||||
|
||||
// calculate duration
|
||||
var startDateTimeString = startDateString + " " + startTimeString;
|
||||
var endDateTimeString = endDateString + " " + endTimeString;
|
||||
calculateDuration(startDateTimeString, endDateTimeString);
|
||||
var endDate = endDateString.split('-');
|
||||
var endTime = endTimeString.split(':');
|
||||
var endDateTime = new Date(endDate[0], parseInt(endDate[1], 10)-1, endDate[2], endTime[0], endTime[1], 0, 0);
|
||||
|
||||
if(startDateTime.getTime() > endDateTime.getTime()){
|
||||
$('#add_show_end_date_no_repeat').css('background-color', '#F49C9C');
|
||||
$('#add_show_end_time').css('background-color', '#F49C9C');
|
||||
}else{
|
||||
$('#add_show_end_date_no_repeat').css('background-color', '');
|
||||
$('#add_show_end_time').css('background-color', '');
|
||||
}
|
||||
|
||||
// calculate duration
|
||||
var startDateTimeString = startDateString + " " + startTimeString;
|
||||
var endDateTimeString = endDateString + " " + endTimeString;
|
||||
calculateDuration(startDateTimeString, endDateTimeString);
|
||||
}
|
||||
});
|
||||
|
||||
if($('#cb_custom_auth').attr('checked')){
|
||||
|
|
|
@ -80,7 +80,6 @@ class PypoFetch(Thread):
|
|||
self.logger.info("Handling command: " + command)
|
||||
|
||||
if command == 'update_schedule':
|
||||
self.last_update_schedule_timestamp = time.time()
|
||||
self.schedule_data = m['schedule']
|
||||
self.process_schedule(self.schedule_data)
|
||||
elif command == 'update_stream_setting':
|
||||
|
@ -405,6 +404,7 @@ class PypoFetch(Thread):
|
|||
- runs the cleanup routine, to get rid of unused cached files
|
||||
"""
|
||||
def process_schedule(self, schedule_data):
|
||||
self.last_update_schedule_timestamp = time.time()
|
||||
self.logger.debug(schedule_data)
|
||||
media = schedule_data["media"]
|
||||
media_filtered = {}
|
||||
|
|
Loading…
Reference in New Issue