public function uploadToSoundCloud() { global $CC_CONFIG; $file = $this->_file; if (is_null($file)) { return "File does not exist"; } if (Application_Model_Preference::GetUploadToSoundcloudOption()) { for ($i = 0; $i < $CC_CONFIG['soundcloud-connection-retries']; $i++) { $description = $file->getDbTrackTitle(); $tag = array(); $genre = $file->getDbGenre(); $release = $file->getDbYear(); try { $soundcloud = new Application_Model_Soundcloud(); $soundcloud_res = $soundcloud->uploadTrack($this->getFilePath(), $this->getName(), $description, $tag, $release, $genre); $this->setSoundCloudFileId($soundcloud_res['id']); $this->setSoundCloudLinkToFile($soundcloud_res['permalink_url']); $this->setSoundCloudUploadTime(new DateTime("now"), new DateTimeZone("UTC")); break; } catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) { $code = $e->getHttpCode(); $msg = $e->getHttpBody(); // TODO : Do not parse JSON by hand $temp = explode('"error":', $msg); $msg = trim($temp[1], '"}'); $this->setSoundCloudErrorCode($code); $this->setSoundCloudErrorMsg($msg); // setting sc id to -3 which indicates error $this->setSoundCloudFileId(SOUNDCLOUD_ERROR); if (!in_array($code, array(0, 100))) { break; } } sleep($CC_CONFIG['soundcloud-connection-wait']); } } }
public function uploadToSoundCloudAction() { $show_instance = $this->_getParam('id'); try { $show_inst = new Application_Model_ShowInstance($show_instance); } catch (Exception $e) { $this->view->show_error = true; return false; } $file = $show_inst->getRecordedFile(); $id = $file->getId(); Application_Model_Soundcloud::uploadSoundcloud($id); // we should die with ui info die; }
public function uploadFileSoundcloudAction() { $id = $this->_getParam('id'); Application_Model_Soundcloud::uploadSoundcloud($id); // we should die with ui info die; }
public function uploadRecordedActionParam($show_instance_id, $file_id) { $showCanceled = false; $file = Application_Model_StoredFile::RecallById($file_id); //$show_instance = $this->_getParam('show_instance'); try { $show_inst = new Application_Model_ShowInstance($show_instance_id); $show_inst->setRecordedFile($file_id); } 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. $showCanceled = true; } // TODO : the following is inefficient because it calls save on both // fields $file->setMetadataValue('MDATA_KEY_CREATOR', "Airtime Show Recorder"); $file->setMetadataValue('MDATA_KEY_TRACKNUMBER', $show_instance_id); if (!$showCanceled && Application_Model_Preference::GetAutoUploadRecordedShowToSoundcloud()) { $id = $file->getId(); Application_Model_Soundcloud::uploadSoundcloud($id); } }
public function uploadFileSoundcloudAction() { $id = $this->_getParam('id'); Application_Model_Soundcloud::uploadSoundcloud($id); // we should die with ui info $this->_helper->json->sendJson(null); }