public function uploadToSoundCloudAction() { global $CC_CONFIG; $show_instance = $this->_getParam('id'); $show_inst = new ShowInstance($show_instance); $file = $show_inst->getRecordedFile(); if (is_null($file)) { $this->view->error = "Recorded file does not exist"; return; } $show_name = $show_inst->getName(); $show_genre = $show_inst->getGenre(); $show_start_time = $show_inst->getShowStart(); if (Application_Model_Preference::GetDoSoundCloudUpload()) { for ($i = 0; $i < $CC_CONFIG['soundcloud-connection-retries']; $i++) { $show = new Show($show_inst->getShowId()); $description = $show->getDescription(); $hosts = $show->getHosts(); $tags = array_merge($hosts, array($show_name)); try { $soundcloud = new ATSoundcloud(); $soundcloud_id = $soundcloud->uploadTrack($file->getFilePath(), $file->getName(), $description, $tags, $show_start_time, $show_genre); $show_inst->setSoundCloudFileId($soundcloud_id); $this->view->soundcloud_id = $soundcloud_id; break; } catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) { $code = $e->getHttpCode(); if (!in_array($code, array(0, 100))) { break; } } sleep($CC_CONFIG['soundcloud-connection-wait']); } } }