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

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

View file

@ -58,7 +58,8 @@ class ApiController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
$api_key = $this->_getParam('api_key'); $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'); header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.'; 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'); $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'); header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource. '; print 'You are not allowed to access this resource. ';
@ -355,7 +357,8 @@ class ApiController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
$api_key = $this->_getParam('api_key'); $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'); header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.'; print 'You are not allowed to access this resource.';
@ -378,7 +381,8 @@ class ApiController extends Zend_Controller_Action
global $CC_CONFIG; global $CC_CONFIG;
$api_key = $this->_getParam('api_key'); $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'); header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.'; print 'You are not allowed to access this resource.';
@ -411,7 +415,8 @@ class ApiController extends Zend_Controller_Action
global $CC_CONFIG; global $CC_CONFIG;
$api_key = $this->_getParam('api_key'); $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'); header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.'; print 'You are not allowed to access this resource.';
@ -435,7 +440,8 @@ class ApiController extends Zend_Controller_Action
global $CC_CONFIG; global $CC_CONFIG;
$api_key = $this->_getParam('api_key'); $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'); header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.'; print 'You are not allowed to access this resource.';
@ -542,7 +548,8 @@ class ApiController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender(true); $this->_helper->viewRenderer->setNoRender(true);
$api_key = $this->_getParam('api_key'); $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'); header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.'; print 'You are not allowed to access this resource.';
@ -564,7 +571,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest(); $request = $this->getRequest();
$api_key = $request->getParam('api_key'); $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'); header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.'; print 'You are not allowed to access this resource.';
@ -667,7 +675,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest(); $request = $this->getRequest();
$api_key = $request->getParam('api_key'); $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'); header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.'; print 'You are not allowed to access this resource.';
@ -683,7 +692,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest(); $request = $this->getRequest();
$api_key = $request->getParam('api_key'); $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'); header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.'; 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'); $api_key = $request->getParam('api_key');
$path = base64_decode($request->getParam('path')); $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'); header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.'; 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'); $api_key = $request->getParam('api_key');
$path = base64_decode($request->getParam('path')); $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'); header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.'; 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'); $api_key = $request->getParam('api_key');
$path = base64_decode($request->getParam('path')); $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'); header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.'; print 'You are not allowed to access this resource.';
@ -760,7 +773,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest(); $request = $this->getRequest();
$api_key = $request->getParam('api_key'); $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'); header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.'; print 'You are not allowed to access this resource.';
@ -777,14 +791,13 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest(); $request = $this->getRequest();
$api_key = $request->getParam('api_key'); $api_key = $request->getParam('api_key');
$getDiskInfo = $request->getParam('diskinfo') == "true"; $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'); header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.'; print 'You are not allowed to access this resource.';
exit; exit;
} }
*/
$status = array( $status = array(
"platform"=>Application_Model_Systemstatus::GetPlatformInfo(), "platform"=>Application_Model_Systemstatus::GetPlatformInfo(),
@ -846,7 +859,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest(); $request = $this->getRequest();
$api_key = $request->getParam('api_key'); $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'); header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.'; print 'You are not allowed to access this resource.';
@ -926,7 +940,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest(); $request = $this->getRequest();
$api_key = $request->getParam('api_key'); $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'); header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.'; print 'You are not allowed to access this resource.';
@ -945,7 +960,8 @@ class ApiController extends Zend_Controller_Action
$request = $this->getRequest(); $request = $this->getRequest();
$api_key = $request->getParam('api_key'); $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'); header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.'; print 'You are not allowed to access this resource.';
@ -979,7 +995,8 @@ class ApiController extends Zend_Controller_Action
$password = $request->getParam('password'); $password = $request->getParam('password');
$djtype = $request->getParam('djtype'); $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'); header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.'; print 'You are not allowed to access this resource.';

View file

@ -142,7 +142,6 @@ class PreferenceController extends Zend_Controller_Action
$baseUrl = $request->getBaseUrl(); $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/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 // get current settings
$temp = Application_Model_StreamSetting::getStreamSetting(); $temp = Application_Model_StreamSetting::getStreamSetting();
@ -236,7 +235,7 @@ class PreferenceController extends Zend_Controller_Action
$live_stream_subform->updateConnectionURLs(); $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->num_stream = $num_of_stream;
$this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf(); $this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf();
@ -261,16 +260,18 @@ class PreferenceController extends Zend_Controller_Action
else else
{ {
$path = $path.'/'; $path = $path.'/';
$handle = opendir($path); $handle = opendir($path);
while (false !== ($file = readdir($handle))) { if ($handle !== false){
if ($file != "." && $file != "..") { while (false !== ($file = readdir($handle))) {
//only show directories that aren't private. if ($file != "." && $file != "..") {
if (is_dir($path.$file) && substr($file, 0, 1) != ".") { //only show directories that aren't private.
$element = array(); if (is_dir($path.$file) && substr($file, 0, 1) != ".") {
$element["name"] = $file; $element = array();
$element["isFolder"] = true; $element["name"] = $file;
$element["isError"] = false; $element["isFolder"] = true;
$result[$file] = $element; $element["isError"] = false;
$result[$file] = $element;
}
} }
} }
} }

View file

@ -28,6 +28,8 @@ class ScheduleController extends Zend_Controller_Action
->addActionContext('content-context-menu', 'json') ->addActionContext('content-context-menu', 'json')
->addActionContext('set-time-scale', 'json') ->addActionContext('set-time-scale', 'json')
->addActionContext('set-time-interval', 'json') ->addActionContext('set-time-interval', 'json')
->addActionContext('edit-show-instance', 'json')
->addActionContext('dj-edit-show', 'json')
->initContext(); ->initContext();
$this->sched_sess = new Zend_Session_Namespace("schedule"); $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/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/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->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']); $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(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id); $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().";"); $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->percentFilled = $show->getPercentScheduled();
$this->view->showContent = $show->getShowListContent(); $this->view->showContent = $show->getShowListContent();
$this->view->dialog = $this->view->render('schedule/show-content-dialog.phtml'); $this->view->dialog = $this->view->render('schedule/show-content-dialog.phtml');
$this->view->showTitle = $show->getName();
unset($this->view->showContent); 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" // repeating shows. It's value is either "instance","rebroadcast", or "all"
$type = $this->_getParam('type'); $type = $this->_getParam('type');
if ($type == "instance"){
$this->view->action = "edit-show-instance";
}
try{ try{
$showInstance = new Application_Model_ShowInstance($showInstanceId); $showInstance = new Application_Model_ShowInstance($showInstanceId);
}catch(Exception $e){ }catch(Exception $e){
@ -457,6 +466,10 @@ class ScheduleController extends Zend_Controller_Action
if(!($isAdminOrPM || $isDJ)) { if(!($isAdminOrPM || $isDJ)) {
return; return;
} }
if($isDJ){
$this->view->action = "dj-edit-show";
}
$formWhat = new Application_Form_AddShowWhat(); $formWhat = new Application_Form_AddShowWhat();
$formWho = new Application_Form_AddShowWho(); $formWho = new Application_Form_AddShowWho();
@ -604,10 +617,50 @@ class ScheduleController extends Zend_Controller_Action
} }
public function getFormAction(){ public function getFormAction(){
Application_Model_Schedule::createNewFormSections($this->view); if($user->isUserType(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)){
$this->view->form = $this->view->render('schedule/add-show-form.phtml'); 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() public function addShowAction()
{ {
$js = $this->_getParam('data'); $js = $this->_getParam('data');
@ -619,13 +672,6 @@ class ScheduleController extends Zend_Controller_Action
} }
$show = new Application_Model_Show($data['add_show_id']); $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; $startDateModified = true;
if ($data['add_show_id'] != -1 && !array_key_exists('add_show_start_date', $data)){ 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 //show is being updated and changing the start date was disabled, since the
@ -642,6 +688,11 @@ class ScheduleController extends Zend_Controller_Action
if($data['add_show_day_check'] == "") { if($data['add_show_day_check'] == "") {
$data['add_show_day_check'] = null; $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; $isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
$record = false; $record = false;
@ -785,7 +836,7 @@ class ScheduleController extends Zend_Controller_Action
if (!$startDateModified){ if (!$startDateModified){
$formWhen->getElement('add_show_start_date')->setOptions(array('disabled' => true)); $formWhen->getElement('add_show_start_date')->setOptions(array('disabled' => true));
} }
$this->view->form = $this->view->render('schedule/add-show-form.phtml'); $this->view->form = $this->view->render('schedule/add-show-form.phtml');
} }

View file

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

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."; $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 = 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) ->setDescription($description1)
->setRequired(false) ->setRequired(false)
->setDecorators(array('ViewHelper')); ->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."; $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 = new Zend_Form_Element_Checkbox("cb_custom_auth");
$cb_custom_auth ->setLabel("Custom") $cb_custom_auth ->setLabel("Use Custom Authentication")
->setDescription($description2) ->setDescription($description2)
->setRequired(false) ->setRequired(false)
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -21,6 +21,30 @@ class Application_Model_Show {
$show->setDbName($name); $show->setDbName($name);
Application_Model_RabbitMq::PushSchedule(); 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() public function getDescription()
{ {

View file

@ -1,7 +1,7 @@
<div id="schedule-add-show" class="tabs ui-widget ui-widget-content block-shadow alpha-block padded"> <div id="schedule-add-show" class="tabs ui-widget ui-widget-content block-shadow alpha-block padded">
<div class="button-bar"> <div class="button-bar">
<a href="#" id="add-show-close" class="icon-link"><span class="ui-icon ui-icon-circle-close"></span>Close</a> <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-icon ui-icon-plusthick"></span>
<span class="ui-button-text"><?php echo ($this->addNewShow ? "Add this show" : "Update show"); ?></span> <span class="ui-button-text"><?php echo ($this->addNewShow ? "Add this show" : "Update show"); ?></span>
</button> </button>
@ -37,7 +37,7 @@
<?php echo $this->style; ?> <?php echo $this->style; ?>
</div> </div>
<div class="button-bar bottom"> <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-icon ui-icon-plusthick"></span>
<span class="ui-button-text"><?php echo ($this->addNewShow ? "Add this show" : "Update show"); ?></span> <span class="ui-button-text"><?php echo ($this->addNewShow ? "Add this show" : "Update show"); ?></span>
</button> </button>

View file

@ -1,5 +1,7 @@
<form id="add-show-form" method="post" action="" style="display:none;"> <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> </form>
<div id='schedule_calendar' class="ui-widget-content block-shadow padded omega-block"></div> <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) { function openPreviewWindow(url) {
//$.post(baseUri+'Playlist/audio-preview-player', {fileName: fileName, cueIn: cueIn, cueOut: cueOut, fadeIn: fadeIn, fadeInFileName: fadeInFileName, fadeOut: fadeOut, fadeOutFileName: fadeOutFileName}) //$.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. //Set the play button to pause.
//var elemID = "spl_"+elemIndexString; //var elemID = "spl_"+elemIndexString;
//$('#'+elemID+' div.list-item-container a span').attr("class", "ui-icon ui-icon-pause"); //$('#'+elemID+' div.list-item-container a span').attr("class", "ui-icon ui-icon-pause");

View file

@ -235,18 +235,4 @@ $(document).ready(function() {
showErrorSections() showErrorSections()
setInterval('checkLiquidsoapStatus()', 1000) 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

@ -320,8 +320,10 @@ function setAddShowEvents() {
message: null, message: null,
applyPlatformOpacityRules: false applyPlatformOpacityRules: false
}); });
var action = "/Schedule/"+String(addShowButton.attr("data-action"));
$.post("/Schedule/add-show", {format: "json", data: data, hosts: hosts, days: days}, function(json){ $.post(action, {format: "json", data: data, hosts: hosts, days: days}, function(json){
//addShowButton.removeClass("disabled"); //addShowButton.removeClass("disabled");
$('#schedule-add-show').unblock(); $('#schedule-add-show').unblock();
if(json.form) { if(json.form) {
@ -334,6 +336,19 @@ function setAddShowEvents() {
$("#add_show_end_date").val(end_date); $("#add_show_end_date").val(end_date);
$("#add_show_start_date").val(start_date); $("#add_show_start_date").val(start_date);
showErrorSections(); 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 { else {
$("#add-show-form") $("#add-show-form")

View file

@ -20,7 +20,6 @@ function scheduleRefetchEvents(json) {
} }
function openAddShowForm() { function openAddShowForm() {
if($("#add-show-form").length == 1) { if($("#add-show-form").length == 1) {
if( ($("#add-show-form").css('display')=='none')) { if( ($("#add-show-form").css('display')=='none')) {
$("#add-show-form").show(); $("#add-show-form").show();
@ -37,13 +36,6 @@ function openAddShowForm() {
$add_show_name.select(); $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(){ function makeAddShowButton(){
@ -99,61 +91,65 @@ function pad(number, length) {
return str; return str;
} }
function dayClick(date, allDay, jsEvent, view) { function dayClick(date, allDay, jsEvent, view){
var now, today, selected, chosenDate, chosenTime; // 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.
now = adjustDateToServerDate(new Date(), serverTimezoneOffset); if($.trim($("#add-show-form").html()) != ""){
var now, today, selected, chosenDate, chosenTime;
if(view.name === "month") { now = adjustDateToServerDate(new Date(), serverTimezoneOffset);
today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
selected = new Date(date.getFullYear(), date.getMonth(), date.getDate()); if(view.name === "month") {
} today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
else { selected = new Date(date.getFullYear(), date.getMonth(), date.getDate());
today = new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes());
selected = new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes());
}
if(selected >= today) {
var addShow = $('.add-button');
//remove the +show button if it exists.
if(addShow.length == 1){
var span = $(addShow).parent();
$(span).prev().remove();
$(span).remove();
} }
else {
// get current duration value on the form today = new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes());
var duration_string = $.trim($("#add_show_duration").val()); selected = new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes());
var duration_info = duration_string.split(" ");
var duration_h = 0;
var duration_m = 0;
if(duration_info[0] != null){
duration_h = parseInt(duration_info[0], 10);
} }
if(duration_info[1] != null){
duration_m = parseInt(duration_info[1], 10); if(selected >= today) {
var addShow = $('.add-button');
//remove the +show button if it exists.
if(addShow.length == 1){
var span = $(addShow).parent();
$(span).prev().remove();
$(span).remove();
}
// get current duration value on the form
var duration_string = $.trim($("#add_show_duration").val());
var duration_info = duration_string.split(" ");
var duration_h = 0;
var duration_m = 0;
if(duration_info[0] != null){
duration_h = parseInt(duration_info[0], 10);
}
if(duration_info[1] != null){
duration_m = parseInt(duration_info[1], 10);
}
// duration in milisec
var duration = (duration_h * 60 * 60 * 1000) + (duration_m * 60 * 1000);
// get start time value on the form
var startTime_string = $("#add_show_start_time").val();
var startTime_info = startTime_string.split(':');
var startTime = (parseInt(startTime_info[0],10) * 60 * 60 * 1000) + (parseInt(startTime_info[1], 10) * 60 * 1000);
// calculate endDateTime
var endDateTime = new Date(selected.getTime() + startTime + duration);
chosenDate = selected.getFullYear() + '-' + pad(selected.getMonth()+1,2) + '-' + pad(selected.getDate(),2);
var endDateFormat = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth()+1,2) + '-' + pad(endDateTime.getDate(),2);
$("#add_show_start_date").val(chosenDate);
$("#add_show_end_date_no_repeat").val(endDateFormat);
$("#add_show_end_date").val(endDateFormat);
$("#schedule-show-when").show();
openAddShowForm();
} }
// duration in milisec
var duration = (duration_h * 60 * 60 * 1000) + (duration_m * 60 * 1000);
// get start time value on the form
var startTime_string = $("#add_show_start_time").val();
var startTime_info = startTime_string.split(':');
var startTime = (parseInt(startTime_info[0],10) * 60 * 60 * 1000) + (parseInt(startTime_info[1], 10) * 60 * 1000);
// calculate endDateTime
var endDateTime = new Date(selected.getTime() + startTime + duration);
chosenDate = selected.getFullYear() + '-' + pad(selected.getMonth()+1,2) + '-' + pad(selected.getDate(),2);
var endDateFormat = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth()+1,2) + '-' + pad(endDateTime.getDate(),2);
$("#add_show_start_date").val(chosenDate);
$("#add_show_end_date_no_repeat").val(endDateFormat);
$("#add_show_end_date").val(endDateFormat);
$("#schedule-show-when").show();
openAddShowForm();
} }
} }

View file

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

View file

@ -20,7 +20,16 @@ $(document).ready(function(){
height: "0px", height: "0px",
cssClass: "jp-video-270p" 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 showID = $('.showID').text();
var showIndex = $('.showIndex').text(); var showIndex = $('.showIndex').text();
var numOfItems = 0;
if (playlistID != "" && playlistID !== ""){ if (playlistID != "" && playlistID !== ""){
playAllPlaylist(playlistID, playlistIndex); playAllPlaylist(playlistID, playlistIndex);
}else if (audioFileID != "") { }else if (audioFileID != "") {
@ -87,6 +98,7 @@ function buildplaylist(p_url, p_playIndex) {
var myPlaylist = new Array(); var myPlaylist = new Array();
var media; var media;
var index; var index;
var total = 0;
for(index in data){ for(index in data){
if (data[index]['element_mp3'] != undefined){ if (data[index]['element_mp3'] != undefined){
@ -103,11 +115,17 @@ function buildplaylist(p_url, p_playIndex) {
myPlaylist[index] = media; myPlaylist[index] = media;
_idToPostionLookUp[data[index]['element_id']] = data[index]['element_position']; _idToPostionLookUp[data[index]['element_id']] = data[index]['element_position'];
total++;
} }
_playlist_jplayer.setPlaylist(myPlaylist); _playlist_jplayer.setPlaylist(myPlaylist);
_playlist_jplayer.option("autoPlay", true); _playlist_jplayer.option("autoPlay", true);
play(p_playIndex); 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.setPlaylist(playlist); --if I use this the player will call _init on the setPlaylist and on the ready
_playlist_jplayer._initPlaylist(playlist); _playlist_jplayer._initPlaylist(playlist);
_playlist_jplayer.play(0); _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 --pypo|-p Install only pypo and liquidsoap
--show-recorder|-s Install only show-recorder --show-recorder|-s Install only show-recorder
--web|-w Install only files for web-server --web|-w Install only files for web-server
--liquidsoap-keep-alive|-l Keep Liquidsoap alive when upgrading --liquidsoap-keep-alive|-l Keep Liquidsoap alive when upgrading"
--disable-auto-start-services|-d Disable auto-starting Airtime services"
} }
overwrite="f" overwrite="f"
@ -39,9 +38,8 @@ pypo="f"
showrecorder="f" showrecorder="f"
web="f" web="f"
liquidsoap_keep_alive="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 ] while [ $# -gt 0 ]
do do
case "$1" in case "$1" in
@ -55,7 +53,6 @@ do
(-s|--show-recorder) showrecorder="t";; (-s|--show-recorder) showrecorder="t";;
(-w|--web) web="t";; (-w|--web) web="t";;
(-l|--liquidsoap-keep-alive) liquidsoap_keep_alive="t";; (-l|--liquidsoap-keep-alive) liquidsoap_keep_alive="t";;
(-d|--disable-auto-start-services) disable_auto_start_services="t";;
(--) shift; break;; (--) shift; break;;
(-*) echo "$0: error - unrecognized option $1" 1>&2; exit 1;; (-*) 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. #We don't want any of our python services running if we are doing an upgrade/reinstall.
#They will be automatically restarted later on. #They will be automatically restarted later on.
echo "* Temporarily stopping any previous running services"
if [ -e /etc/init.d/airtime-media-monitor ]; then 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 fi
if [ -e /etc/init.d/airtime-playout ]; then 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 fi
if [ -e /etc/init.d/airtime-show-recorder ]; then 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 fi
@ -147,7 +145,6 @@ export nodb
export overwrite export overwrite
export preserve export preserve
export liquidsoap_keep_alive export liquidsoap_keep_alive
export disable_auto_start_services
set +e set +e
test "$mediamonitor" = "t" -o "$pypo" = "t" -o "$showrecorder" = "t" 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. # 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 # If monit is already running, this step is still useful as we need monit to
# reload its config files. # reload its config files.
/etc/init.d/monit restart invoke-rc.d monit restart
#give monit some time to boot-up before issuing commands #give monit some time to boot-up before issuing commands
sleep 1 sleep 1
set +e set +e
if [ "$disable_auto_start_services" = "f" ]; then if [ "$mediamonitor" = "t" ]; then
if [ "$mediamonitor" = "t" ]; then monit monitor airtime-media-monitor
monit monitor airtime-media-monitor fi
fi if [ "$pypo" = "t" ]; then
if [ "$pypo" = "t" ]; then monit monitor airtime-playout
monit monitor airtime-playout monit monitor airtime-liquidsoap
monit monitor airtime-liquidsoap
fi
# if [ "$showrecorder" = "t" ]; then
# monit monitor airtime-show-recorder
# fi
fi fi
monit monitor rabbitmq-server monit monitor rabbitmq-server

View file

@ -5,4 +5,14 @@
class AirtimeMiscUpgrade{ class AirtimeMiscUpgrade{
public static function start(){ 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 exec 2>&1
export PYTHONPATH=${api_client_path} 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 # 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 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: for file_path in deleted_files_set:
self.logger.debug("deleted file") 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.logger.debug(full_file_path)
self.pe.handle_removed_file(False, full_file_path) self.pe.handle_removed_file(False, full_file_path)
for file_path in new_files_set: for file_path in new_files_set:
self.logger.debug("new file") 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) self.logger.debug(full_file_path)
if os.path.exists(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)) 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))
for file_path in modified_files_set: for file_path in modified_files_set:
self.logger.debug("modified file") self.logger.debug("modified file")

View file

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

View file

@ -3,6 +3,7 @@ import grp
import pwd import pwd
import logging import logging
import stat import stat
import subprocess
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
from airtimemetadata import AirtimeMetadata from airtimemetadata import AirtimeMetadata
@ -289,3 +290,16 @@ class MediaMonitorCommon:
self.logger.warn("File %s, has invalid metadata", pathname) self.logger.warn("File %s, has invalid metadata", pathname)
return filepath 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: class MediaMonitorWorkerProcess:
#this function is run in its own process, and continuously #this function is run in its own process, and continuously
#checks the queue for any new file events. #checks the queue for any new file events.
def process_file_events(self, queue, notifier): def process_file_events(self, queue, notifier):
while True: while True:
event = queue.get() try:
notifier.logger.info("received event %s", event) event = queue.get()
notifier.update_airtime(event) 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,8 +50,8 @@ try:
#copy monit files #copy monit files
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/') 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) 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/') shutil.copy('%s/../monit-airtime-media-monitor.cfg'%current_script_dir, '/etc/monit/conf.d/')
#create log dir #create log dir
create_dir(config['log_dir']) create_dir(config['log_dir'])

View file

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

View file

@ -51,9 +51,9 @@ try:
shutil.copy('%s/../../monit/monit-airtime-generic.cfg'%current_script_dir, '/etc/monit/conf.d/') 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) 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/') 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-liquidsoap.cfg'%current_script_dir, '/etc/monit/conf.d/')
shutil.copy('%s/../monit-airtime-playout.cfg'%current_script_dir, '/etc/monit/conf.d/') shutil.copy('%s/../monit-airtime-playout.cfg'%current_script_dir, '/etc/monit/conf.d/')
#create pypo log dir #create pypo log dir
create_dir(config['pypo_log_dir']) create_dir(config['pypo_log_dir'])

View file

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

View file

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

View file

@ -30,7 +30,7 @@ try:
print 'Error loading config file: ', e print 'Error loading config file: ', e
sys.exit(1) 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("rm -f /etc/init.d/airtime-playout")
os.system("update-rc.d -f airtime-playout remove >/dev/null 2>&1") 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 problem_at_iteration = None
for queue_item in liquidsoap_queue_approx: for queue_item in liquidsoap_queue_approx:
if queue_item['start'] in media_schedule.keys(): 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']]
#Everything OK for this iteration. if queue_item['id'] == media_item['id']:
pass if queue_item['end'] == media_item['end']:
#Everything OK for this iteration.
pass
else:
problem_at_iteration = iteration
break
else: else:
#A different item has been scheduled at the same time! Need to remove #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 #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) #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 #has changed or been removed from the schedule. We need to clear the entire
#queue, and push the new schedule #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) self.remove_from_liquidsoap_queue(problem_at_iteration, liquidsoap_queue_approx)
return problem_at_iteration return problem_at_iteration