CC-6046, CC-6045, CC-6047 - New SoundCloud implementation

This commit is contained in:
Duncan Sommerville 2015-06-03 16:57:17 -04:00
parent 51a3f19f43
commit b0b6e037ac
62 changed files with 4009 additions and 2491 deletions

View file

@ -265,8 +265,9 @@ class LibraryController extends Zend_Controller_Action
}
}
//SOUNDCLOUD MENU OPTIONS
if ($type === "audioclip" && Application_Model_Preference::GetUploadToSoundcloudOption()) {
// SOUNDCLOUD MENU OPTION
$soundcloudService = new SoundcloudService();
if ($type === "audioclip" && $soundcloudService->hasAccessToken()) {
//create a menu separator
$menu["sep1"] = "-----------";
@ -274,20 +275,16 @@ class LibraryController extends Zend_Controller_Action
//create a sub menu for Soundcloud actions.
$menu["soundcloud"] = array("name" => _("Soundcloud"), "icon" => "soundcloud", "items" => array());
$scid = $file->getSoundCloudId();
if ($scid > 0) {
$url = $file->getSoundCloudLinkToFile();
$menu["soundcloud"]["items"]["view"] = array("name" => _("View on Soundcloud"), "icon" => "soundcloud", "url" => $url);
}
if (!is_null($scid)) {
$serviceId = $soundcloudService->getServiceId($id);
if (!is_null($file) && $serviceId != 0) {
$menu["soundcloud"]["items"]["view"] = array("name" => _("View on Soundcloud"), "icon" => "soundcloud", "url" => $baseUrl."soundcloud/view-on-sound-cloud/id/{$id}");
$text = _("Re-upload to SoundCloud");
} else {
$text = _("Upload to SoundCloud");
}
$menu["soundcloud"]["items"]["upload"] = array("name" => $text, "icon" => "soundcloud", "url" => $baseUrl."library/upload-file-soundcloud/id/{$id}");
// TODO: reimplement how this works
$menu["soundcloud"]["items"]["upload"] = array("name" => $text, "icon" => "soundcloud", "url" => $baseUrl."soundcloud/upload/id/{$id}");
}
if (empty($menu)) {
@ -525,33 +522,4 @@ class LibraryController extends Zend_Controller_Action
Logging::info($e->getMessage());
}
}
public function uploadFileSoundcloudAction()
{
$id = $this->_getParam('id');
Application_Model_Soundcloud::uploadSoundcloud($id);
// we should die with ui info
$this->_helper->json->sendJson(null);
}
public function getUploadToSoundcloudStatusAction()
{
$id = $this->_getParam('id');
$type = $this->_getParam('type');
if ($type == "show") {
$show_instance = new Application_Model_ShowInstance($id);
$this->view->sc_id = $show_instance->getSoundCloudFileId();
$file = $show_instance->getRecordedFile();
$this->view->error_code = $file->getSoundCloudErrorCode();
$this->view->error_msg = $file->getSoundCloudErrorMsg();
} elseif ($type == "file") {
$file = Application_Model_StoredFile::RecallById($id);
$this->view->sc_id = $file->getSoundCloudId();
$this->view->error_code = $file->getSoundCloudErrorCode();
$this->view->error_msg = $file->getSoundCloudErrorMsg();
} else {
Logging::warn("Trying to upload unknown type: $type with id: $id");
}
}
}