Merge branch 'devel' into CC-3174

This commit is contained in:
Naomi Aro 2012-04-10 15:57:13 +02:00
commit b998a04c2e
40 changed files with 354 additions and 234 deletions

View file

@ -112,10 +112,6 @@ Non-linked code:
- Web site: http://code.google.com/p/jq-serverbrowse/
- License: BSD 2-Clause
* meioMask
- Web site: http://www.meiocodigo.com/
- License: MIT
-------------
Media-Monitor
-------------

View file

@ -58,7 +58,8 @@ class ApiController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender(true);
$api_key = $this->_getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -333,7 +334,8 @@ class ApiController extends Zend_Controller_Action
$api_key = $this->_getParam('api_key');
if(!in_array($api_key, $CC_CONFIG["apiKey"]))
if(!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource. ';
@ -355,7 +357,8 @@ class ApiController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender(true);
$api_key = $this->_getParam('api_key');
if(!in_array($api_key, $CC_CONFIG["apiKey"]))
if(!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -378,7 +381,8 @@ class ApiController extends Zend_Controller_Action
global $CC_CONFIG;
$api_key = $this->_getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -411,7 +415,8 @@ class ApiController extends Zend_Controller_Action
global $CC_CONFIG;
$api_key = $this->_getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -435,7 +440,8 @@ class ApiController extends Zend_Controller_Action
global $CC_CONFIG;
$api_key = $this->_getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -542,7 +548,8 @@ class ApiController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender(true);
$api_key = $this->_getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -564,7 +571,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest();
$api_key = $request->getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -667,7 +675,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest();
$api_key = $request->getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -683,7 +692,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest();
$api_key = $request->getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -711,7 +721,8 @@ class ApiController extends Zend_Controller_Action
$api_key = $request->getParam('api_key');
$path = base64_decode($request->getParam('path'));
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -728,7 +739,8 @@ class ApiController extends Zend_Controller_Action
$api_key = $request->getParam('api_key');
$path = base64_decode($request->getParam('path'));
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -745,7 +757,8 @@ class ApiController extends Zend_Controller_Action
$api_key = $request->getParam('api_key');
$path = base64_decode($request->getParam('path'));
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -760,7 +773,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest();
$api_key = $request->getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -777,14 +791,13 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest();
$api_key = $request->getParam('api_key');
$getDiskInfo = $request->getParam('diskinfo') == "true";
/*
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
exit;
}
*/
$status = array(
"platform"=>Application_Model_Systemstatus::GetPlatformInfo(),
@ -846,7 +859,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest();
$api_key = $request->getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -926,7 +940,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest();
$api_key = $request->getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -945,7 +960,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest();
$api_key = $request->getParam('api_key');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';
@ -979,7 +995,8 @@ class ApiController extends Zend_Controller_Action
$password = $request->getParam('password');
$djtype = $request->getParam('djtype');
if (!in_array($api_key, $CC_CONFIG["apiKey"]))
if (!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.';

View file

@ -142,7 +142,6 @@ class PreferenceController extends Zend_Controller_Action
$baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/streamsetting.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/meioMask/jquery.meio.mask.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
// get current settings
$temp = Application_Model_StreamSetting::getStreamSetting();
@ -236,7 +235,7 @@ class PreferenceController extends Zend_Controller_Action
$live_stream_subform->updateConnectionURLs();
}
$this->view->confirm_pypo_restart_text = "Updating settings will temporarily interrupt any currently playing shows. Click \'OK\' to continue.";
$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->num_stream = $num_of_stream;
$this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf();
@ -262,6 +261,7 @@ class PreferenceController extends Zend_Controller_Action
{
$path = $path.'/';
$handle = opendir($path);
if ($handle !== false){
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
//only show directories that aren't private.
@ -275,6 +275,7 @@ class PreferenceController extends Zend_Controller_Action
}
}
}
}
ksort($result);
//returns format serverBrowse is looking for.
die(json_encode($result));

View file

@ -28,6 +28,8 @@ class ScheduleController extends Zend_Controller_Action
->addActionContext('content-context-menu', 'json')
->addActionContext('set-time-scale', 'json')
->addActionContext('set-time-interval', 'json')
->addActionContext('edit-show-instance', 'json')
->addActionContext('dj-edit-show', 'json')
->initContext();
$this->sched_sess = new Zend_Session_Namespace("schedule");
@ -52,7 +54,6 @@ class ScheduleController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/add-show.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/schedule.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/meioMask/jquery.meio.mask.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
@ -88,6 +89,9 @@ class ScheduleController extends Zend_Controller_Action
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
if($user->isUserType(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)){
$this->view->preloadShowForm = true;
}
$this->view->headScript()->appendScript("var weekStart = ".Application_Model_Preference::GetWeekStartDay().";");
}
@ -429,6 +433,7 @@ class ScheduleController extends Zend_Controller_Action
$this->view->percentFilled = $show->getPercentScheduled();
$this->view->showContent = $show->getShowListContent();
$this->view->dialog = $this->view->render('schedule/show-content-dialog.phtml');
$this->view->showTitle = $show->getName();
unset($this->view->showContent);
}
@ -444,6 +449,10 @@ class ScheduleController extends Zend_Controller_Action
// repeating shows. It's value is either "instance","rebroadcast", or "all"
$type = $this->_getParam('type');
if ($type == "instance"){
$this->view->action = "edit-show-instance";
}
try{
$showInstance = new Application_Model_ShowInstance($showInstanceId);
}catch(Exception $e){
@ -458,6 +467,10 @@ class ScheduleController extends Zend_Controller_Action
return;
}
if($isDJ){
$this->view->action = "dj-edit-show";
}
$formWhat = new Application_Form_AddShowWhat();
$formWho = new Application_Form_AddShowWho();
$formWhen = new Application_Form_AddShowWhen();
@ -604,9 +617,49 @@ class ScheduleController extends Zend_Controller_Action
}
public function getFormAction(){
if($user->isUserType(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)){
Application_Model_Schedule::createNewFormSections($this->view);
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
}
}
public function editShowInstanceAction(){
$js = $this->_getParam('data');
$data = array();
//need to convert from serialized jQuery array.
foreach($js as $j){
$data[$j["name"]] = $j["value"];
}
}
public function djEditShowAction(){
$js = $this->_getParam('data');
$data = array();
//need to convert from serialized jQuery array.
foreach($js as $j){
$data[$j["name"]] = $j["value"];
}
//update cc_show
$show = new Application_Model_Show($data["add_show_id"]);
$show->setAirtimeAuthFlag($data["cb_airtime_auth"]);
$show->setCustomAuthFlag($data["cb_custom_auth"]);
$show->setCustomUsername($data["custom_username"]);
$show->setCustomPassword($data["custom_password"]);
$this->view->edit = true;
}
//for 2.2
/*
public function editShowAction(){
}
*/
public function addShowAction()
{
@ -619,13 +672,6 @@ class ScheduleController extends Zend_Controller_Action
}
$show = new Application_Model_Show($data['add_show_id']);
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
$isDJ = $user->isHost($show->getId());
$startDateModified = true;
if ($data['add_show_id'] != -1 && !array_key_exists('add_show_start_date', $data)){
//show is being updated and changing the start date was disabled, since the
@ -643,6 +689,11 @@ class ScheduleController extends Zend_Controller_Action
$data['add_show_day_check'] = null;
}
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
$isDJ = $user->isHost($show->getId());
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$record = false;

View file

@ -36,8 +36,7 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
{
if ($element->getType() != 'Zend_Form_Element_Hidden')
{
$element->setAttrib('readonly',true);
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
$element->setAttrib('disabled','disabled');
}
}
}

View file

@ -8,7 +8,7 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
{
$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.";
$cb_airtime_auth = new Zend_Form_Element_Checkbox("cb_airtime_auth");
$cb_airtime_auth->setLabel("Connect using Airtime username & password")
$cb_airtime_auth->setLabel("Use Airtime Authentication")
->setDescription($description1)
->setRequired(false)
->setDecorators(array('ViewHelper'));
@ -16,7 +16,7 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
$description2 = "Specifiy custom athentification which will work for only the show.";
$cb_custom_auth = new Zend_Form_Element_Checkbox("cb_custom_auth");
$cb_custom_auth ->setLabel("Custom")
$cb_custom_auth ->setLabel("Use Custom Authentication")
->setDescription($description2)
->setRequired(false)
->setDecorators(array('ViewHelper'));

View file

@ -24,8 +24,7 @@ class Application_Form_AddShowRR extends Zend_Form_SubForm
{
if ($element->getType() != 'Zend_Form_Element_Hidden')
{
$element->setAttrib('readonly',true);
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
$element->setAttrib('disabled','disabled');
}
}
}

View file

@ -41,8 +41,7 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
{
if ($element->getType() != 'Zend_Form_Element_Hidden')
{
$element->setAttrib('readonly',true);
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
$element->setAttrib('disabled','disabled');
}
}
}

View file

@ -62,8 +62,7 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
{
if ($element->getType() != 'Zend_Form_Element_Hidden')
{
$element->setAttrib('readonly',true);
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
$element->setAttrib('disabled','disabled');
}
}
}

View file

@ -40,8 +40,7 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
{
if ($element->getType() != 'Zend_Form_Element_Hidden')
{
$element->setAttrib('readonly',true);
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
$element->setAttrib('disabled','disabled');
}
}
}

View file

@ -66,8 +66,7 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
{
if ($element->getType() != 'Zend_Form_Element_Hidden')
{
$element->setAttrib('readonly',true);
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
$element->setAttrib('disabled','disabled');
}
}
}

View file

@ -119,8 +119,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
{
if ($element->getType() != 'Zend_Form_Element_Hidden')
{
$element->setAttrib('readonly',true);
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
$element->setAttrib('disabled','disabled');
}
}
}
@ -129,8 +128,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$element = $this->getElement('add_show_repeats');
if ($element->getType() != 'Zend_Form_Element_Hidden')
{
$element->setAttrib('readonly',true);
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
$element->setAttrib('disabled','disabled');
}
}
}

View file

@ -33,8 +33,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm
{
if ($element->getType() != 'Zend_Form_Element_Hidden')
{
$element->setAttrib('readonly',true);
$element->setAttribs(array('style' => 'color: #B1B1B1; '));
$element->setAttrib('disabled','disabled');
}
}
}

View file

@ -87,7 +87,8 @@ class Application_Form_EditAudioMD extends Zend_Form
$this->addElement('text', 'bpm', array(
'label' => 'BPM:',
'class' => 'input_text',
'filters' => array('StringTrim')
'filters' => array('StringTrim'),
'validators' => array(array('StringLength', false, array(0, 8)))
));
// Add copyright field

View file

@ -11,7 +11,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$defaultFade = Application_Model_Preference::GetDefaultFade();
if($defaultFade == ""){
$defaultFade = '00.000000';
$defaultFade = '0.500000';
}
//Station name

View file

@ -22,6 +22,30 @@ class Application_Model_Show {
Application_Model_RabbitMq::PushSchedule();
}
public function setAirtimeAuthFlag($flag){
$show = CcShowQuery::create()->findPK($this->_showId);
$show->setDbLiveStreamUsingAirtimeAuth($flag);
$show->save();
}
public function setCustomAuthFlag($flag){
$show = CcShowQuery::create()->findPK($this->_showId);
$show->setDbLiveStreamUsingCustomAuth($flag);
$show->save();
}
public function setCustomUsername($username){
$show = CcShowQuery::create()->findPK($this->_showId);
$show->setDbLiveStreamUser($username);
$show->save();
}
public function setCustomPassword($password){
$show = CcShowQuery::create()->findPK($this->_showId);
$show->setDbLiveStreamPass($password);
$show->save();
}
public function getDescription()
{
$show = CcShowQuery::create()->findPK($this->_showId);

View file

@ -1,7 +1,7 @@
<div id="schedule-add-show" class="tabs ui-widget ui-widget-content block-shadow alpha-block padded">
<div class="button-bar">
<a href="#" id="add-show-close" class="icon-link"><span class="ui-icon ui-icon-circle-close"></span>Close</a>
<button aria-disabled="false" role="button" class="add-show-submit right-floated ui-button ui-widget ui-state-default ui-button-text-icon-primary">
<button data-action="<?php echo isset($this->action) ? $this->action : "add-show" ?>" aria-disabled="false" role="button" class="add-show-submit right-floated ui-button ui-widget ui-state-default ui-button-text-icon-primary">
<span class="ui-icon ui-icon-plusthick"></span>
<span class="ui-button-text"><?php echo ($this->addNewShow ? "Add this show" : "Update show"); ?></span>
</button>
@ -37,7 +37,7 @@
<?php echo $this->style; ?>
</div>
<div class="button-bar bottom">
<button aria-disabled="false" role="button" class="add-show-submit right-floated ui-button ui-widget ui-state-default ui-button-text-icon-primary">
<button data-action="<?php echo isset($this->action) ? $this->action : "add-show" ?>" aria-disabled="false" role="button" class="add-show-submit right-floated ui-button ui-widget ui-state-default ui-button-text-icon-primary">
<span class="ui-icon ui-icon-plusthick"></span>
<span class="ui-button-text"><?php echo ($this->addNewShow ? "Add this show" : "Update show"); ?></span>
</button>

View file

@ -1,5 +1,7 @@
<form id="add-show-form" method="post" action="" style="display:none;">
<?php echo $this->render('schedule/add-show-form.phtml') ?>
<?php if($this->preloadShowForm){
echo $this->render('schedule/add-show-form.phtml');
}?>
</form>
<div id='schedule_calendar' class="ui-widget-content block-shadow padded omega-block"></div>

View file

@ -75,8 +75,9 @@ function open_show_preview(p_showID, p_showIndex) {
}
function openPreviewWindow(url) {
//$.post(baseUri+'Playlist/audio-preview-player', {fileName: fileName, cueIn: cueIn, cueOut: cueOut, fadeIn: fadeIn, fadeInFileName: fadeInFileName, fadeOut: fadeOut, fadeOutFileName: fadeOutFileName})
_preview_window = window.open(url, 'Audio Player', 'width=450,height=800');
_preview_window = window.open(url, 'Audio Player', 'width=450,height=100,scrollbars=yes');
//Set the play button to pause.
//var elemID = "spl_"+elemIndexString;
//$('#'+elemID+' div.list-item-container a span').attr("class", "ui-icon ui-icon-pause");

View file

@ -235,18 +235,4 @@ $(document).ready(function() {
showErrorSections()
setInterval('checkLiquidsoapStatus()', 1000)
$.mask.rules = {
'@': /[^ &<>]/,
'u': /[0-9a-zA-Z-_.:/]/,
'd': /[0-9a-zA-Z-_.]/
}
// add masking on the fields that don't allow special chars
$.mask.masks = $.extend($.mask.masks,{
regular_text:{ mask: '@', type:'repeat', 'maxLength': 256, selectCharsOnFocus: false, autoTab: false, fixedChars : '[(),:/]'},
url:{ mask: 'u', type:'repeat', 'maxLength': 261, selectCharsOnFocus: false, autoTab: false, fixedChars : '[(),]'},
domain:{ mask: 'd', type:'repeat', 'maxLength': 261, selectCharsOnFocus: false, autoTab: false, fixedChars : '[(),:/]'}
})
$('input:text').setMask()
});

View file

@ -321,7 +321,9 @@ function setAddShowEvents() {
applyPlatformOpacityRules: false
});
$.post("/Schedule/add-show", {format: "json", data: data, hosts: hosts, days: days}, function(json){
var action = "/Schedule/"+String(addShowButton.attr("data-action"));
$.post(action, {format: "json", data: data, hosts: hosts, days: days}, function(json){
//addShowButton.removeClass("disabled");
$('#schedule-add-show').unblock();
if(json.form) {
@ -334,6 +336,19 @@ function setAddShowEvents() {
$("#add_show_end_date").val(end_date);
$("#add_show_start_date").val(start_date);
showErrorSections();
}else if(json.edit){
$("#schedule_calendar").removeAttr("style")
.fullCalendar('render');
$("#add-show-form").hide();
$.get("/Schedule/get-form", {format:"json"}, function(json){
$("#add-show-form")
.empty()
.append(json.form);
setAddShowEvents();
});
makeAddShowButton();
}
else {
$("#add-show-form")

View file

@ -20,7 +20,6 @@ function scheduleRefetchEvents(json) {
}
function openAddShowForm() {
if($("#add-show-form").length == 1) {
if( ($("#add-show-form").css('display')=='none')) {
$("#add-show-form").show();
@ -37,13 +36,6 @@ function openAddShowForm() {
$add_show_name.select();
});
}
$.mask.masks = $.extend($.mask.masks,{
date:{ mask: '9999-19-39', selectCharsOnFocus: true, autoTab: false},
time:{ mask: '29:69', selectCharsOnFocus: true, autoTab: false}
});
$('input:text').setMask();
}
function makeAddShowButton(){
@ -99,7 +91,10 @@ function pad(number, length) {
return str;
}
function dayClick(date, allDay, jsEvent, view) {
function dayClick(date, allDay, jsEvent, view){
// The show from will be preloaded if the user is admin or program manager.
// Hence, if the user if DJ then it won't open anything.
if($.trim($("#add-show-form").html()) != ""){
var now, today, selected, chosenDate, chosenTime;
now = adjustDateToServerDate(new Date(), serverTimezoneOffset);
@ -155,6 +150,7 @@ function dayClick(date, allDay, jsEvent, view) {
openAddShowForm();
}
}
}
function viewDisplay( view ) {

View file

@ -176,7 +176,7 @@ function buildContentDialog (json){
dialog.dialog({
autoOpen: false,
title: 'Show Contents',
title: "Contents of Show \"" + json.showTitle + "\"",
width: width,
height: height,
modal: true,

View file

@ -20,7 +20,16 @@ $(document).ready(function(){
height: "0px",
cssClass: "jp-video-270p"
},
wmode: "window"
playlistOptions: {
autoPlay: false,
loopOnPrevious: false,
shuffleOnLoop: true,
enableRemoveControls: false,
displayTime: 0,
addTime: 0,
removeTime: 0,
shuffleTime: 0
}
});
@ -32,6 +41,8 @@ $(document).ready(function(){
var showID = $('.showID').text();
var showIndex = $('.showIndex').text();
var numOfItems = 0;
if (playlistID != "" && playlistID !== ""){
playAllPlaylist(playlistID, playlistIndex);
}else if (audioFileID != "") {
@ -87,6 +98,7 @@ function buildplaylist(p_url, p_playIndex) {
var myPlaylist = new Array();
var media;
var index;
var total = 0;
for(index in data){
if (data[index]['element_mp3'] != undefined){
@ -103,11 +115,17 @@ function buildplaylist(p_url, p_playIndex) {
myPlaylist[index] = media;
_idToPostionLookUp[data[index]['element_id']] = data[index]['element_position'];
total++;
}
_playlist_jplayer.setPlaylist(myPlaylist);
_playlist_jplayer.option("autoPlay", true);
play(p_playIndex);
var height = Math.min(80 + (23 * total), 400);
window.innerWidth = 500;
window.innerHeight = height;
window.scrollbars = true;
});
}
@ -146,4 +164,7 @@ function playOne(p_audioFileID) {
//_playlist_jplayer.setPlaylist(playlist); --if I use this the player will call _init on the setPlaylist and on the ready
_playlist_jplayer._initPlaylist(playlist);
_playlist_jplayer.play(0);
window.innerWidth = 490;
window.innerHeight = 105;
}

File diff suppressed because one or more lines are too long

View file

@ -26,8 +26,7 @@ showhelp () {
--pypo|-p Install only pypo and liquidsoap
--show-recorder|-s Install only show-recorder
--web|-w Install only files for web-server
--liquidsoap-keep-alive|-l Keep Liquidsoap alive when upgrading
--disable-auto-start-services|-d Disable auto-starting Airtime services"
--liquidsoap-keep-alive|-l Keep Liquidsoap alive when upgrading"
}
overwrite="f"
@ -39,9 +38,8 @@ pypo="f"
showrecorder="f"
web="f"
liquidsoap_keep_alive="f"
disable_auto_start_services="f"
set -- $(getopt -l help,overwrite,preserve,no-db,reinstall,media-monitor,pypo,show-recorder,web,liquidsoap-keep-alive,disable-auto-start-services "hopnrmyswld" "$@")
set -- $(getopt -l help,overwrite,preserve,no-db,reinstall,media-monitor,pypo,show-recorder,web,liquidsoap-keep-alive "hopnrmyswl" "$@")
while [ $# -gt 0 ]
do
case "$1" in
@ -55,7 +53,6 @@ do
(-s|--show-recorder) showrecorder="t";;
(-w|--web) web="t";;
(-l|--liquidsoap-keep-alive) liquidsoap_keep_alive="t";;
(-d|--disable-auto-start-services) disable_auto_start_services="t";;
(--) shift; break;;
(-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;;
@ -125,14 +122,15 @@ fi
#We don't want any of our python services running if we are doing an upgrade/reinstall.
#They will be automatically restarted later on.
echo "* Temporarily stopping any previous running services"
if [ -e /etc/init.d/airtime-media-monitor ]; then
/etc/init.d/airtime-media-monitor stop > /dev/null 2>&1
invoke-rc.d airtime-media-monitor stop > /dev/null 2>&1
fi
if [ -e /etc/init.d/airtime-playout ]; then
/etc/init.d/airtime-playout stop > /dev/null 2>&1
invoke-rc.d airtime-playout stop > /dev/null 2>&1
fi
if [ -e /etc/init.d/airtime-show-recorder ]; then
/etc/init.d/airtime-show-recorder stop > /dev/null 2>&1
invoke-rc.d airtime-show-recorder stop > /dev/null 2>&1
fi
@ -147,7 +145,6 @@ export nodb
export overwrite
export preserve
export liquidsoap_keep_alive
export disable_auto_start_services
set +e
test "$mediamonitor" = "t" -o "$pypo" = "t" -o "$showrecorder" = "t"

View file

@ -46,24 +46,19 @@ fi
# so we can ensure they can register with monit to monitor them when they start.
# If monit is already running, this step is still useful as we need monit to
# reload its config files.
/etc/init.d/monit restart
invoke-rc.d monit restart
#give monit some time to boot-up before issuing commands
sleep 1
set +e
if [ "$disable_auto_start_services" = "f" ]; then
if [ "$mediamonitor" = "t" ]; then
if [ "$mediamonitor" = "t" ]; then
monit monitor airtime-media-monitor
fi
if [ "$pypo" = "t" ]; then
fi
if [ "$pypo" = "t" ]; then
monit monitor airtime-playout
monit monitor airtime-liquidsoap
fi
# if [ "$showrecorder" = "t" ]; then
# monit monitor airtime-show-recorder
# fi
fi
monit monitor rabbitmq-server

View file

@ -5,4 +5,14 @@
class AirtimeMiscUpgrade{
public static function start(){
}
public static function adjustMonitCfgPermissions(){
/* Make the read permission of Monit cfg files more strict */
chmod("/etc/monit/conf.d/monit-airtime-generic.cfg", 0600);
chmod("/etc/monit/conf.d/monit-airtime-liquidsoap.cfg", 0600);
chmod("/etc/monit/conf.d/monit-airtime-media-monitor.cfg", 0600);
chmod("/etc/monit/conf.d/monit-airtime-playout.cfg", 0600);
chmod("/etc/monit/conf.d/monit-airtime-rabbitmq-server.cfg", 0600);
}
}

View file

@ -15,6 +15,7 @@ cd ${media_monitor_path}
exec 2>&1
export PYTHONPATH=${api_client_path}
export PATH=/usr/lib/airtime/pypo/bin/liquidsoap_bin/:$PATH
# Note the -u when calling python! we need it to get unbuffered binary stdout and stderr
exec python -u ${media_monitor_path}${media_monitor_script} > /var/log/airtime/media-monitor/py-interpreter.log 2>&1

View file

@ -135,18 +135,17 @@ class AirtimeMediaMonitorBootstrap():
for file_path in deleted_files_set:
self.logger.debug("deleted file")
full_file_path = "%s%s" % (dir, file_path)
full_file_path = os.path.join(dir, file_path)
self.logger.debug(full_file_path)
self.pe.handle_removed_file(False, full_file_path)
for file_path in new_files_set:
self.logger.debug("new file")
full_file_path = "%s%s" % (dir, file_path)
full_file_path = os.path.join(dir, file_path)
self.logger.debug(full_file_path)
if os.path.exists(full_file_path):
organized_filepath = self.pe.handle_created_file(False, full_file_path, os.path.basename(full_file_path))
if organized_filepath is not None:
self.pe.handle_created_file(False, organized_filepath, os.path.basename(organized_filepath))
self.pe.handle_created_file(False, full_file_path, os.path.basename(full_file_path))
for file_path in modified_files_set:
self.logger.debug("modified file")

View file

@ -137,14 +137,11 @@ class AirtimeProcessEvent(ProcessEvent):
if self.mmc.is_parent_directory(pathname, self.config.organize_directory):
#file was created in /srv/airtime/stor/organize. Need to process and move
#to /srv/airtime/stor/imported
new_filepath = self.mmc.organize_new_file(pathname)
return new_filepath
else:
pathname = self.mmc.organize_new_file(pathname)
name = os.path.basename(pathname)
self.mmc.set_needed_file_permissions(pathname, dir)
if self.mmc.is_parent_directory(pathname, self.config.recorded_directory):
is_recorded = True
else :
is_recorded = False
is_recorded = self.mmc.is_parent_directory(pathname, self.config.recorded_directory)
self.file_events.append({'mode': self.config.MODE_CREATE, 'filepath': pathname, 'is_recorded_show': is_recorded})
else:

View file

@ -3,6 +3,7 @@ import grp
import pwd
import logging
import stat
import subprocess
from subprocess import Popen, PIPE
from airtimemetadata import AirtimeMetadata
@ -289,3 +290,16 @@ class MediaMonitorCommon:
self.logger.warn("File %s, has invalid metadata", pathname)
return filepath
def test_file_playability(pathname):
"""
Test if the file can be played by Liquidsoap. Return "True" if Liquidsoap
can play it, or if Liquidsoap is not found.
"""
liquidsoap_found = subprocess.call("which liquidsoap", shell=True)
if liquidsoap_found == 0:
return_code = subprocess.call("liquidsoap -c 'output.dummy(single(\"%s\"))'" % pathname, shell=True)
else:
return_code = 0
return (return_code == 0)

View file

@ -1,12 +1,20 @@
from mediaconfig import AirtimeMediaConfig
import mediamonitorcommon
class MediaMonitorWorkerProcess:
#this function is run in its own process, and continuously
#checks the queue for any new file events.
def process_file_events(self, queue, notifier):
while True:
try:
event = queue.get()
if event['mode'] == AirtimeMediaConfig.MODE_CREATE:
filepath = event['filepath']
if mediamonitorcommon.test_file_playability(filepath):
notifier.logger.info("received event %s", event)
notifier.update_airtime(event)
else:
notifier.logger.warn("Liquidsoap integrity check for file at %s failed. Not adding to media library.", filepath)
except Exception, e:
notifier.logger.error(e)

View file

@ -50,7 +50,7 @@ try:
#copy monit files
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
subprocess.call('sed -i "s/\$admin_pass/%s/g" /etc/monit/conf.d/monit-airtime-generic.cfg' % get_rand_string(), shell=True)
if os.environ["disable_auto_start_services"] == "f":
shutil.copy('%s/../monit-airtime-media-monitor.cfg'%current_script_dir, '/etc/monit/conf.d/')
#create log dir

View file

@ -9,7 +9,7 @@ try:
#create media-monitor dir under /var/tmp/airtime
if not os.path.exists("/var/tmp/airtime/media-monitor"):
os.makedirs("/var/tmp/airtime/media-monitor")
if os.environ["disable_auto_start_services"] == "f":
#update-rc.d init script
p = Popen("update-rc.d airtime-media-monitor defaults >/dev/null 2>&1", shell=True)
sts = os.waitpid(p.pid, 0)[1]
@ -17,10 +17,10 @@ try:
#Start media-monitor daemon
print "* Waiting for media-monitor processes to start..."
"""
p = Popen("/etc/init.d/airtime-media-monitor stop", shell=True)
p = Popen("invoke-rc.d airtime-media-monitor stop", shell=True)
sts = os.waitpid(p.pid, 0)[1]
"""
p = Popen("/etc/init.d/airtime-media-monitor start-no-monit", shell=True)
p = Popen("invoke-rc.d airtime-media-monitor start-no-monit", shell=True)
sts = os.waitpid(p.pid, 0)[1]
except Exception, e:
print e

View file

@ -51,7 +51,7 @@ try:
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/')
subprocess.call('sed -i "s/\$admin_pass/%s/g" /etc/monit/conf.d/monit-airtime-generic.cfg' % get_rand_string(), shell=True)
shutil.copy('%s/../../monit/monit-airtime-rabbitmq-server.cfg'%current_script_dir, '/etc/monit/conf.d/')
if os.environ["disable_auto_start_services"] == "f":
shutil.copy('%s/../monit-airtime-liquidsoap.cfg'%current_script_dir, '/etc/monit/conf.d/')
shutil.copy('%s/../monit-airtime-playout.cfg'%current_script_dir, '/etc/monit/conf.d/')

View file

@ -111,24 +111,17 @@ try:
else:
print "Unable to connect to the Airtime server."
if os.environ["disable_auto_start_services"] == "f":
#initialize init.d scripts
p = Popen("update-rc.d airtime-playout defaults >/dev/null 2>&1", shell=True)
sts = os.waitpid(p.pid, 0)[1]
#restart airtime-playout
#clear out an previous pypo cache
print "* Clearing previous pypo cache"
p = Popen("rm -rf '/var/tmp/airtime/pypo/cache/scheduler/*' >/dev/null 2>&1", shell=True)
sts = os.waitpid(p.pid, 0)[1]
print "* Waiting for pypo processes to start..."
"""
if os.environ["liquidsoap_keep_alive"] == "f":
print " * Restarting any previous Liquidsoap instances"
p = Popen("/etc/init.d/airtime-playout stop > /dev/null 2>&1", shell=True)
sts = os.waitpid(p.pid, 0)[1]
else:
print " * Keeping any previous Liquidsoap instances running"
p = Popen("/etc/init.d/airtime-playout pypo-stop > /dev/null 2>&1", shell=True)
sts = os.waitpid(p.pid, 0)[1]
"""
p = Popen("/etc/init.d/airtime-playout start-no-monit > /dev/null 2>&1", shell=True)
p = Popen("invoke-rc.d airtime-playout start-no-monit > /dev/null 2>&1", shell=True)
sts = os.waitpid(p.pid, 0)[1]
except Exception, e:

View file

@ -10,7 +10,7 @@ try:
#stop pypo and liquidsoap processes
print "Waiting for pypo processes to stop...",
if (os.path.exists('/etc/init.d/airtime-playout')):
p = Popen("/etc/init.d/airtime-playout stop", shell=True)
p = Popen("invoke-rc.d airtime-playout stop", shell=True)
sts = os.waitpid(p.pid, 0)[1]
print "OK"
else:

View file

@ -30,7 +30,7 @@ try:
print 'Error loading config file: ', e
sys.exit(1)
os.system("/etc/init.d/airtime-playout stop")
os.system("invoke-rc.d airtime-playout stop")
os.system("rm -f /etc/init.d/airtime-playout")
os.system("update-rc.d -f airtime-playout remove >/dev/null 2>&1")

View file

@ -183,9 +183,14 @@ class PypoPush(Thread):
problem_at_iteration = None
for queue_item in liquidsoap_queue_approx:
if queue_item['start'] in media_schedule.keys():
if queue_item['id'] == media_schedule[queue_item['start']]['id']:
media_item = media_schedule[queue_item['start']]
if queue_item['id'] == media_item['id']:
if queue_item['end'] == media_item['end']:
#Everything OK for this iteration.
pass
else:
problem_at_iteration = iteration
break
else:
#A different item has been scheduled at the same time! Need to remove
#all tracks from the Liquidsoap queue starting at this point, and re-add
@ -204,7 +209,7 @@ class PypoPush(Thread):
#The first item in the Liquidsoap queue (the one that is currently playing)
#has changed or been removed from the schedule. We need to clear the entire
#queue, and push the new schedule
self.logger.debug("Problem at iteration %s", problem_at_iteration)
self.logger.debug("Change in link %s of current chain", problem_at_iteration)
self.remove_from_liquidsoap_queue(problem_at_iteration, liquidsoap_queue_approx)
return problem_at_iteration