Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
denise 2012-09-17 15:49:34 -04:00
commit cf57c12782
7 changed files with 22 additions and 17 deletions

View file

@ -415,8 +415,9 @@ class ApiController extends Zend_Controller_Action
$this->uploadRecordedActionParam($show_instance_id, $file_id); $this->uploadRecordedActionParam($show_instance_id, $file_id);
} }
// The paramterized version of the uploadRecordedAction controller. We want this controller's action // The paramterized version of the uploadRecordedAction controller.
// to be invokable from other controllers instead being of only through http // We want this controller's action to be invokable from other
// controllers instead being of only through http
public function uploadRecordedActionParam($show_instance_id, $file_id) public function uploadRecordedActionParam($show_instance_id, $file_id)
{ {
$showCanceled = false; $showCanceled = false;
@ -430,10 +431,10 @@ class ApiController extends Zend_Controller_Action
} catch (Exception $e) { } catch (Exception $e) {
//we've reached here probably because the show was //we've reached here probably because the show was
//cancelled, and therefore the show instance does not //cancelled, and therefore the show instance does not exist
//exist anymore (ShowInstance constructor threw this error). //anymore (ShowInstance constructor threw this error). We've
//We've done all we can do (upload the file and put it in //done all we can do (upload the file and put it in the
//the library), now lets just return. //library), now lets just return.
$showCanceled = true; $showCanceled = true;
} }
@ -444,7 +445,7 @@ class ApiController extends Zend_Controller_Action
if (!$showCanceled && Application_Model_Preference::GetAutoUploadRecordedShowToSoundcloud()) { if (!$showCanceled && Application_Model_Preference::GetAutoUploadRecordedShowToSoundcloud()) {
$id = $file->getId(); $id = $file->getId();
$res = exec("/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &"); Application_Model_Soundcloud::uploadSoundcloud($id);
} }
} }

View file

@ -25,9 +25,7 @@ class DashboardController extends Zend_Controller_Action
$user = new Application_Model_User($userInfo->id); $user = new Application_Model_User($userInfo->id);
$show = Application_Model_Show::getCurrentShow(); $show = Application_Model_Show::getCurrentShow();
$show_id = isset($show[0]['id'])?$show[0]['id']:0;
$show_id = isset($show['id'])?$show['id']:0;
$source_connected = Application_Model_Preference::GetSourceStatus($sourcename); $source_connected = Application_Model_Preference::GetSourceStatus($sourcename);
if ($user->canSchedule($show_id) && $source_connected) { if ($user->canSchedule($show_id) && $source_connected) {

View file

@ -469,7 +469,7 @@ class LibraryController extends Zend_Controller_Action
public function uploadFileSoundcloudAction() public function uploadFileSoundcloudAction()
{ {
$id = $this->_getParam('id'); $id = $this->_getParam('id');
$res = exec("/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &"); Application_Model_Soundcloud::uploadSoundcloud($id);
// we should die with ui info // we should die with ui info
die(); die();
} }

View file

@ -217,7 +217,8 @@ class ScheduleController extends Zend_Controller_Action
$file = $show_inst->getRecordedFile(); $file = $show_inst->getRecordedFile();
$id = $file->getId(); $id = $file->getId();
$res = exec("/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &"); //$res = exec("/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &");
Application_Model_Soundcloud::uploadSoundcloud($id);
// we should die with ui info // we should die with ui info
die(); die();
} }

View file

@ -52,7 +52,6 @@ class Application_Model_Soundcloud
//YYYY-MM-DD-HH-mm-SS //YYYY-MM-DD-HH-mm-SS
$release = explode("-", $release); $release = explode("-", $release);
$track_data['track[release_year]'] = $release[0]; $track_data['track[release_year]'] = $release[0];
$track_data['track[release_month]'] = $release[1]; $track_data['track[release_month]'] = $release[1];
$track_data['track[release_day]'] = $release[2]; $track_data['track[release_day]'] = $release[2];
@ -87,6 +86,13 @@ class Application_Model_Soundcloud
throw new NoSoundCloundToken(); throw new NoSoundCloundToken();
} }
} }
public static function uploadSoundcloud($id)
{
$cmd = "/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &";
Logging::info("Uploading soundcloud with command: $cmd");
exec($cmd);
}
} }
class NoSoundCloundToken extends Exception {} class NoSoundCloundToken extends Exception {}

View file

@ -35,7 +35,6 @@ class Application_Model_User
public function isHostOfShow($showId) public function isHostOfShow($showId)
{ {
$userId = $this->_userInstance->getDbId(); $userId = $this->_userInstance->getDbId();
return CcShowHostsQuery::create() return CcShowHostsQuery::create()
->filterByDbShow($showId) ->filterByDbShow($showId)
->filterByDbHost($userId)->count() > 0; ->filterByDbHost($userId)->count() > 0;
@ -63,10 +62,9 @@ class Application_Model_User
if ($type === UTYPE_ADMIN || if ($type === UTYPE_ADMIN ||
$type === UTYPE_PROGRAM_MANAGER || $type === UTYPE_PROGRAM_MANAGER ||
CcShowHostsQuery::create()->filterByDbShow($p_showId)->filterByDbHost($this->getId())->count() > 0) { self::isHostOfShow($p_showId)) {
$result = true; $result = true;
} }
return $result; return $result;
} }

View file

@ -33,6 +33,7 @@ set_include_path(implode(PATH_SEPARATOR, array(
require_once($CC_CONFIG['phpDir'].'/application/models/StoredFile.php'); require_once($CC_CONFIG['phpDir'].'/application/models/StoredFile.php');
require_once($CC_CONFIG['phpDir'].'/application/models/Preference.php'); require_once($CC_CONFIG['phpDir'].'/application/models/Preference.php');
require_once($CC_CONFIG['phpDir'].'/application/models/MusicDir.php'); require_once($CC_CONFIG['phpDir'].'/application/models/MusicDir.php');
require_once($CC_CONFIG['phpDir'].'/application/common/OsPath.php');
set_include_path($CC_CONFIG['phpDir'].'/library' . PATH_SEPARATOR . get_include_path()); set_include_path($CC_CONFIG['phpDir'].'/library' . PATH_SEPARATOR . get_include_path());
require_once($CC_CONFIG['phpDir'].'/application/models/Soundcloud.php'); require_once($CC_CONFIG['phpDir'].'/application/models/Soundcloud.php');