Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
4ef18fb00f
|
@ -1,3 +1,3 @@
|
||||||
[submodule "python_apps/pypo/liquidsoap_bin"]
|
[submodule "python_apps/pypo/liquidsoap_bin"]
|
||||||
path = python_apps/pypo/liquidsoap_bin
|
path = python_apps/pypo/liquidsoap_bin
|
||||||
url = git@dev.sourcefabric.org:airtime-liquidsoap
|
url = git://github.com/sourcefabric/airtime-liquidsoap.git
|
||||||
|
|
|
@ -12,6 +12,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
->addActionContext('make-context-menu', 'json')
|
->addActionContext('make-context-menu', 'json')
|
||||||
->addActionContext('add-show-dialog', 'json')
|
->addActionContext('add-show-dialog', 'json')
|
||||||
->addActionContext('add-show', 'json')
|
->addActionContext('add-show', 'json')
|
||||||
|
->addActionContext('edit-show', 'json')
|
||||||
->addActionContext('move-show', 'json')
|
->addActionContext('move-show', 'json')
|
||||||
->addActionContext('resize-show', 'json')
|
->addActionContext('resize-show', 'json')
|
||||||
->addActionContext('delete-show', 'json')
|
->addActionContext('delete-show', 'json')
|
||||||
|
@ -19,8 +20,8 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
->addActionContext('clear-show', 'json')
|
->addActionContext('clear-show', 'json')
|
||||||
->addActionContext('get-current-playlist', 'json')
|
->addActionContext('get-current-playlist', 'json')
|
||||||
->addActionContext('remove-group', 'json')
|
->addActionContext('remove-group', 'json')
|
||||||
->addActionContext('edit-show', 'json')
|
->addActionContext('populate-show-form', 'json')
|
||||||
->addActionContext('add-show', 'json')
|
->addActionContext('populate-show-instance-form', 'json')
|
||||||
->addActionContext('cancel-show', 'json')
|
->addActionContext('cancel-show', 'json')
|
||||||
->addActionContext('cancel-current-show', 'json')
|
->addActionContext('cancel-current-show', 'json')
|
||||||
->addActionContext('get-form', 'json')
|
->addActionContext('get-form', 'json')
|
||||||
|
@ -265,13 +266,13 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
} else {
|
} else {
|
||||||
if($instance->isRepeating()){
|
if($instance->isRepeating()){
|
||||||
$menu["edit"] = array("name"=> "Edit", "icon" => "edit", "items" => array());
|
$menu["edit"] = array("name"=> "Edit", "icon" => "edit", "items" => array());
|
||||||
$menu["edit"]["items"]["instance"] = array("name"=> "Edit Show Instance", "icon" => "edit", "url" => "/Schedule/edit-show");
|
$menu["edit"]["items"]["instance"] = array("name"=> "Edit Show Instance", "icon" => "edit", "url" => "/Schedule/populate-show-instance-form");
|
||||||
$menu["edit"]["items"]["all"] = array("name"=> "Edit Show", "icon" => "edit", "url" => "/Schedule/edit-show");
|
$menu["edit"]["items"]["all"] = array("name"=> "Edit Show", "icon" => "edit", "url" => "/Schedule/populate-show-form");
|
||||||
}else{
|
}else{
|
||||||
if($instance->isRebroadcast()){
|
if($instance->isRebroadcast()){
|
||||||
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"rebroadcast", "url" => "/Schedule/edit-show");
|
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"rebroadcast", "url" => "/Schedule/populate-show-form");
|
||||||
}else{
|
}else{
|
||||||
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"all", "url" => "/Schedule/edit-show");
|
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"all", "url" => "/Schedule/populate-show-form");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($isAdminOrPM){
|
if($isAdminOrPM){
|
||||||
|
@ -286,13 +287,13 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
if($instance->isRepeating()){
|
if($instance->isRepeating()){
|
||||||
$menu["edit"] = array("name"=> "Edit", "icon" => "edit", "items" => array());
|
$menu["edit"] = array("name"=> "Edit", "icon" => "edit", "items" => array());
|
||||||
$menu["edit"]["items"]["instance"] = array("name"=> "Edit Show Instance", "icon" => "edit", "url" => "/Schedule/edit-show");
|
$menu["edit"]["items"]["instance"] = array("name"=> "Edit Show Instance", "icon" => "edit", "url" => "/Schedule/populate-show-instance-form");
|
||||||
$menu["edit"]["items"]["all"] = array("name"=> "Edit Show", "icon" => "edit", "url" => "/Schedule/edit-show");
|
$menu["edit"]["items"]["all"] = array("name"=> "Edit Show", "icon" => "edit", "url" => "/Schedule/populate-show-form");
|
||||||
}else{
|
}else{
|
||||||
if($instance->isRebroadcast()){
|
if($instance->isRebroadcast()){
|
||||||
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"rebroadcast", "url" => "/Schedule/edit-show");
|
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"rebroadcast", "url" => "/Schedule/populate-show-form");
|
||||||
}else{
|
}else{
|
||||||
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"all", "url" => "/Schedule/edit-show");
|
$menu["edit"] = array("name"=> "Edit Show", "icon" => "edit", "_type"=>"all", "url" => "/Schedule/populate-show-form");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,7 +439,68 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
unset($this->view->showContent);
|
unset($this->view->showContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function editShowAction()
|
public function populateShowInstanceFormAction(){
|
||||||
|
$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();
|
||||||
|
$formLive = new Application_Form_AddShowLiveStream();
|
||||||
|
|
||||||
|
$formWhat->removeDecorator('DtDdWrapper');
|
||||||
|
$formWho->removeDecorator('DtDdWrapper');
|
||||||
|
$formWhen->removeDecorator('DtDdWrapper');
|
||||||
|
$formRepeats->removeDecorator('DtDdWrapper');
|
||||||
|
$formStyle->removeDecorator('DtDdWrapper');
|
||||||
|
|
||||||
|
$this->view->what = $formWhat;
|
||||||
|
$this->view->when = $formWhen;
|
||||||
|
$this->view->repeats = $formRepeats;
|
||||||
|
$this->view->who = $formWho;
|
||||||
|
$this->view->style = $formStyle;
|
||||||
|
$this->view->live = $formLive;
|
||||||
|
$this->view->addNewShow = false;
|
||||||
|
|
||||||
|
$showInstanceId = $this->_getParam('id');
|
||||||
|
|
||||||
|
$show_instance = CcShowInstancesQuery::create()->findPK($showInstanceId);
|
||||||
|
|
||||||
|
$starts_string = $show_instance->getDbStarts();
|
||||||
|
$ends_string = $show_instance->getDbEnds();
|
||||||
|
|
||||||
|
$starts_datetime = new DateTime($starts_string, new DateTimeZone("UTC"));
|
||||||
|
$ends_datetime = new DateTime($ends_string, new DateTimeZone("UTC"));
|
||||||
|
|
||||||
|
$starts_datetime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||||
|
$ends_datetime->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||||
|
|
||||||
|
$instance_duration = $starts_datetime->diff($ends_datetime);
|
||||||
|
|
||||||
|
$formValues = array('add_show_start_date' => $starts_datetime->format("Y-m-d"),
|
||||||
|
'add_show_start_time' => $starts_datetime->format("H:i"),
|
||||||
|
'add_show_end_date_no_repeat' => $ends_datetime->format("Y-m-d"),
|
||||||
|
'add_show_end_time' => $ends_datetime->format("H:i"),
|
||||||
|
'add_show_duration' => $instance_duration->format("%h"));
|
||||||
|
|
||||||
|
$formWhen->populate($formValues);
|
||||||
|
|
||||||
|
$formWhat->disable();
|
||||||
|
$formWho->disable();
|
||||||
|
$formWhen->disableRepeatCheckbox();
|
||||||
|
$formRepeats->disable();
|
||||||
|
$formStyle->disable();
|
||||||
|
|
||||||
|
/*
|
||||||
|
$formRecord->disable();
|
||||||
|
$formAbsoluteRebroadcast->disable();
|
||||||
|
$formRebroadcast->disable();
|
||||||
|
*/
|
||||||
|
|
||||||
|
$this->view->action = "edit-show-instance";
|
||||||
|
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function populateShowFormAction()
|
||||||
{
|
{
|
||||||
$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);
|
||||||
|
@ -450,10 +512,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"){
|
if($type == "rebroadcast") {
|
||||||
$this->view->action = "edit-show-instance";
|
|
||||||
}else if($type == "rebroadcast"){
|
|
||||||
$this->view->action = "edit-show-rebroadcast";
|
$this->view->action = "edit-show-rebroadcast";
|
||||||
|
} else {
|
||||||
|
$this->view->action = "edit-show";
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
@ -498,6 +560,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$show = new Application_Model_Show($showInstance->getShowId());
|
$show = new Application_Model_Show($showInstance->getShowId());
|
||||||
|
|
||||||
$formWhat->populate(array('add_show_id' => $show->getId(),
|
$formWhat->populate(array('add_show_id' => $show->getId(),
|
||||||
|
'add_show_instance_id' => $showInstanceId,
|
||||||
'add_show_name' => $show->getName(),
|
'add_show_name' => $show->getName(),
|
||||||
'add_show_url' => $show->getUrl(),
|
'add_show_url' => $show->getUrl(),
|
||||||
'add_show_genre' => $show->getGenre(),
|
'add_show_genre' => $show->getGenre(),
|
||||||
|
@ -588,7 +651,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$formAbsoluteRebroadcast->populate($rebroadcastAbsoluteFormValues);
|
$formAbsoluteRebroadcast->populate($rebroadcastAbsoluteFormValues);
|
||||||
if(!$isAdminOrPM || $type == "instance"){
|
if(!$isAdminOrPM){
|
||||||
$formRecord->disable();
|
$formRecord->disable();
|
||||||
$formAbsoluteRebroadcast->disable();
|
$formAbsoluteRebroadcast->disable();
|
||||||
$formRebroadcast->disable();
|
$formRebroadcast->disable();
|
||||||
|
@ -603,14 +666,6 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$formStyle->disable();
|
$formStyle->disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($type == "instance"){
|
|
||||||
$formWhat->disable();
|
|
||||||
$formWho->disable();
|
|
||||||
$formWhen->disableRepeatCheckbox();
|
|
||||||
$formRepeats->disable();
|
|
||||||
$formStyle->disable();
|
|
||||||
}
|
|
||||||
|
|
||||||
if($type == "rebroadcast"){
|
if($type == "rebroadcast"){
|
||||||
$formWhen->disable();
|
$formWhen->disable();
|
||||||
}
|
}
|
||||||
|
@ -625,19 +680,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
$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 editShowRebroadcastAction(){
|
public function editShowRebroadcastAction(){
|
||||||
$js = $this->_getParam('data');
|
$js = $this->_getParam('data');
|
||||||
$data = array();
|
$data = array();
|
||||||
|
@ -668,15 +711,7 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$this->view->edit = true;
|
$this->view->edit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//for 2.2
|
public function editShowInstanceAction(){
|
||||||
/*
|
|
||||||
public function editShowAction(){
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public function addShowAction()
|
|
||||||
{
|
|
||||||
$js = $this->_getParam('data');
|
$js = $this->_getParam('data');
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
|
@ -685,15 +720,29 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$data[$j["name"]] = $j["value"];
|
$data[$j["name"]] = $j["value"];
|
||||||
}
|
}
|
||||||
|
|
||||||
$show = new Application_Model_Show($data['add_show_id']);
|
|
||||||
$startDateModified = true;
|
$start_dt = new DateTime($data['add_show_start_date']." ".$data['add_show_start_time'], new DateTimeZone(date_default_timezone_get()));
|
||||||
if ($data['add_show_id'] != -1 && !array_key_exists('add_show_start_date', $data)){
|
$start_dt->setTimezone(new DateTimeZone('UTC'));
|
||||||
//show is being updated and changing the start date was disabled, since the
|
|
||||||
//array key does not exist. We need to repopulate this entry from the db.
|
$end_dt = new DateTime($data['add_show_end_date_no_repeat']." ".$data['add_show_end_time'], new DateTimeZone(date_default_timezone_get()));
|
||||||
//The start date will be return in UTC time, so lets convert it to local time.
|
$end_dt->setTimezone(new DateTimeZone('UTC'));
|
||||||
$dt = Application_Model_DateHelper::ConvertToLocalDateTime($show->getStartDate());
|
|
||||||
$data['add_show_start_date'] = $dt->format("Y-m-d");
|
//add_show_instance_id not being populated by populateShowInstanceFormAction.
|
||||||
$startDateModified = false;
|
$ccShowInstance = CcShowInstancesQuery::create()->findPK($data["add_show_instance_id"]);
|
||||||
|
$ccShowInstance->setDbStarts($start_dt);
|
||||||
|
$ccShowInstance->setDbEnds($end_dt);
|
||||||
|
$ccShowInstance->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function editShowAction(){
|
||||||
|
|
||||||
|
//1) Get add_show_start_date since it might not have been sent
|
||||||
|
$js = $this->_getParam('data');
|
||||||
|
$data = array();
|
||||||
|
|
||||||
|
//need to convert from serialized jQuery array.
|
||||||
|
foreach($js as $j){
|
||||||
|
$data[$j["name"]] = $j["value"];
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['add_show_hosts'] = $this->_getParam('hosts');
|
$data['add_show_hosts'] = $this->_getParam('hosts');
|
||||||
|
@ -703,192 +752,59 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$data['add_show_day_check'] = null;
|
$data['add_show_day_check'] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$show = new Application_Model_Show($data['add_show_id']);
|
||||||
$user = new Application_Model_User($userInfo->id);
|
$validateStartDate = true;
|
||||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
|
||||||
$isDJ = $user->isHost($show->getId());
|
if (!array_key_exists('add_show_start_date', $data)){
|
||||||
|
//Changing the start date was disabled, since the
|
||||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
//array key does not exist. We need to repopulate this entry from the db.
|
||||||
$record = false;
|
//The start date will be returned in UTC time, so lets convert it to local time.
|
||||||
|
$dt = Application_Model_DateHelper::ConvertToLocalDateTime($show->getStartDate());
|
||||||
$formWhat = new Application_Form_AddShowWhat();
|
$data['add_show_start_date'] = $dt->format("Y-m-d");
|
||||||
$formWho = new Application_Form_AddShowWho();
|
$validateStartDate = false;
|
||||||
$formWhen = new Application_Form_AddShowWhen();
|
|
||||||
$formRepeats = new Application_Form_AddShowRepeats();
|
|
||||||
$formStyle = new Application_Form_AddShowStyle();
|
|
||||||
$formLive = new Application_Form_AddShowLiveStream();
|
|
||||||
|
|
||||||
$formWhat->removeDecorator('DtDdWrapper');
|
|
||||||
$formWho->removeDecorator('DtDdWrapper');
|
|
||||||
$formWhen->removeDecorator('DtDdWrapper');
|
|
||||||
$formRepeats->removeDecorator('DtDdWrapper');
|
|
||||||
$formStyle->removeDecorator('DtDdWrapper');
|
|
||||||
$formLive->removeDecorator('DtDdWrapper');
|
|
||||||
|
|
||||||
$what = $formWhat->isValid($data);
|
|
||||||
$when = $formWhen->isValid($data);
|
|
||||||
$live = $formLive->isValid($data);
|
|
||||||
if($when) {
|
|
||||||
$when = $formWhen->checkReliantFields($data, $startDateModified);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data['add_show_record'] = $show->isRecorded();
|
||||||
//The way the following code works is that is parses the hour and
|
|
||||||
//minute from a string with the format "1h 20m" or "2h" or "36m".
|
$success = Application_Model_Schedule::addUpdateShow($data, $this, $validateStartDate);
|
||||||
//So we are detecting whether an hour or minute value exists via strpos
|
|
||||||
//and then parse appropriately. A better way to do this in the future is
|
if ($success){
|
||||||
//actually pass the format from javascript in the format hh:mm so we don't
|
|
||||||
//have to do this extra String parsing.
|
|
||||||
$hPos = strpos($data["add_show_duration"], 'h');
|
|
||||||
$mPos = strpos($data["add_show_duration"], 'm');
|
|
||||||
|
|
||||||
$hValue = 0;
|
|
||||||
$mValue = 0;
|
|
||||||
|
|
||||||
if($hPos !== false){
|
|
||||||
$hValue = trim(substr($data["add_show_duration"], 0, $hPos));
|
|
||||||
}
|
|
||||||
if($mPos !== false){
|
|
||||||
$hPos = $hPos === FALSE ? 0 : $hPos+1;
|
|
||||||
$mValue = trim(substr($data["add_show_duration"], $hPos, -1 ));
|
|
||||||
}
|
|
||||||
|
|
||||||
$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);
|
|
||||||
}
|
|
||||||
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 {
|
|
||||||
$repeats = 1;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$who = $formWho->isValid($data);
|
|
||||||
$style = $formStyle->isValid($data);
|
|
||||||
if ($what && $when && $repeats && $who && $style && $live) {
|
|
||||||
if(!$isSaas){
|
|
||||||
if($record && $rebroadAb && $rebroad){
|
|
||||||
if ($isAdminOrPM || $isDJ) {
|
|
||||||
Application_Model_Show::create($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
//send back a new form for the user.
|
|
||||||
Application_Model_Schedule::createNewFormSections($this->view);
|
|
||||||
|
|
||||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
|
||||||
}else{
|
|
||||||
$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->live = $formLive;
|
|
||||||
$this->view->addNewShow = true;
|
|
||||||
|
|
||||||
//the form still needs to be "update" since
|
|
||||||
//the validity test failed.
|
|
||||||
if ($data['add_show_id'] != -1){
|
|
||||||
$this->view->addNewShow = false;
|
|
||||||
}
|
|
||||||
if (!$startDateModified){
|
|
||||||
$formWhen->getElement('add_show_start_date')->setOptions(array('disabled' => true));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
|
||||||
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if ($isAdminOrPM || $isDJ) {
|
|
||||||
Application_Model_Show::create($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
//send back a new form for the user.
|
|
||||||
Application_Model_Schedule::createNewFormSections($this->view);
|
|
||||||
|
|
||||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$this->view->what = $formWhat;
|
|
||||||
$this->view->when = $formWhen;
|
|
||||||
$this->view->repeats = $formRepeats;
|
|
||||||
$this->view->who = $formWho;
|
|
||||||
$this->view->style = $formStyle;
|
|
||||||
$this->view->live = $formLive;
|
|
||||||
|
|
||||||
if(!$isSaas){
|
|
||||||
$this->view->rr = $formRecord;
|
|
||||||
$this->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
|
||||||
$this->view->rebroadcast = $formRebroadcast;
|
|
||||||
}
|
|
||||||
$this->view->addNewShow = true;
|
$this->view->addNewShow = true;
|
||||||
|
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||||
//the form still needs to be "update" since
|
} else {
|
||||||
//the validity test failed.
|
if (!$validateStartDate){
|
||||||
if ($data['add_show_id'] != -1){
|
$this->view->when->getElement('add_show_start_date')->setOptions(array('disabled' => true));
|
||||||
$this->view->addNewShow = false;
|
|
||||||
}
|
|
||||||
if (!$startDateModified){
|
|
||||||
$formWhen->getElement('add_show_start_date')->setOptions(array('disabled' => true));
|
|
||||||
}
|
}
|
||||||
|
$this->view->rr->getElement('add_show_record')->setOptions(array('disabled' => true));
|
||||||
|
$this->view->addNewShow = false;
|
||||||
|
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addShowAction(){
|
||||||
|
$js = $this->_getParam('data');
|
||||||
|
$data = array();
|
||||||
|
|
||||||
|
//need to convert from serialized jQuery array.
|
||||||
|
foreach($js as $j){
|
||||||
|
$data[$j["name"]] = $j["value"];
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['add_show_hosts'] = $this->_getParam('hosts');
|
||||||
|
$data['add_show_day_check'] = $this->_getParam('days');
|
||||||
|
|
||||||
|
if($data['add_show_day_check'] == "") {
|
||||||
|
$data['add_show_day_check'] = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$validateStartDate = true;
|
||||||
|
$success = Application_Model_Schedule::addUpdateShow($data, $this, $validateStartDate);
|
||||||
|
|
||||||
|
if ($success){
|
||||||
|
$this->view->addNewShow = true;
|
||||||
|
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||||
|
} else {
|
||||||
|
$this->view->addNewShow = true;
|
||||||
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,12 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
|
||||||
'decorators' => array('ViewHelper')
|
'decorators' => array('ViewHelper')
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// Hidden element to indicate the instance id of the show
|
||||||
|
// being edited.
|
||||||
|
$this->addElement('hidden', 'add_show_instance_id', array(
|
||||||
|
'decorators' => array('ViewHelper')
|
||||||
|
));
|
||||||
|
|
||||||
// Add name element
|
// Add name element
|
||||||
$this->addElement('text', 'add_show_name', array(
|
$this->addElement('text', 'add_show_name', array(
|
||||||
'label' => 'Name:',
|
'label' => 'Name:',
|
||||||
|
|
|
@ -83,7 +83,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkReliantFields($formData, $startDateModified) {
|
public function checkReliantFields($formData, $validateStartDate) {
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
$start_time = $formData['add_show_start_date']." ".$formData['add_show_start_time'];
|
$start_time = $formData['add_show_start_date']." ".$formData['add_show_start_time'];
|
||||||
|
@ -92,7 +92,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
$nowDateTime = new DateTime();
|
$nowDateTime = new DateTime();
|
||||||
$showStartDateTime = new DateTime($start_time);
|
$showStartDateTime = new DateTime($start_time);
|
||||||
|
|
||||||
if ((($formData['add_show_id'] != -1) && $startDateModified) || ($formData['add_show_id'] == -1)){
|
if ($validateStartDate){
|
||||||
if($showStartDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
|
if($showStartDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
|
||||||
$this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past'));
|
$this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past'));
|
||||||
$valid = false;
|
$valid = false;
|
||||||
|
|
|
@ -543,7 +543,11 @@ class Application_Model_Preference
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetAirtimeVersion(){
|
public static function GetAirtimeVersion(){
|
||||||
return self::GetValue("system_version");
|
if (defined('APPLICATION_ENV') && APPLICATION_ENV == "development"){
|
||||||
|
return self::GetValue("system_version")."+".exec("git rev-parse --short HEAD");
|
||||||
|
} else {
|
||||||
|
return self::GetValue("system_version");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetLatestVersion(){
|
public static function GetLatestVersion(){
|
||||||
|
|
|
@ -603,7 +603,8 @@ class Application_Model_Schedule {
|
||||||
$p_view->style = $formStyle;
|
$p_view->style = $formStyle;
|
||||||
$p_view->live = $formLive;
|
$p_view->live = $formLive;
|
||||||
|
|
||||||
$formWhat->populate(array('add_show_id' => '-1'));
|
$formWhat->populate(array('add_show_id' => '-1',
|
||||||
|
'add_show_instance_id' => '-1'));
|
||||||
$formWhen->populate(array('add_show_start_date' => date("Y-m-d"),
|
$formWhen->populate(array('add_show_start_date' => date("Y-m-d"),
|
||||||
'add_show_start_time' => '00:00',
|
'add_show_start_time' => '00:00',
|
||||||
'add_show_end_date_no_repeate' => date("Y-m-d"),
|
'add_show_end_date_no_repeate' => date("Y-m-d"),
|
||||||
|
@ -627,4 +628,166 @@ class Application_Model_Schedule {
|
||||||
}
|
}
|
||||||
$p_view->addNewShow = true;
|
$p_view->addNewShow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function addUpdateShow($data, $controller, $validateStartDate){
|
||||||
|
|
||||||
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
|
$user = new Application_Model_User($userInfo->id);
|
||||||
|
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||||
|
|
||||||
|
$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();
|
||||||
|
$formLive = new Application_Form_AddShowLiveStream();
|
||||||
|
|
||||||
|
$formWhat->removeDecorator('DtDdWrapper');
|
||||||
|
$formWho->removeDecorator('DtDdWrapper');
|
||||||
|
$formWhen->removeDecorator('DtDdWrapper');
|
||||||
|
$formRepeats->removeDecorator('DtDdWrapper');
|
||||||
|
$formStyle->removeDecorator('DtDdWrapper');
|
||||||
|
$formLive->removeDecorator('DtDdWrapper');
|
||||||
|
|
||||||
|
$what = $formWhat->isValid($data);
|
||||||
|
$when = $formWhen->isValid($data);
|
||||||
|
$live = $formLive->isValid($data);
|
||||||
|
if($when) {
|
||||||
|
$when = $formWhen->checkReliantFields($data, $validateStartDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
//The way the following code works is that is parses the hour and
|
||||||
|
//minute from a string with the format "1h 20m" or "2h" or "36m".
|
||||||
|
//So we are detecting whether an hour or minute value exists via strpos
|
||||||
|
//and then parse appropriately. A better way to do this in the future is
|
||||||
|
//actually pass the format from javascript in the format hh:mm so we don't
|
||||||
|
//have to do this extra String parsing.
|
||||||
|
$hPos = strpos($data["add_show_duration"], 'h');
|
||||||
|
$mPos = strpos($data["add_show_duration"], 'm');
|
||||||
|
|
||||||
|
$hValue = 0;
|
||||||
|
$mValue = 0;
|
||||||
|
|
||||||
|
if($hPos !== false){
|
||||||
|
$hValue = trim(substr($data["add_show_duration"], 0, $hPos));
|
||||||
|
}
|
||||||
|
if($mPos !== false){
|
||||||
|
$hPos = $hPos === FALSE ? 0 : $hPos+1;
|
||||||
|
$mValue = trim(substr($data["add_show_duration"], $hPos, -1 ));
|
||||||
|
}
|
||||||
|
|
||||||
|
$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');
|
||||||
|
|
||||||
|
|
||||||
|
$record = $formRecord->isValid($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($data["add_show_repeats"]) {
|
||||||
|
$repeats = $formRepeats->isValid($data);
|
||||||
|
if($repeats) {
|
||||||
|
$repeats = $formRepeats->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 {
|
||||||
|
$repeats = 1;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$who = $formWho->isValid($data);
|
||||||
|
$style = $formStyle->isValid($data);
|
||||||
|
if ($what && $when && $repeats && $who && $style && $live) {
|
||||||
|
if(!$isSaas){
|
||||||
|
if($record && $rebroadAb && $rebroad){
|
||||||
|
if ($isAdminOrPM) {
|
||||||
|
Application_Model_Show::create($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
//send back a new form for the user.
|
||||||
|
Application_Model_Schedule::createNewFormSections($controller->view);
|
||||||
|
|
||||||
|
//$controller->view->newForm = $controller->view->render('schedule/add-show-form.phtml');
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
$controller->view->what = $formWhat;
|
||||||
|
$controller->view->when = $formWhen;
|
||||||
|
$controller->view->repeats = $formRepeats;
|
||||||
|
$controller->view->who = $formWho;
|
||||||
|
$controller->view->style = $formStyle;
|
||||||
|
$controller->view->rr = $formRecord;
|
||||||
|
$controller->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||||
|
$controller->view->rebroadcast = $formRebroadcast;
|
||||||
|
$controller->view->live = $formLive;
|
||||||
|
//$controller->view->addNewShow = !$editShow;
|
||||||
|
|
||||||
|
//$controller->view->form = $controller->view->render('schedule/add-show-form.phtml');
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($isAdminOrPM) {
|
||||||
|
Application_Model_Show::create($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
//send back a new form for the user.
|
||||||
|
Application_Model_Schedule::createNewFormSections($controller->view);
|
||||||
|
|
||||||
|
//$controller->view->newForm = $controller->view->render('schedule/add-show-form.phtml');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$controller->view->what = $formWhat;
|
||||||
|
$controller->view->when = $formWhen;
|
||||||
|
$controller->view->repeats = $formRepeats;
|
||||||
|
$controller->view->who = $formWho;
|
||||||
|
$controller->view->style = $formStyle;
|
||||||
|
$controller->view->live = $formLive;
|
||||||
|
|
||||||
|
if(!$isSaas){
|
||||||
|
$controller->view->rr = $formRecord;
|
||||||
|
$controller->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||||
|
$controller->view->rebroadcast = $formRebroadcast;
|
||||||
|
}
|
||||||
|
//$controller->view->addNewShow = !$editShow;
|
||||||
|
//$controller->view->form = $controller->view->render('schedule/add-show-form.phtml');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,10 @@ class Application_Model_Scheduler {
|
||||||
private $epochNow;
|
private $epochNow;
|
||||||
private $nowDT;
|
private $nowDT;
|
||||||
private $user;
|
private $user;
|
||||||
|
|
||||||
|
private $checkUserPermissions = true;
|
||||||
|
|
||||||
public function __construct($id = null) {
|
public function __construct() {
|
||||||
|
|
||||||
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
||||||
|
|
||||||
|
@ -27,6 +29,11 @@ class Application_Model_Scheduler {
|
||||||
$this->user = Application_Model_User::GetCurrentUser();
|
$this->user = Application_Model_User::GetCurrentUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setCheckUserPermissions($value) {
|
||||||
|
$this->checkUserPermissions = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* make sure any incoming requests for scheduling are ligit.
|
* make sure any incoming requests for scheduling are ligit.
|
||||||
*
|
*
|
||||||
|
@ -83,7 +90,7 @@ class Application_Model_Scheduler {
|
||||||
$id = $instance->getDbId();
|
$id = $instance->getDbId();
|
||||||
$show = $instance->getCcShow($this->con);
|
$show = $instance->getCcShow($this->con);
|
||||||
|
|
||||||
if ($this->user->canSchedule($show->getDbId()) === false) {
|
if ($this->checkUserPermissions && $this->user->canSchedule($show->getDbId()) === false) {
|
||||||
throw new Exception("You are not allowed to schedule show {$show->getDbName()}.");
|
throw new Exception("You are not allowed to schedule show {$show->getDbName()}.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -352,7 +352,7 @@ class Application_Model_ShowInstance {
|
||||||
* @param int $plId
|
* @param int $plId
|
||||||
* Playlist ID.
|
* Playlist ID.
|
||||||
*/
|
*/
|
||||||
public function addPlaylistToShow($pl_id)
|
public function addPlaylistToShow($pl_id, $checkUserPerm = true)
|
||||||
{
|
{
|
||||||
$ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0;
|
$ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0;
|
||||||
$id = $this->_showInstance->getDbId();
|
$id = $this->_showInstance->getDbId();
|
||||||
|
@ -369,12 +369,13 @@ class Application_Model_ShowInstance {
|
||||||
*
|
*
|
||||||
* @param int $file_id
|
* @param int $file_id
|
||||||
*/
|
*/
|
||||||
public function addFileToShow($file_id)
|
public function addFileToShow($file_id, $checkUserPerm = true)
|
||||||
{
|
{
|
||||||
$ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0;
|
$ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0;
|
||||||
$id = $this->_showInstance->getDbId();
|
$id = $this->_showInstance->getDbId();
|
||||||
|
|
||||||
$scheduler = new Application_Model_Scheduler();
|
$scheduler = new Application_Model_Scheduler();
|
||||||
|
$scheduler->setCheckUserPermissions($checkUserPerm);
|
||||||
$scheduler->scheduleAfter(
|
$scheduler->scheduleAfter(
|
||||||
array(array("id" => 0, "instance" => $id, "timestamp" => $ts)),
|
array(array("id" => 0, "instance" => $id, "timestamp" => $ts)),
|
||||||
array(array("id" => $file_id, "type" => "audioclip"))
|
array(array("id" => $file_id, "type" => "audioclip"))
|
||||||
|
@ -553,7 +554,7 @@ class Application_Model_ShowInstance {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$rebroad = new Application_Model_ShowInstance($rebroadcast->getDbId());
|
$rebroad = new Application_Model_ShowInstance($rebroadcast->getDbId());
|
||||||
$rebroad->addFileToShow($file_id);
|
$rebroad->addFileToShow($file_id, false);
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
Logging::log("{$e->getFile()}");
|
Logging::log("{$e->getFile()}");
|
||||||
|
|
|
@ -137,8 +137,13 @@ 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
|
||||||
|
oldPath = pathname
|
||||||
pathname = self.mmc.organize_new_file(pathname)
|
pathname = self.mmc.organize_new_file(pathname)
|
||||||
name = os.path.basename(pathname)
|
|
||||||
|
#delete files from organize if they can not be read properly.
|
||||||
|
if pathname is None:
|
||||||
|
os.remove(oldPath)
|
||||||
|
return
|
||||||
|
|
||||||
self.mmc.set_needed_file_permissions(pathname, dir)
|
self.mmc.set_needed_file_permissions(pathname, dir)
|
||||||
is_recorded = self.mmc.is_parent_directory(pathname, self.config.recorded_directory)
|
is_recorded = self.mmc.is_parent_directory(pathname, self.config.recorded_directory)
|
||||||
|
@ -237,6 +242,11 @@ class AirtimeProcessEvent(ProcessEvent):
|
||||||
del self.cookies_IN_MOVED_FROM[event.cookie]
|
del self.cookies_IN_MOVED_FROM[event.cookie]
|
||||||
if self.mmc.is_parent_directory(event.pathname, self.config.organize_directory):
|
if self.mmc.is_parent_directory(event.pathname, self.config.organize_directory):
|
||||||
filepath = self.mmc.organize_new_file(event.pathname)
|
filepath = self.mmc.organize_new_file(event.pathname)
|
||||||
|
|
||||||
|
#delete files from organize if they can not be read properly.
|
||||||
|
if filepath is None:
|
||||||
|
os.remove(event.pathname)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
filepath = event.pathname
|
filepath = event.pathname
|
||||||
|
|
||||||
|
@ -244,7 +254,11 @@ class AirtimeProcessEvent(ProcessEvent):
|
||||||
self.file_events.append({'filepath': filepath, 'mode': self.config.MODE_MOVED})
|
self.file_events.append({'filepath': filepath, 'mode': self.config.MODE_MOVED})
|
||||||
else:
|
else:
|
||||||
if self.mmc.is_parent_directory(event.pathname, self.config.organize_directory):
|
if self.mmc.is_parent_directory(event.pathname, self.config.organize_directory):
|
||||||
self.mmc.organize_new_file(event.pathname)
|
filepath = self.mmc.organize_new_file(event.pathname)
|
||||||
|
|
||||||
|
#delete files from organize if they can not be read properly.
|
||||||
|
if filepath is None:
|
||||||
|
os.remove(event.pathname)
|
||||||
else:
|
else:
|
||||||
#show dragged from unwatched folder into a watched folder. Do not "organize".:q!
|
#show dragged from unwatched folder into a watched folder. Do not "organize".:q!
|
||||||
if self.mmc.is_parent_directory(event.pathname, self.config.recorded_directory):
|
if self.mmc.is_parent_directory(event.pathname, self.config.recorded_directory):
|
||||||
|
@ -285,8 +299,10 @@ class AirtimeProcessEvent(ProcessEvent):
|
||||||
if not dir:
|
if not dir:
|
||||||
if self.mmc.is_audio_file(pathname):
|
if self.mmc.is_audio_file(pathname):
|
||||||
if pathname in self.ignore_event:
|
if pathname in self.ignore_event:
|
||||||
|
self.logger.info("pathname in ignore event")
|
||||||
self.ignore_event.remove(pathname)
|
self.ignore_event.remove(pathname)
|
||||||
elif not self.mmc.is_parent_directory(pathname, self.config.organize_directory):
|
elif not self.mmc.is_parent_directory(pathname, self.config.organize_directory):
|
||||||
|
self.logger.info("deleting a file not in organize")
|
||||||
#we don't care if a file was deleted from the organize directory.
|
#we don't care if a file was deleted from the organize directory.
|
||||||
self.file_events.append({'filepath': pathname, 'mode': self.config.MODE_DELETE})
|
self.file_events.append({'filepath': pathname, 'mode': self.config.MODE_DELETE})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue