Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
9b30d53626
|
@ -37,7 +37,7 @@ $pages = array(
|
|||
'resource' => 'schedule'
|
||||
),
|
||||
array(
|
||||
'label' => 'Configure',
|
||||
'label' => 'System',
|
||||
'uri' => '#',
|
||||
'resource' => 'preference',
|
||||
'pages' => array(
|
||||
|
@ -70,6 +70,13 @@ $pages = array(
|
|||
'module' => 'default',
|
||||
'controller' => 'Preference',
|
||||
'action' => 'support-setting'
|
||||
),
|
||||
array(
|
||||
'label' => 'Status',
|
||||
'module' => 'default',
|
||||
'controller' => 'systemstatus',
|
||||
'action' => 'index',
|
||||
'resource' => 'systemstatus'
|
||||
)
|
||||
)
|
||||
),
|
||||
|
@ -79,18 +86,16 @@ $pages = array(
|
|||
'resource' => 'dashboard',
|
||||
'pages' => array(
|
||||
array(
|
||||
'label' => 'About',
|
||||
'label' => 'Getting Started',
|
||||
'module' => 'default',
|
||||
'controller' => 'dashboard',
|
||||
'action' => 'help',
|
||||
'resource' => 'dashboard'
|
||||
'resource' => 'dashboard'
|
||||
),
|
||||
array(
|
||||
'label' => 'System Status',
|
||||
'module' => 'default',
|
||||
'controller' => 'systemstatus',
|
||||
'action' => 'index',
|
||||
'resource' => 'systemstatus'
|
||||
'label' => 'User Manual',
|
||||
'uri' => "http://en.flossmanuals.net/airtime/",
|
||||
'target' => "_blank"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -106,15 +106,17 @@ class PreferenceController extends Zend_Controller_Action
|
|||
|
||||
public function directoryConfigAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/serverbrowse/serverbrowser.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/musicdirs.js','text/javascript');
|
||||
|
||||
$watched_dirs_pref = new Application_Form_WatchedDirPreferences();
|
||||
|
||||
$this->view->form = $watched_dirs_pref;
|
||||
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/serverbrowse/serverbrowser.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/musicdirs.js','text/javascript');
|
||||
|
||||
$watched_dirs_pref = new Application_Form_WatchedDirPreferences();
|
||||
|
||||
$this->view->form = $watched_dirs_pref;
|
||||
}
|
||||
}
|
||||
|
||||
public function streamSettingAction()
|
||||
|
@ -186,6 +188,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
$this->view->num_stream = $num_of_stream;
|
||||
$this->view->disable_stream_conf = Application_Model_Preference::GetDisableStreamConf();
|
||||
$this->view->form = $form;
|
||||
}
|
||||
|
||||
|
|
|
@ -389,6 +389,8 @@ class ScheduleController extends Zend_Controller_Action
|
|||
if(!$user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
return;
|
||||
}
|
||||
|
||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||
|
||||
$showInstanceId = $this->_getParam('id');
|
||||
|
||||
|
@ -397,27 +399,18 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$formWhen = new Application_Form_AddShowWhen();
|
||||
$formRepeats = new Application_Form_AddShowRepeats();
|
||||
$formStyle = new Application_Form_AddShowStyle();
|
||||
$formRecord = new Application_Form_AddShowRR();
|
||||
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
||||
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
||||
|
||||
$formWhat->removeDecorator('DtDdWrapper');
|
||||
$formWho->removeDecorator('DtDdWrapper');
|
||||
$formWhen->removeDecorator('DtDdWrapper');
|
||||
$formRepeats->removeDecorator('DtDdWrapper');
|
||||
$formStyle->removeDecorator('DtDdWrapper');
|
||||
$formRecord->removeDecorator('DtDdWrapper');
|
||||
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
||||
$formRebroadcast->removeDecorator('DtDdWrapper');
|
||||
|
||||
$this->view->what = $formWhat;
|
||||
$this->view->when = $formWhen;
|
||||
$this->view->repeats = $formRepeats;
|
||||
$this->view->who = $formWho;
|
||||
$this->view->style = $formStyle;
|
||||
$this->view->rr = $formRecord;
|
||||
$this->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||
$this->view->rebroadcast = $formRebroadcast;
|
||||
$this->view->addNewShow = false;
|
||||
|
||||
$showInstance = new ShowInstance($showInstanceId);
|
||||
|
@ -461,42 +454,55 @@ class ScheduleController extends Zend_Controller_Action
|
|||
'add_show_end_date' => $displayedEndDate->format("Y-m-d"),
|
||||
'add_show_no_end' => ($show->getRepeatingEndDate() == '')));
|
||||
|
||||
$formRecord->populate(array('add_show_record' => $show->isRecorded(),
|
||||
'add_show_rebroadcast' => $show->isRebroadcast()));
|
||||
$formRecord->getElement('add_show_record')->setOptions(array('disabled' => true));
|
||||
|
||||
|
||||
|
||||
$rebroadcastsRelative = $show->getRebroadcastsRelative();
|
||||
$rebroadcastFormValues = array();
|
||||
$i = 1;
|
||||
foreach ($rebroadcastsRelative as $rebroadcast){
|
||||
$rebroadcastFormValues["add_show_rebroadcast_date_$i"] = $rebroadcast['day_offset'];
|
||||
$rebroadcastFormValues["add_show_rebroadcast_time_$i"] = DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
|
||||
$i++;
|
||||
}
|
||||
$formRebroadcast->populate($rebroadcastFormValues);
|
||||
|
||||
$rebroadcastsAbsolute = $show->getRebroadcastsAbsolute();
|
||||
$rebroadcastAbsoluteFormValues = array();
|
||||
$i = 1;
|
||||
foreach ($rebroadcastsAbsolute as $rebroadcast){
|
||||
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_date_absolute_$i"] = $rebroadcast['start_date'];
|
||||
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_time_absolute_$i"] = DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
|
||||
$i++;
|
||||
}
|
||||
$formAbsoluteRebroadcast->populate($rebroadcastAbsoluteFormValues);
|
||||
|
||||
$hosts = array();
|
||||
$showHosts = CcShowHostsQuery::create()->filterByDbShow($showInstance->getShowId())->find();
|
||||
foreach($showHosts as $showHost){
|
||||
array_push($hosts, $showHost->getDbHost());
|
||||
}
|
||||
$formWho->populate(array('add_show_hosts' => $hosts));
|
||||
|
||||
|
||||
$formStyle->populate(array('add_show_background_color' => $show->getBackgroundColor(),
|
||||
'add_show_color' => $show->getColor()));
|
||||
|
||||
if(!$isSaas){
|
||||
$formRecord = new Application_Form_AddShowRR();
|
||||
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
||||
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
||||
|
||||
$formRecord->removeDecorator('DtDdWrapper');
|
||||
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
||||
$formRebroadcast->removeDecorator('DtDdWrapper');
|
||||
|
||||
$this->view->rr = $formRecord;
|
||||
$this->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||
$this->view->rebroadcast = $formRebroadcast;
|
||||
|
||||
$formRecord->populate(array('add_show_record' => $show->isRecorded(),
|
||||
'add_show_rebroadcast' => $show->isRebroadcast()));
|
||||
|
||||
$formRecord->getElement('add_show_record')->setOptions(array('disabled' => true));
|
||||
|
||||
|
||||
|
||||
$rebroadcastsRelative = $show->getRebroadcastsRelative();
|
||||
$rebroadcastFormValues = array();
|
||||
$i = 1;
|
||||
foreach ($rebroadcastsRelative as $rebroadcast){
|
||||
$rebroadcastFormValues["add_show_rebroadcast_date_$i"] = $rebroadcast['day_offset'];
|
||||
$rebroadcastFormValues["add_show_rebroadcast_time_$i"] = DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
|
||||
$i++;
|
||||
}
|
||||
$formRebroadcast->populate($rebroadcastFormValues);
|
||||
|
||||
$rebroadcastsAbsolute = $show->getRebroadcastsAbsolute();
|
||||
$rebroadcastAbsoluteFormValues = array();
|
||||
$i = 1;
|
||||
foreach ($rebroadcastsAbsolute as $rebroadcast){
|
||||
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_date_absolute_$i"] = $rebroadcast['start_date'];
|
||||
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_time_absolute_$i"] = DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
|
||||
$i++;
|
||||
}
|
||||
$formAbsoluteRebroadcast->populate($rebroadcastAbsoluteFormValues);
|
||||
}
|
||||
|
||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||
$this->view->entries = 5;
|
||||
|
@ -533,24 +539,21 @@ class ScheduleController extends Zend_Controller_Action
|
|||
if($data['add_show_day_check'] == "") {
|
||||
$data['add_show_day_check'] = null;
|
||||
}
|
||||
|
||||
|
||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||
$record = false;
|
||||
|
||||
$formWhat = new Application_Form_AddShowWhat();
|
||||
$formWho = new Application_Form_AddShowWho();
|
||||
$formWhen = new Application_Form_AddShowWhen();
|
||||
$formRepeats = new Application_Form_AddShowRepeats();
|
||||
$formStyle = new Application_Form_AddShowStyle();
|
||||
$formRecord = new Application_Form_AddShowRR();
|
||||
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
||||
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
||||
|
||||
$formWhat->removeDecorator('DtDdWrapper');
|
||||
$formWho->removeDecorator('DtDdWrapper');
|
||||
$formWhen->removeDecorator('DtDdWrapper');
|
||||
$formRepeats->removeDecorator('DtDdWrapper');
|
||||
$formStyle->removeDecorator('DtDdWrapper');
|
||||
$formRecord->removeDecorator('DtDdWrapper');
|
||||
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
||||
$formRebroadcast->removeDecorator('DtDdWrapper');
|
||||
|
||||
$what = $formWhat->isValid($data);
|
||||
$when = $formWhen->isValid($data);
|
||||
|
@ -581,70 +584,96 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$data["add_show_duration"] = $hValue.":".$mValue;
|
||||
|
||||
if(!$isSaas){
|
||||
$formRecord = new Application_Form_AddShowRR();
|
||||
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
||||
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
||||
|
||||
$formRecord->removeDecorator('DtDdWrapper');
|
||||
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
||||
$formRebroadcast->removeDecorator('DtDdWrapper');
|
||||
|
||||
//If show is a new show (not updated), then get
|
||||
//isRecorded from POST data. Otherwise get it from
|
||||
//the database since the user is not allowed to
|
||||
//update this option.
|
||||
if ($data['add_show_id'] != -1){
|
||||
$data['add_show_record'] = $show->isRecorded();
|
||||
$record = $formRecord->isValid($data);
|
||||
$formRecord->getElement('add_show_record')->setOptions(array('disabled' => true));
|
||||
} else {
|
||||
$record = $formRecord->isValid($data);
|
||||
}
|
||||
}
|
||||
|
||||
if($data["add_show_repeats"]) {
|
||||
$repeats = $formRepeats->isValid($data);
|
||||
if($repeats) {
|
||||
$repeats = $formRepeats->checkReliantFields($data);
|
||||
}
|
||||
|
||||
$formAbsoluteRebroadcast->reset();
|
||||
//make it valid, results don't matter anyways.
|
||||
$rebroadAb = 1;
|
||||
|
||||
if ($data["add_show_rebroadcast"]) {
|
||||
$rebroad = $formRebroadcast->isValid($data);
|
||||
if($rebroad) {
|
||||
$rebroad = $formRebroadcast->checkReliantFields($data);
|
||||
if(!$isSaas){
|
||||
$formAbsoluteRebroadcast->reset();
|
||||
//make it valid, results don't matter anyways.
|
||||
$rebroadAb = 1;
|
||||
|
||||
if ($data["add_show_rebroadcast"]) {
|
||||
$rebroad = $formRebroadcast->isValid($data);
|
||||
if($rebroad) {
|
||||
$rebroad = $formRebroadcast->checkReliantFields($data);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$rebroad = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$rebroad = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$formRebroadcast->reset();
|
||||
//make it valid, results don't matter anyways.
|
||||
$repeats = 1;
|
||||
$rebroad = 1;
|
||||
|
||||
if ($data["add_show_rebroadcast"]) {
|
||||
$rebroadAb = $formAbsoluteRebroadcast->isValid($data);
|
||||
if($rebroadAb) {
|
||||
$rebroadAb = $formAbsoluteRebroadcast->checkReliantFields($data);
|
||||
if(!$isSaas){
|
||||
$formRebroadcast->reset();
|
||||
//make it valid, results don't matter anyways.
|
||||
$rebroad = 1;
|
||||
|
||||
if ($data["add_show_rebroadcast"]) {
|
||||
$rebroadAb = $formAbsoluteRebroadcast->isValid($data);
|
||||
if($rebroadAb) {
|
||||
$rebroadAb = $formAbsoluteRebroadcast->checkReliantFields($data);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$rebroadAb = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$rebroadAb = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$who = $formWho->isValid($data);
|
||||
$style = $formStyle->isValid($data);
|
||||
|
||||
//If show is a new show (not updated), then get
|
||||
//isRecorded from POST data. Otherwise get it from
|
||||
//the database since the user is not allowed to
|
||||
//update this option.
|
||||
$record = false;
|
||||
if ($data['add_show_id'] != -1){
|
||||
$data['add_show_record'] = $show->isRecorded();
|
||||
$record = $formRecord->isValid($data);
|
||||
$formRecord->getElement('add_show_record')->setOptions(array('disabled' => true));
|
||||
} else {
|
||||
$record = $formRecord->isValid($data);
|
||||
}
|
||||
|
||||
if ($what && $when && $repeats && $who && $style && $record && $rebroadAb && $rebroad) {
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new User($userInfo->id);
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
Show::create($data);
|
||||
if ($what && $when && $repeats && $who && $style) {
|
||||
if(!$isSaas){
|
||||
if($record && $rebroadAb && $rebroad){
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new User($userInfo->id);
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
Show::create($data);
|
||||
}
|
||||
|
||||
//send back a new form for the user.
|
||||
Schedule::createNewFormSections($this->view);
|
||||
|
||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||
}
|
||||
}else{
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new User($userInfo->id);
|
||||
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
Show::create($data);
|
||||
}
|
||||
|
||||
//send back a new form for the user.
|
||||
Schedule::createNewFormSections($this->view);
|
||||
|
||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||
}
|
||||
|
||||
//send back a new form for the user.
|
||||
Schedule::createNewFormSections($this->view);
|
||||
|
||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||
}
|
||||
else {
|
||||
$this->view->what = $formWhat;
|
||||
|
@ -652,9 +681,11 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$this->view->repeats = $formRepeats;
|
||||
$this->view->who = $formWho;
|
||||
$this->view->style = $formStyle;
|
||||
$this->view->rr = $formRecord;
|
||||
$this->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||
$this->view->rebroadcast = $formRebroadcast;
|
||||
if(!$isSaas){
|
||||
$this->view->rr = $formRecord;
|
||||
$this->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||
$this->view->rebroadcast = $formRebroadcast;
|
||||
}
|
||||
$this->view->addNewShow = true;
|
||||
|
||||
//the form still needs to be "update" since
|
||||
|
|
|
@ -18,8 +18,11 @@ class Application_Form_StreamSetting extends Zend_Form
|
|||
$output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device');
|
||||
$output_sound_device->setLabel('Enabled')
|
||||
->setRequired(false)
|
||||
->setValue($setting['output_sound_device'])
|
||||
->setValue(($setting['output_sound_device'] == "true")?1:0)
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if(Application_Model_Preference::GetDisableStreamConf() == "true"){
|
||||
$output_sound_device->setAttrib("readonly", true);
|
||||
}
|
||||
$this->addElement($output_sound_device);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,10 +36,18 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
|||
$this->setIsArray(true);
|
||||
$this->setElementsBelongTo($prefix."_data");
|
||||
|
||||
$disable_all = false;
|
||||
if(Application_Model_Preference::GetDisableStreamConf() == "true"){
|
||||
$disable_all = true;
|
||||
}
|
||||
|
||||
$enable = new Zend_Form_Element_Checkbox('enable');
|
||||
$enable->setLabel('Enabled:')
|
||||
->setValue($setting[$prefix.'_output'] != 'disabled'?1:0)
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$enable->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($enable);
|
||||
|
||||
$type = new Zend_Form_Element_Select('type');
|
||||
|
@ -47,6 +55,9 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
|||
->setMultiOptions($stream_types)
|
||||
->setValue(isset($setting[$prefix.'_type'])?$setting[$prefix.'_type']:0)
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$type->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($type);
|
||||
|
||||
$bitrate = new Zend_Form_Element_Select('bitrate');
|
||||
|
@ -54,6 +65,10 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
|||
->setMultiOptions($stream_bitrates)
|
||||
->setValue(isset($setting[$prefix.'_bitrate'])?$setting[$prefix.'_bitrate']:0)
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$bitrate->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($type);
|
||||
$this->addElement($bitrate);
|
||||
|
||||
$output = new Zend_Form_Element_Select('output');
|
||||
|
@ -61,58 +76,81 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
|||
->setMultiOptions(array("icecast"=>"Icecast", "shoutcast"=>"Shoutcast"))
|
||||
->setValue(isset($setting[$prefix.'_output'])?$setting[$prefix.'_output']:"icecast")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$output->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($output);
|
||||
|
||||
$host = new Zend_Form_Element_Text('host');
|
||||
$host->setLabel("Server")
|
||||
->setValue(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$host->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($host);
|
||||
|
||||
$port = new Zend_Form_Element_Text('port');
|
||||
$port->setLabel("Port")
|
||||
->setValue(isset($setting[$prefix.'_port'])?$setting[$prefix.'_port']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$port->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($port);
|
||||
|
||||
$pass = new Zend_Form_Element_Text('pass');
|
||||
$pass->setLabel("Password")
|
||||
->setValue(isset($setting[$prefix.'_pass'])?$setting[$prefix.'_pass']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$pass->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($pass);
|
||||
|
||||
$genre = new Zend_Form_Element_Text('genre');
|
||||
$genre->setLabel("Genre")
|
||||
->setValue(isset($setting[$prefix.'_genre'])?$setting[$prefix.'_genre']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$genre->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($genre);
|
||||
|
||||
$url = new Zend_Form_Element_Text('url');
|
||||
$url->setLabel("URL")
|
||||
->setValue(isset($setting[$prefix.'_url'])?$setting[$prefix.'_url']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$url->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($url);
|
||||
|
||||
$description = new Zend_Form_Element_Text('description');
|
||||
$description->setLabel("Name/Description")
|
||||
->setValue(isset($setting[$prefix.'_description'])?$setting[$prefix.'_description']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$description->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($description);
|
||||
|
||||
$mount_info = array();
|
||||
if(isset($setting[$prefix.'_mount'])){
|
||||
$mount_info = explode('.',$setting[$prefix.'_mount']);
|
||||
}
|
||||
$mount = new Zend_Form_Element_Text('mount');
|
||||
$mount->setLabel("Mount Point")
|
||||
->setValue(isset($mount_info[0])?$mount_info[0]:"")
|
||||
->setValue(isset($setting[$prefix.'_mount'])?$setting[$prefix.'_mount']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$mount->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($mount);
|
||||
|
||||
$user = new Zend_Form_Element_Text('user');
|
||||
$user->setLabel("Username")
|
||||
->setValue(isset($setting[$prefix.'_user'])?$setting[$prefix.'_user']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$user->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($user);
|
||||
|
||||
$this->setDecorators(array(
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<div id="Panel">
|
||||
<div class="logo"></div>
|
||||
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs())) ?>
|
||||
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs(), "is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining())) ?>
|
||||
|
||||
<?php $partial = array('menu.phtml', 'default');
|
||||
$this->navigation()->menu()->setPartial($partial); ?>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<div id="Panel">
|
||||
<div class="logo"></div>
|
||||
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs())) ?>
|
||||
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs(), "is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining())) ?>
|
||||
|
||||
<?php $partial = array('menu.phtml', 'default');
|
||||
$this->navigation()->menu()->setPartial($partial); ?>
|
||||
|
|
|
@ -410,5 +410,29 @@ class Application_Model_Preference
|
|||
public static function GetMaxBitrate(){
|
||||
return Application_Model_Preference::GetValue("max_bitrate");
|
||||
}
|
||||
|
||||
public static function SetPlanLevel($plan){
|
||||
Application_Model_Preference::SetValue("plan_level", $plan);
|
||||
}
|
||||
|
||||
public static function GetPlanLevel(){
|
||||
return Application_Model_Preference::GetValue("plan_level");
|
||||
}
|
||||
|
||||
public static function SetTrialEndingDate($date){
|
||||
Application_Model_Preference::SetValue("trial_end_date", $date);
|
||||
}
|
||||
|
||||
public static function GetTrialEndingDate(){
|
||||
return Application_Model_Preference::GetValue("trial_end_date");
|
||||
}
|
||||
|
||||
public static function SetDisableStreamConf($bool){
|
||||
Application_Model_Preference::SetValue("disable_stream_conf", $bool);
|
||||
}
|
||||
|
||||
public static function GetDisableStreamConf(){
|
||||
return Application_Model_Preference::GetValue("disable_stream_conf");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -750,33 +750,25 @@ class Schedule {
|
|||
}
|
||||
|
||||
public static function createNewFormSections($p_view){
|
||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||
|
||||
$formWhat = new Application_Form_AddShowWhat();
|
||||
$formWho = new Application_Form_AddShowWho();
|
||||
$formWhen = new Application_Form_AddShowWhen();
|
||||
$formRepeats = new Application_Form_AddShowRepeats();
|
||||
$formStyle = new Application_Form_AddShowStyle();
|
||||
$formRecord = new Application_Form_AddShowRR();
|
||||
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
||||
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
||||
|
||||
$formWhat->removeDecorator('DtDdWrapper');
|
||||
$formWho->removeDecorator('DtDdWrapper');
|
||||
$formWhen->removeDecorator('DtDdWrapper');
|
||||
$formRepeats->removeDecorator('DtDdWrapper');
|
||||
$formStyle->removeDecorator('DtDdWrapper');
|
||||
$formRecord->removeDecorator('DtDdWrapper');
|
||||
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
||||
$formRebroadcast->removeDecorator('DtDdWrapper');
|
||||
|
||||
$p_view->what = $formWhat;
|
||||
$p_view->when = $formWhen;
|
||||
$p_view->repeats = $formRepeats;
|
||||
$p_view->who = $formWho;
|
||||
$p_view->style = $formStyle;
|
||||
$p_view->rr = $formRecord;
|
||||
$p_view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||
$p_view->rebroadcast = $formRebroadcast;
|
||||
$p_view->addNewShow = true;
|
||||
|
||||
$formWhat->populate(array('add_show_id' => '-1'));
|
||||
$formWhen->populate(array('add_show_start_date' => date("Y-m-d"),
|
||||
|
@ -786,6 +778,21 @@ class Schedule {
|
|||
'add_show_duration' => '1h'));
|
||||
|
||||
$formRepeats->populate(array('add_show_end_date' => date("Y-m-d")));
|
||||
|
||||
if(!$isSaas){
|
||||
$formRecord = new Application_Form_AddShowRR();
|
||||
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
||||
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
||||
|
||||
$formRecord->removeDecorator('DtDdWrapper');
|
||||
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
||||
$formRebroadcast->removeDecorator('DtDdWrapper');
|
||||
|
||||
$p_view->rr = $formRecord;
|
||||
$p_view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||
$p_view->rebroadcast = $formRebroadcast;
|
||||
}
|
||||
$p_view->addNewShow = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -770,7 +770,7 @@ class Show {
|
|||
|
||||
$showId = $ccShow->getDbId();
|
||||
|
||||
$isRecorded = ($data['add_show_record']) ? 1 : 0;
|
||||
$isRecorded = (isset($data['add_show_record']) && $data['add_show_record']) ? 1 : 0;
|
||||
|
||||
if ($data['add_show_id'] != -1){
|
||||
$show = new Show($showId);
|
||||
|
@ -804,8 +804,7 @@ class Show {
|
|||
|
||||
$utcStartDateTime->add(new DateInterval("P".$daysAdd."D"));
|
||||
}
|
||||
|
||||
if (is_null($endDateTime) || $utcStartDateTime->getTimestamp <= $endDateTime->getTimestamp()) {
|
||||
if (is_null($endDateTime) || $utcStartDateTime->getTimestamp() <= $endDateTime->getTimestamp()) {
|
||||
$showDay = new CcShowDays();
|
||||
$showDay->setDbFirstShow($utcStartDateTime->format("Y-m-d"));
|
||||
$showDay->setDbLastShow($endDate);
|
||||
|
|
|
@ -30,6 +30,7 @@ class Application_Model_StreamSetting {
|
|||
$v = 'disabled';
|
||||
}
|
||||
}
|
||||
$v = trim($v);
|
||||
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$keyname'";
|
||||
$CC_DBC->query($sql);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
class Airtime_View_Helper_IsSaas extends Zend_View_Helper_Abstract{
|
||||
public function isSaas(){
|
||||
$plan = Application_Model_Preference::GetPlanLevel();
|
||||
if($plan == 'disabled'){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
class Airtime_View_Helper_IsTrial extends Zend_View_Helper_Abstract{
|
||||
public function isTrial(){
|
||||
$plan = Application_Model_Preference::GetPlanLevel();
|
||||
if($plan == 'trial'){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
class Airtime_View_Helper_TrialRemaining extends Zend_View_Helper_Abstract
|
||||
{
|
||||
public function trialRemaining()
|
||||
{
|
||||
$ending_date = Application_Model_Preference::GetTrialEndingDate();
|
||||
$datetime1 = new DateTime();
|
||||
$datetime2 = new DateTime($ending_date);
|
||||
$interval = $datetime1->diff($datetime2);
|
||||
if($interval->format('%R') == '-'){
|
||||
return "Trial expired.";
|
||||
}
|
||||
return $interval->format('%a days');
|
||||
}
|
||||
}
|
|
@ -11,6 +11,6 @@
|
|||
<li>Select your playlist and drag and drop it to the "Items in this show" area.</li>
|
||||
</ol>
|
||||
<p><strong>Then you're good to go!</strong><br />
|
||||
For more detailed help, read the <a href="http://manuals.sourcefabric.org">user manual</a></p>
|
||||
For more detailed help, read the <a href="http://manuals.sourcefabric.org" target="_blank">user manual</a>.</p>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
<?php
|
||||
$isSaas = true;
|
||||
if(Application_Model_Preference::GetPlanLevel() == "disabled"){
|
||||
$isSaas = false;
|
||||
}
|
||||
?>
|
||||
<ul id="nav">
|
||||
<?php foreach ($this->container as $page) : ?>
|
||||
<?php if($this->navigation()->accept($page)) : ?>
|
||||
|
@ -7,9 +13,12 @@
|
|||
<span class="down"><?php echo $page->getLabel(); ?></span>
|
||||
</a>
|
||||
<ul class="sub">
|
||||
<?php foreach ($page->getPages() as $sub) : ?>
|
||||
<?php foreach ($page->getPages() as $sub) :
|
||||
if($isSaas && $sub->getLabel() == "Manage Media Folders"){
|
||||
continue;
|
||||
} ?>
|
||||
<li>
|
||||
<a href="<?php echo $sub->getHref(); ?>"><?php echo $sub->getLabel(); ?></a>
|
||||
<a href="<?php echo $sub->getHref(); ?>" <?php echo ($sub->getTarget() != "")?"target=\"".$sub->getTarget()."\"":""; ?>><?php echo $sub->getLabel(); ?></a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
|
|
|
@ -30,6 +30,14 @@
|
|||
<li class="time-zone"><span id="time-zone"></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php if($this->is_trial){?>
|
||||
<div class="trial-info-block">
|
||||
<ul>
|
||||
<li>Trial remaining</li>
|
||||
<li><?php echo $this->trial_remain?></li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="personal-block">
|
||||
<ul>
|
||||
<li><a id="about-link" href="#">About</a></li>
|
||||
|
|
|
@ -18,8 +18,10 @@
|
|||
echo $this->form->getSubform("s".$i."_subform");
|
||||
}
|
||||
?>
|
||||
<?php if($this->disable_stream_conf != "true"){?>
|
||||
<div class="button-bar bottom" id="submit-element">
|
||||
<input type="submit" class="ui-button ui-state-default right-floated" value="Save" id="Save" name="Save" />
|
||||
</div>
|
||||
<?php }?>
|
||||
</form>
|
||||
</div>
|
|
@ -16,12 +16,14 @@
|
|||
<?php echo $this->when; ?>
|
||||
<?php echo $this->repeats; ?>
|
||||
</div>
|
||||
<?php if(!$this->isSaas()){?>
|
||||
<h3 class="collapsible-header"><span class="arrow-icon"></span>Record & Rebroadcast</h3>
|
||||
<div id="schedule-record-rebroadcast" class="collapsible-content">
|
||||
<?php echo $this->rr; ?>
|
||||
<?php echo $this->absoluteRebroadcast; ?>
|
||||
<?php echo $this->rebroadcast; ?>
|
||||
</div>
|
||||
<?php }?>
|
||||
<h3 class="collapsible-header"><span class="arrow-icon"></span>Who</h3>
|
||||
<div id="schedule-show-who" class="collapsible-content">
|
||||
<?php echo $this->who; ?>
|
||||
|
|
|
@ -5,8 +5,10 @@ INSERT INTO cc_pref("keystr", "valstr") VALUES('stream_type', 'ogg, mp3');
|
|||
INSERT INTO cc_pref("keystr", "valstr") VALUES('stream_bitrate', '24, 32, 48, 64, 96, 128, 160, 192, 224, 256, 320');
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('num_of_streams', '3');
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('max_bitrate', '320');
|
||||
INSERT INTO cc_pref("keystr", "valstr") VALUES('plan_level', 'disabled');
|
||||
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_sound_device', 'false', 'boolean');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('icecast_vorbis_metadata', 'false', 'boolean');
|
||||
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_output', 'icecast', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_type', 'ogg', 'string');
|
||||
|
|
|
@ -82,7 +82,7 @@ select {
|
|||
position:relative;
|
||||
}
|
||||
|
||||
.now-playing-block, .show-block, .on-air-block, .time-info-block, .personal-block, .listen-control-block {
|
||||
.now-playing-block, .show-block, .on-air-block, .time-info-block, .personal-block, .listen-control-block, .trial-info-block {
|
||||
height:100px;
|
||||
float:left;
|
||||
margin-right:10px;
|
||||
|
|
|
@ -9,7 +9,7 @@ function showErrorSections() {
|
|||
});
|
||||
}
|
||||
function rebuildStreamURL(ele){
|
||||
div = ele.closest("div")
|
||||
var div = ele.closest("div")
|
||||
host = div.find("input:[id$=-host]").val()
|
||||
port = div.find("input:[id$=-port]").val()
|
||||
mount = div.find("input:[id$=-mount]").val()
|
||||
|
@ -27,19 +27,36 @@ function rebuildStreamURL(ele){
|
|||
}
|
||||
div.find("#stream_url").html(streamurl)
|
||||
}
|
||||
|
||||
function restrictOggBitrate(ele, on){
|
||||
var div = ele.closest("div")
|
||||
if(on){
|
||||
div.find("select[id$=data-bitrate]").find("option[value='48']").attr('selected','selected');
|
||||
div.find("select[id$=data-bitrate]").find("option[value='24']").attr("disabled","disabled");
|
||||
div.find("select[id$=data-bitrate]").find("option[value='32']").attr("disabled","disabled");
|
||||
}else{
|
||||
div.find("select[id$=data-bitrate]").find("option[value='24']").attr("disabled","");
|
||||
div.find("select[id$=data-bitrate]").find("option[value='32']").attr("disabled","");
|
||||
}
|
||||
}
|
||||
function hideForShoutcast(ele){
|
||||
ele.closest("div").find("#outputMountpoint-label").hide()
|
||||
ele.closest("div").find("#outputMountpoint-element").hide()
|
||||
ele.closest("div").find("#outputUser-label").hide()
|
||||
ele.closest("div").find("#outputUser-element").hide()
|
||||
var div = ele.closest("div")
|
||||
div.find("#outputMountpoint-label").hide()
|
||||
div.find("#outputMountpoint-element").hide()
|
||||
div.find("#outputUser-label").hide()
|
||||
div.find("#outputUser-element").hide()
|
||||
div.find("select[id$=data-type]").find("option[value='mp3']").attr('selected','selected');
|
||||
div.find("select[id$=data-type]").find("option[value='ogg']").attr("disabled","disabled");
|
||||
|
||||
restrictOggBitrate(ele, false)
|
||||
}
|
||||
|
||||
function showForIcecast(ele){
|
||||
ele.closest("div").find("#outputMountpoint-label").show()
|
||||
ele.closest("div").find("#outputMountpoint-element").show()
|
||||
ele.closest("div").find("#outputUser-label").show()
|
||||
ele.closest("div").find("#outputUser-element").show()
|
||||
var div = ele.closest("div")
|
||||
div.find("#outputMountpoint-label").show()
|
||||
div.find("#outputMountpoint-element").show()
|
||||
div.find("#outputUser-label").show()
|
||||
div.find("#outputUser-element").show()
|
||||
div.find("select[id$=data-type]").find("option[value='ogg']").attr("disabled","");
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
@ -62,7 +79,21 @@ $(document).ready(function() {
|
|||
return false;
|
||||
}).next().hide();
|
||||
|
||||
$("select[id$=-output]").change(function(){
|
||||
$("select[id$=data-type]").change(function(){
|
||||
if($(this).val() == 'ogg'){
|
||||
restrictOggBitrate($(this), true)
|
||||
}else{
|
||||
restrictOggBitrate($(this), false)
|
||||
}
|
||||
})
|
||||
|
||||
$("select[id$=data-type]").each(function(){
|
||||
if($(this).val() == 'ogg'){
|
||||
restrictOggBitrate($(this), true)
|
||||
}
|
||||
})
|
||||
|
||||
$("select[id$=data-output]").change(function(){
|
||||
if($(this).val() == 'shoutcast'){
|
||||
hideForShoutcast($(this))
|
||||
}else{
|
||||
|
@ -70,7 +101,7 @@ $(document).ready(function() {
|
|||
}
|
||||
})
|
||||
|
||||
$("select[id$=-output]").each(function(){
|
||||
$("select[id$=data-output]").each(function(){
|
||||
if($(this).val() == 'shoutcast'){
|
||||
hideForShoutcast($(this))
|
||||
}
|
||||
|
|
|
@ -51,12 +51,15 @@ class AirtimeInstall{
|
|||
{
|
||||
global $CC_DBC;
|
||||
|
||||
echo "* Setting up default stream setting".PHP_EOL;
|
||||
$sql = "INSERT INTO cc_pref(keystr, valstr) VALUES('stream_type', 'ogg, mp3');
|
||||
INSERT INTO cc_pref(keystr, valstr) VALUES('stream_bitrate', '24, 32, 48, 64, 96, 128, 160, 192, 224, 256, 320');
|
||||
INSERT INTO cc_pref(keystr, valstr) VALUES('num_of_streams', '3');
|
||||
INSERT INTO cc_pref(keystr, valstr) VALUES('max_bitrate', '128');
|
||||
INSERT INTO cc_pref(keystr, valstr) VALUES('plan_level', 'disabled');
|
||||
|
||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('output_sound_device', 'false', 'boolean');
|
||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('icecast_vorbis_metadata', 'false', 'boolean');
|
||||
|
||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_output', 'icecast', 'string');
|
||||
INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s1_type', 'ogg', 'string');
|
||||
|
@ -135,6 +138,79 @@ class AirtimeInstall{
|
|||
}
|
||||
return true;
|
||||
}
|
||||
public static function GetOldLiquidsoapCfgAndUpdate(){
|
||||
global $CC_DBC;
|
||||
echo "* Retrieving old liquidsoap configuration".PHP_EOL;
|
||||
$map = array();
|
||||
$fh = fopen("/etc/airtime/liquidsoap.cfg", 'r');
|
||||
$newConfigMap = array();
|
||||
|
||||
while(!feof($fh)){
|
||||
$line = fgets($fh);
|
||||
if(substr(trim($line), 0, 1) == '#' || trim($line) == ""){
|
||||
continue;
|
||||
}else{
|
||||
$info = explode('=', $line, 2);
|
||||
$map[trim($info[0])] = trim($info[1]);
|
||||
}
|
||||
}
|
||||
$newConfigMap['output_sound_device'] = $map['output_sound_device'];
|
||||
$newConfigMap['icecast_vorbis_metadata'] = $map['output_icecast_vorbis_metadata'];
|
||||
$newConfigMap['log_file'] = $map['log_file'];
|
||||
|
||||
$count = 1;
|
||||
if( $map['output_icecast_vorbis'] == 'true'){
|
||||
$newConfigMap['s'.$count.'_output'] = 'icecast';
|
||||
$newConfigMap['s'.$count.'_host'] = $map['icecast_host'];
|
||||
$newConfigMap['s'.$count.'_port'] = $map['icecast_port'];
|
||||
$newConfigMap['s'.$count.'_pass'] = $map['icecast_pass'];
|
||||
$newConfigMap['s'.$count.'_mount'] = $map['mount_point_vorbis'];
|
||||
$newConfigMap['s'.$count.'_url'] = $map['icecast_url'];
|
||||
$newConfigMap['s'.$count.'_description'] = $map['icecast_description'];
|
||||
$newConfigMap['s'.$count.'_genre'] = $map['icecast_genre'];
|
||||
$newConfigMap['s'.$count.'_type'] = "ogg";
|
||||
$newConfigMap['s'.$count.'_bitrate'] = "128";
|
||||
$count++;
|
||||
}
|
||||
if($map['output_icecast_mp3'] == 'true'){
|
||||
$newConfigMap['s'.$count.'_output'] = 'icecast';
|
||||
$newConfigMap['s'.$count.'_host'] = $map['icecast_host'];
|
||||
$newConfigMap['s'.$count.'_port'] = $map['icecast_port'];
|
||||
$newConfigMap['s'.$count.'_pass'] = $map['icecast_pass'];
|
||||
$newConfigMap['s'.$count.'_mount'] = $map['mount_point_mp3'];
|
||||
$newConfigMap['s'.$count.'_url'] = $map['icecast_url'];
|
||||
$newConfigMap['s'.$count.'_description'] = $map['icecast_description'];
|
||||
$newConfigMap['s'.$count.'_genre'] = $map['icecast_genre'];
|
||||
$newConfigMap['s'.$count.'_type'] = "mp3";
|
||||
$newConfigMap['s'.$count.'_bitrate'] = "128";
|
||||
$count++;
|
||||
}
|
||||
if($map['output_shoutcast'] == 'true'){
|
||||
$newConfigMap['s'.$count.'_output'] = 'shoutcast';
|
||||
$newConfigMap['s'.$count.'_host'] = $map['shoutcast_host'];
|
||||
$newConfigMap['s'.$count.'_port'] = $map['shoutcast_port'];
|
||||
$newConfigMap['s'.$count.'_pass'] = $map['shoutcast_pass'];
|
||||
$newConfigMap['s'.$count.'_url'] = $map['shoutcast_url'];
|
||||
$newConfigMap['s'.$count.'_genre'] = $map['shoutcast_genre'];
|
||||
$newConfigMap['s'.$count.'_type'] = "mp3";
|
||||
$newConfigMap['s'.$count.'_bitrate'] = "128";
|
||||
$count++;
|
||||
}
|
||||
|
||||
$sql = "";
|
||||
foreach( $newConfigMap as $key=>$val){
|
||||
if(substr($val, 0, 1) == '"' && substr($val, strlen($val)-1,1)){
|
||||
$val = ltrim($val, '"');
|
||||
$val = rtrim($val, '"');
|
||||
}
|
||||
$sql .= "UPDATE cc_stream_setting SET value='$val' WHERE keyname='$key';";
|
||||
}
|
||||
$result = $CC_DBC->query($sql);
|
||||
if (PEAR::isError($result)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class Airtime200Upgrade{
|
||||
|
@ -284,14 +360,17 @@ class AirtimeIni200{
|
|||
public static function ReadPythonConfig($p_filename)
|
||||
{
|
||||
$values = array();
|
||||
|
||||
$lines = file($p_filename);
|
||||
$n=count($lines);
|
||||
for ($i=0; $i<$n; $i++) {
|
||||
if (strlen($lines[$i]) && !in_array(substr($lines[$i], 0, 1), array('#', PHP_EOL))){
|
||||
$info = explode("=", $lines[$i]);
|
||||
$values[trim($info[0])] = trim($info[1]);
|
||||
}
|
||||
|
||||
$fh = fopen($p_filename, 'r');
|
||||
|
||||
while(!feof($fh)){
|
||||
$line = fgets($fh);
|
||||
if(substr(trim($line), 0, 1) == '#' || trim($line) == ""){
|
||||
continue;
|
||||
}else{
|
||||
$info = explode('=', $line, 2);
|
||||
$values[trim($info[0])] = trim($info[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return $values;
|
||||
|
@ -346,7 +425,8 @@ class AirtimeIni200{
|
|||
AirtimeIni200::CONF_FILE_PYPO,
|
||||
AirtimeIni200::CONF_FILE_RECORDER,
|
||||
AirtimeIni200::CONF_FILE_LIQUIDSOAP,
|
||||
AirtimeIni200::CONF_FILE_MONIT);
|
||||
AirtimeIni200::CONF_FILE_MONIT,
|
||||
AirtimeIni200::CONF_FILE_API_CLIENT);
|
||||
|
||||
// Backup the config files
|
||||
$suffix = date("Ymdhis")."-1.9.3";
|
||||
|
@ -388,9 +468,13 @@ class AirtimeIni200{
|
|||
echo "Could not copy recorder.cfg to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
if (!copy(__DIR__."/liquidsoap.cfg.$suffix", AirtimeIni200::CONF_FILE_LIQUIDSOAP)){
|
||||
/*if (!copy(__DIR__."/liquidsoap.cfg.$suffix", AirtimeIni200::CONF_FILE_LIQUIDSOAP)){
|
||||
echo "Could not copy liquidsoap.cfg to /etc/airtime/. Exiting.";
|
||||
exit(1);
|
||||
}*/
|
||||
if (!copy(__DIR__."/api_client.cfg.$suffix", AirtimeIni200::CONF_FILE_API_CLIENT)){
|
||||
echo "Could not copy airtime-monit.cfg to /etc/monit/conf.d/. Exiting.";
|
||||
exit(1);
|
||||
}
|
||||
if (!copy(__DIR__."/airtime-monit.cfg.$suffix", AirtimeIni200::CONF_FILE_MONIT)){
|
||||
echo "Could not copy airtime-monit.cfg to /etc/monit/conf.d/. Exiting.";
|
||||
|
@ -429,6 +513,8 @@ AirtimeInstall::MigrateTablesToVersion(__DIR__, '20110829143306');
|
|||
|
||||
AirtimeInstall::SetDefaultStreamSetting();
|
||||
|
||||
AirtimeInstall::GetOldLiquidsoapCfgAndUpdate();
|
||||
|
||||
// restart monit
|
||||
exec("service monit restart");
|
||||
|
||||
|
|
|
@ -45,6 +45,8 @@ remove_watched_dir = 'remove-watched-dir/format/json/api_key/%%api_key%%/path/%%
|
|||
# URL to tell Airtime we want to add watched directory
|
||||
set_storage_dir = 'set-storage-dir/format/json/api_key/%%api_key%%/path/%%path%%'
|
||||
|
||||
# URL to tell Airtime we want to get stream setting
|
||||
get_stream_setting = 'get-stream-setting/format/json/api_key/%%api_key%%/'
|
||||
|
||||
#############################
|
||||
## Config for Recorder
|
||||
|
|
|
@ -61,4 +61,4 @@ s3_genre = "genre"
|
|||
# when the metadata changes to a new track. Some versions of
|
||||
# mplayer and VLC have this problem. Enable this option at your
|
||||
# own risk!
|
||||
output_icecast_vorbis_metadata = false
|
||||
icecast_vorbis_metadata = false
|
||||
|
|
|
@ -161,9 +161,6 @@ class AirtimeMetadata:
|
|||
self.logger.error("Exception %s", e)
|
||||
return None
|
||||
|
||||
|
||||
self.logger.info("sDFSDFSDF")
|
||||
self.logger.info(file_info)
|
||||
if file_info is None:
|
||||
return None
|
||||
#check if file has any metadata
|
||||
|
|
|
@ -139,10 +139,10 @@ try:
|
|||
buffer += temp
|
||||
buffer += "\n"
|
||||
fh.write(buffer)
|
||||
fh.write("output_icecast_vorbis_metadata = false\n");
|
||||
fh.write("log_file = \"/var/log/airtime/pypo-liquidsoap/<script>.log\"\n");
|
||||
fh.close()
|
||||
|
||||
else:
|
||||
print "Unable to connect to the Airtime server."
|
||||
print "Waiting for processes to start..."
|
||||
p = Popen("/etc/init.d/airtime-playout start", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
|
|
|
@ -58,4 +58,4 @@ s3_genre = "genre"
|
|||
# when the metadata changes to a new track. Some versions of
|
||||
# mplayer and VLC have this problem. Enable this option at your
|
||||
# own risk!
|
||||
output_icecast_vorbis_metadata = false
|
||||
icecast_vorbis_metadata = false
|
||||
|
|
|
@ -80,7 +80,7 @@ def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, de
|
|||
end
|
||||
else
|
||||
source = ref s
|
||||
if not output_icecast_vorbis_metadata then
|
||||
if not icecast_vorbis_metadata then
|
||||
source := add(normalize=false, [amplify(0.00001, noise()),s])
|
||||
end
|
||||
if bitrate == 24 then
|
||||
|
@ -112,15 +112,30 @@ def output_to(output_type, type, bitrate, host, port, pass, mount_point, url, de
|
|||
if user == "" then
|
||||
user_ref := "source"
|
||||
end
|
||||
|
||||
description_ref = ref description
|
||||
if description == "" then
|
||||
description_ref := "N/A"
|
||||
end
|
||||
|
||||
genre_ref = ref genre
|
||||
if genre == "" then
|
||||
genre_ref := "N/A"
|
||||
end
|
||||
|
||||
url_ref = ref url
|
||||
if url == "" then
|
||||
url_ref := "N/A"
|
||||
end
|
||||
output.shoutcast = output.shoutcast(host = host,
|
||||
port = port,
|
||||
password = pass,
|
||||
fallible = true,
|
||||
restart = true,
|
||||
restart_delay = 5,
|
||||
url = url,
|
||||
genre = genre,
|
||||
name = description,
|
||||
url = !url_ref,
|
||||
genre = !genre_ref,
|
||||
name = !description_ref,
|
||||
user = !user_ref)
|
||||
if bitrate == 24 then
|
||||
ignore(output.shoutcast(%mp3(bitrate = 24),s))
|
||||
|
|
|
@ -140,7 +140,7 @@ class PypoFetch(Thread):
|
|||
logger.info("Looking for changes...")
|
||||
# look for changes
|
||||
for s in setting:
|
||||
if "output_sound_device" in s[u'keyname']:
|
||||
if "output_sound_device" in s[u'keyname'] or "icecast_vorbis_metadata" in s[u'keyname']:
|
||||
dump, stream = s[u'keyname'].split('_', 1)
|
||||
state_change_restart[stream] = False
|
||||
# This is the case where restart is required no matter what
|
||||
|
@ -196,7 +196,6 @@ class PypoFetch(Thread):
|
|||
buffer += temp
|
||||
buffer += "\n"
|
||||
fh.write(buffer)
|
||||
fh.write("output_icecast_vorbis_metadata = false\n");
|
||||
fh.write("log_file = \"/var/log/airtime/pypo-liquidsoap/<script>.log\"\n");
|
||||
fh.close()
|
||||
# restarting pypo.
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
#!/bin/bash
|
||||
#-------------------------------------------------------------------------------
|
||||
# Copyright (c) 2010 Sourcefabric O.P.S.
|
||||
#
|
||||
# This file is part of the Airtime project.
|
||||
# http://airtime.sourcefabric.org/
|
||||
#
|
||||
# Airtime is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Airtime is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Airtime; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
# This script sets stream setting(max bitrate and number of streams in Airtime.
|
||||
#
|
||||
# Absolute path to this script
|
||||
SCRIPT=`readlink -f $0`
|
||||
# Absolute directory this script is in
|
||||
SCRIPTPATH=`dirname $SCRIPT`
|
||||
|
||||
invokePwd=$PWD
|
||||
cd $SCRIPTPATH
|
||||
|
||||
php -q airtime-stream.php "$@" || exit 1
|
|
@ -1,85 +0,0 @@
|
|||
<?php
|
||||
|
||||
$airtimeIni = GetAirtimeConf();
|
||||
$airtime_base_dir = $airtimeIni['general']['airtime_dir'];
|
||||
|
||||
set_include_path("$airtime_base_dir/application/models" . PATH_SEPARATOR . get_include_path());
|
||||
require_once("$airtime_base_dir/library/propel/runtime/lib/Propel.php");
|
||||
Propel::init("$airtime_base_dir/application/configs/airtime-conf.php");
|
||||
|
||||
require_once("$airtime_base_dir/application/configs/conf.php");
|
||||
require_once("$airtime_base_dir/application/models/Preference.php");
|
||||
require_once('DB.php');
|
||||
require_once('Console/Getopt.php');
|
||||
|
||||
// Do not allow remote execution
|
||||
$arr = array_diff_assoc($_SERVER, $_ENV);
|
||||
if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) {
|
||||
header("HTTP/1.1 400");
|
||||
header("Content-type: text/plain; charset=UTF-8");
|
||||
echo "400 Not executable\r\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
function printUsage()
|
||||
{
|
||||
echo "\n";
|
||||
echo "airtime-stream\n";
|
||||
echo "===============\n";
|
||||
echo " This program allows you to manage Airtime stream.\n";
|
||||
echo "\n";
|
||||
echo "OPTIONS:\n";
|
||||
echo " --maxbitrate <bitrate>\n";
|
||||
echo " Set the max bitrate allowed by Airtime.\n";
|
||||
echo " --numofstream <numofstream>\n";
|
||||
echo " Set the number of stream allowed by Airtime.\n";
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
|
||||
if (count($argv) != 3) {
|
||||
printUsage();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$action = null;
|
||||
switch ($argv[1]) {
|
||||
case '--maxbitrate':
|
||||
$action = "maxbitrate";
|
||||
break;
|
||||
case '--numofstream':
|
||||
$action = "numofstream";
|
||||
break;
|
||||
}
|
||||
|
||||
$optionArg = $argv[2];
|
||||
if (is_null($action)) {
|
||||
printUsage();
|
||||
exit;
|
||||
}
|
||||
|
||||
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
|
||||
$CC_DBC = DB::connect($CC_CONFIG['dsn'], TRUE);
|
||||
if (PEAR::isError($CC_DBC)) {
|
||||
die($CC_DBC->getMessage());
|
||||
}
|
||||
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||
|
||||
if ($action == "maxbitrate") {
|
||||
Application_Model_Preference::SetMaxBitrate($optionArg);
|
||||
} elseif ($action == "numofstream") {
|
||||
Application_Model_Preference::SetNumOfStreams($optionArg);
|
||||
}
|
||||
|
||||
function GetAirtimeConf()
|
||||
{
|
||||
$ini = parse_ini_file("/etc/airtime/airtime.conf", true);
|
||||
|
||||
if ($ini === false){
|
||||
echo "Error reading /etc/airtime/airtime.conf.".PHP_EOL;
|
||||
exit;
|
||||
}
|
||||
|
||||
return $ini;
|
||||
}
|
Loading…
Reference in New Issue