Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
Conflicts: airtime_mvc/application/controllers/LibraryController.php
This commit is contained in:
commit
c84690adaa
28 changed files with 831 additions and 238 deletions
|
@ -402,7 +402,7 @@ class ApiController extends Zend_Controller_Action
|
|||
try {
|
||||
$soundcloud = new ATSoundcloud();
|
||||
$soundcloud_id = $soundcloud->uploadTrack($file->getFilePath(), $tmpTitle, $description, $tags, $show_start_time, $show_genre);
|
||||
$show_inst->setSoundCloudFileId($soundcloud_id);
|
||||
$file->setSoundCloudFileId($soundcloud_id);
|
||||
break;
|
||||
}
|
||||
catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
|
||||
|
|
|
@ -13,6 +13,8 @@ class LibraryController extends Zend_Controller_Action
|
|||
->addActionContext('delete', 'json')
|
||||
->addActionContext('context-menu', 'json')
|
||||
->addActionContext('get-file-meta-data', 'html')
|
||||
->addActionContext('upload-file-soundcloud', 'json')
|
||||
->addActionContext('get-upload-to-sc-status', 'json')
|
||||
->initContext();
|
||||
|
||||
$this->pl_sess = new Zend_Session_Namespace(UI_PLAYLIST_SESSNAME);
|
||||
|
@ -33,6 +35,8 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/contextmenu.css');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/qtip/jquery.qtip.min.css');
|
||||
|
||||
|
||||
$this->_helper->layout->setLayout('library');
|
||||
$this->_helper->viewRenderer->setResponseSegment('library');
|
||||
|
@ -86,7 +90,15 @@ class LibraryController extends Zend_Controller_Action
|
|||
$url = $file->getRelativeFileUrl($baseUrl).'/api_key/'.$CC_CONFIG["apiKey"][0].'/download/true';
|
||||
$menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
|
||||
'title' => 'Download');
|
||||
|
||||
|
||||
if (Application_Model_Preference::GetDoSoundCloudUpload()) {
|
||||
$text = "Upload to Soundcloud";
|
||||
if(!is_null($file->getSoundCloudId())){
|
||||
$text = "Re-upload to Soundcloud";
|
||||
}
|
||||
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Library/upload-file-soundcloud/id/#id#',
|
||||
'callback'=>"window['addProgressIcon']('$file_id')"),'title' => $text);
|
||||
}
|
||||
|
||||
if ($user->isAdmin()) {
|
||||
$menu[] = array('action' => array('type' => 'fn',
|
||||
|
@ -167,6 +179,17 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
//format clip lengh to 1 decimal
|
||||
foreach($datatables["aaData"] as &$data){
|
||||
if($data[6] == 'audioclip'){
|
||||
$file = StoredFile::Recall($data[0]);
|
||||
$scid = $file->getSoundCloudId();
|
||||
if($scid == "-2"){
|
||||
$data[1] .= '<span id="'.$data[0].'" class="small-icon progress"></span>';
|
||||
}else if($scid == "-3"){
|
||||
$data[1] .= '<span id="'.$data[0].'" class="small-icon sc-error"></span>';
|
||||
}else if(!is_null($scid)){
|
||||
$data[1] .= '<span id="'.$data[0].'" class="small-icon soundcloud"></span>';
|
||||
}
|
||||
}
|
||||
$sec = Application_Model_Playlist::playlistTimeToSeconds($data[5]);
|
||||
$data[5] = Application_Model_Playlist::secondsToPlaylistTime($sec);
|
||||
}
|
||||
|
@ -218,4 +241,28 @@ class LibraryController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
public function uploadFileSoundcloudAction(){
|
||||
$id = $this->_getParam('id');
|
||||
$res = exec("/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &");
|
||||
// we should die with ui info
|
||||
die();
|
||||
}
|
||||
|
||||
public function getUploadToScStatusAction(){
|
||||
$id = $this->_getParam('id');
|
||||
$type = $this->_getParam('type');
|
||||
if($type == "show"){
|
||||
$show_instance = new 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();
|
||||
}else{
|
||||
$file = StoredFile::Recall($id);
|
||||
$this->view->sc_id = $file->getSoundCloudId();
|
||||
$this->view->error_code = $file->getSoundCloudErrorCode();
|
||||
$this->view->error_msg = $file->getSoundCloudErrorMsg();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/colorpicker/css/colorpicker.css');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/add-show.css');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/contextmenu.css');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/qtip/jquery.qtip.min.css');
|
||||
|
||||
Schedule::createNewFormSections($this->view);
|
||||
|
||||
|
@ -134,43 +135,10 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$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']);
|
||||
}
|
||||
}
|
||||
$id = $file->getId();
|
||||
$res = exec("/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &");
|
||||
// we should die with ui info
|
||||
die();
|
||||
}
|
||||
|
||||
public function makeContextMenuAction()
|
||||
|
@ -206,12 +174,17 @@ class ScheduleController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
if ($showEndDateHelper->getTimestamp() <= $epochNow
|
||||
&& is_null($show->getSoundCloudFileId())
|
||||
&& $show->isRecorded()
|
||||
&& Application_Model_Preference::GetDoSoundCloudUpload()) {
|
||||
$menu[] = array('action' => array('type' => 'fn',
|
||||
'callback' => "window['uploadToSoundCloud']($id)"),
|
||||
'title' => 'Upload to Soundcloud');
|
||||
if(is_null($show->getSoundCloudFileId())){
|
||||
$menu[] = array('action' => array('type' => 'fn',
|
||||
'callback' => "window['uploadToSoundCloud']($id)"),
|
||||
'title' => 'Upload to Soundcloud');
|
||||
}else{
|
||||
$menu[] = array('action' => array('type' => 'fn',
|
||||
'callback' => "window['uploadToSoundCloud']($id)"),
|
||||
'title' => 'Re-upload to Soundcloud');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue