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);
}
// The paramterized version of the uploadRecordedAction controller. We want this controller's action
// to be invokable from other controllers instead being of only through http
// The paramterized version of the uploadRecordedAction controller.
// 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)
{
$showCanceled = false;
@ -430,10 +431,10 @@ class ApiController extends Zend_Controller_Action
} catch (Exception $e) {
//we've reached here probably because the show was
//cancelled, and therefore the show instance does not
//exist anymore (ShowInstance constructor threw this error).
//We've done all we can do (upload the file and put it in
//the library), now lets just return.
//cancelled, and therefore the show instance does not exist
//anymore (ShowInstance constructor threw this error). We've
//done all we can do (upload the file and put it in the
//library), now lets just return.
$showCanceled = true;
}
@ -444,7 +445,7 @@ class ApiController extends Zend_Controller_Action
if (!$showCanceled && Application_Model_Preference::GetAutoUploadRecordedShowToSoundcloud()) {
$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);
$show = Application_Model_Show::getCurrentShow();
$show_id = isset($show['id'])?$show['id']:0;
$show_id = isset($show[0]['id'])?$show[0]['id']:0;
$source_connected = Application_Model_Preference::GetSourceStatus($sourcename);
if ($user->canSchedule($show_id) && $source_connected) {

View file

@ -469,7 +469,7 @@ class LibraryController extends Zend_Controller_Action
public function uploadFileSoundcloudAction()
{
$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
die();
}

View file

@ -217,7 +217,8 @@ class ScheduleController extends Zend_Controller_Action
$file = $show_inst->getRecordedFile();
$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
die();
}

View file

@ -52,7 +52,6 @@ class Application_Model_Soundcloud
//YYYY-MM-DD-HH-mm-SS
$release = explode("-", $release);
$track_data['track[release_year]'] = $release[0];
$track_data['track[release_month]'] = $release[1];
$track_data['track[release_day]'] = $release[2];
@ -87,6 +86,13 @@ class Application_Model_Soundcloud
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 {}

View file

@ -35,7 +35,6 @@ class Application_Model_User
public function isHostOfShow($showId)
{
$userId = $this->_userInstance->getDbId();
return CcShowHostsQuery::create()
->filterByDbShow($showId)
->filterByDbHost($userId)->count() > 0;
@ -63,10 +62,9 @@ class Application_Model_User
if ($type === UTYPE_ADMIN ||
$type === UTYPE_PROGRAM_MANAGER ||
CcShowHostsQuery::create()->filterByDbShow($p_showId)->filterByDbHost($this->getId())->count() > 0) {
self::isHostOfShow($p_showId)) {
$result = true;
}
return $result;
}
@ -210,7 +208,7 @@ class Application_Model_User
$this->_userInstance->delete();
}
}
public function getOwnedFiles()
public function getOwnedFiles()
{
$user = $this->_userInstance;
// do we need a find call at the end here?