cc-4396. Initial fix problem was a module was not being included in the soundcloud upload script.

This commit is contained in:
Rudi Grinberg 2012-09-17 15:24:02 -04:00
parent ed45011b40
commit 4f576afc00
5 changed files with 19 additions and 10 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

@ -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

@ -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');