2010-12-07 20:19:27 +01:00
|
|
|
<?php
|
|
|
|
|
2012-02-27 12:23:22 +01:00
|
|
|
require_once 'formatters/LengthFormatter.php';
|
|
|
|
require_once 'formatters/SamplerateFormatter.php';
|
|
|
|
require_once 'formatters/BitrateFormatter.php';
|
|
|
|
|
2010-12-07 20:19:27 +01:00
|
|
|
class LibraryController extends Zend_Controller_Action
|
|
|
|
{
|
2011-01-05 01:18:44 +01:00
|
|
|
|
2012-07-25 17:00:46 +02:00
|
|
|
protected $obj_sess = null;
|
2011-02-10 04:37:18 +01:00
|
|
|
protected $search_sess = null;
|
2011-01-05 01:18:44 +01:00
|
|
|
|
2010-12-07 20:19:27 +01:00
|
|
|
public function init()
|
|
|
|
{
|
|
|
|
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
2012-03-12 15:32:24 +01:00
|
|
|
$ajaxContext->addActionContext('contents-feed', 'json')
|
2011-04-18 18:43:04 +02:00
|
|
|
->addActionContext('delete', 'json')
|
2012-01-08 05:37:37 +01:00
|
|
|
->addActionContext('delete-group', 'json')
|
2011-04-18 18:43:04 +02:00
|
|
|
->addActionContext('context-menu', 'json')
|
2012-07-31 03:48:04 +02:00
|
|
|
->addActionContext('get-file-metadata', 'html')
|
2011-09-22 17:47:24 +02:00
|
|
|
->addActionContext('upload-file-soundcloud', 'json')
|
2011-09-22 20:01:05 +02:00
|
|
|
->addActionContext('get-upload-to-soundcloud-status', 'json')
|
2011-10-18 16:10:35 +02:00
|
|
|
->addActionContext('set-num-entries', 'json')
|
2010-12-07 20:19:27 +01:00
|
|
|
->initContext();
|
|
|
|
|
2012-07-25 17:00:46 +02:00
|
|
|
$this->obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME);
|
2011-04-18 18:43:04 +02:00
|
|
|
$this->search_sess = new Zend_Session_Namespace("search");
|
2010-12-07 20:19:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function contextMenuAction()
|
|
|
|
{
|
2010-12-30 23:26:44 +01:00
|
|
|
$id = $this->_getParam('id');
|
2011-04-18 18:43:04 +02:00
|
|
|
$type = $this->_getParam('type');
|
2012-02-05 18:19:22 +01:00
|
|
|
//playlist||timeline
|
|
|
|
$screen = $this->_getParam('screen');
|
2011-06-24 22:04:57 +02:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$baseUrl = $request->getBaseUrl();
|
2012-02-08 12:53:46 +01:00
|
|
|
$menu = array();
|
2010-12-22 05:33:58 +01:00
|
|
|
|
2011-07-18 19:48:20 +02:00
|
|
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
2011-09-23 23:00:55 +02:00
|
|
|
$user = new Application_Model_User($userInfo->id);
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2012-07-16 03:17:13 +02:00
|
|
|
//Open a jPlayer window and play the audio clip.
|
2012-06-28 19:33:01 +02:00
|
|
|
$menu["play"] = array("name"=> "Preview", "icon" => "play");
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2012-06-06 23:31:51 +02:00
|
|
|
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
2011-07-18 19:48:20 +02:00
|
|
|
|
2012-02-02 15:51:15 +01:00
|
|
|
if ($type === "audioclip") {
|
2010-12-07 20:19:27 +01:00
|
|
|
|
2012-02-02 15:51:15 +01:00
|
|
|
$file = Application_Model_StoredFile::Recall($id);
|
2010-12-07 20:19:27 +01:00
|
|
|
|
2012-07-25 17:00:46 +02:00
|
|
|
if (isset($this->obj_sess->id) && $screen == "playlist") {
|
2012-07-25 23:08:22 +02:00
|
|
|
// if the user is not admin or pm, check the creator and see if this person owns the playlist or Block
|
|
|
|
if ($this->obj_sess->type == 'playlist') {
|
|
|
|
$obj = new Application_Model_Playlist($this->obj_sess->id);
|
|
|
|
} else {
|
|
|
|
$obj = new Application_Model_Block($this->obj_sess->id);
|
|
|
|
}
|
|
|
|
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
|
2012-07-26 19:16:29 +02:00
|
|
|
if ($this->obj_sess->type === "playlist") {
|
|
|
|
$menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "add-playlist", "icon" => "copy");
|
|
|
|
} else {
|
|
|
|
$menu["pl_add"] = array("name"=> "Add to Smart Playlist", "icon" => "add-playlist", "icon" => "copy");
|
|
|
|
}
|
2012-06-06 23:31:51 +02:00
|
|
|
}
|
2012-02-24 15:07:04 +01:00
|
|
|
}
|
2012-06-06 23:31:51 +02:00
|
|
|
if ($isAdminOrPM) {
|
2012-02-05 18:19:22 +01:00
|
|
|
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete");
|
2012-06-06 23:31:51 +02:00
|
|
|
$menu["edit"] = array("name"=> "Edit Metadata", "icon" => "edit", "url" => "/library/edit-file-md/id/{$id}");
|
2011-04-18 18:43:04 +02:00
|
|
|
}
|
|
|
|
|
2012-03-02 23:55:17 +01:00
|
|
|
$url = $file->getRelativeFileUrl($baseUrl).'/download/true';
|
2012-06-06 23:31:51 +02:00
|
|
|
$menu["download"] = array("name" => "Download", "icon" => "download", "url" => $url);
|
2012-07-25 23:08:22 +02:00
|
|
|
} elseif ($type === "playlist" || $type === "block") {
|
|
|
|
if ($type === 'playlist') {
|
|
|
|
$obj = new Application_Model_Playlist($id);
|
|
|
|
} else {
|
|
|
|
$obj = new Application_Model_Block($id);
|
2012-08-02 22:36:12 +02:00
|
|
|
if (!$obj->isStatic()){
|
|
|
|
unset($menu["play"]);
|
|
|
|
}
|
2012-08-02 22:50:35 +02:00
|
|
|
if (($isAdminOrPM || $obj->getCreatorId() == $user->getId()) && $screen == "playlist") {
|
2012-07-26 19:16:29 +02:00
|
|
|
if ($this->obj_sess->type === "playlist") {
|
|
|
|
$menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "add-playlist", "icon" => "copy");
|
|
|
|
}
|
2012-07-26 18:45:31 +02:00
|
|
|
}
|
2012-07-25 23:08:22 +02:00
|
|
|
}
|
|
|
|
|
2012-07-25 17:00:46 +02:00
|
|
|
if ($this->obj_sess->id !== $id && $screen == "playlist") {
|
2012-07-25 23:08:22 +02:00
|
|
|
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
|
2012-06-06 23:31:51 +02:00
|
|
|
$menu["edit"] = array("name"=> "Edit", "icon" => "edit");
|
|
|
|
}
|
|
|
|
}
|
2012-07-25 23:08:22 +02:00
|
|
|
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
|
2012-06-06 23:31:51 +02:00
|
|
|
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete");
|
2011-04-18 18:43:04 +02:00
|
|
|
}
|
2012-07-31 03:48:04 +02:00
|
|
|
} else if ($type == "stream") {
|
|
|
|
|
|
|
|
$obj = new Application_Model_Webstream($id);
|
|
|
|
if (isset($this->obj_sess->id) && $screen == "playlist") {
|
|
|
|
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
|
|
|
|
if ($this->obj_sess->type === "playlist") {
|
|
|
|
$menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "add-playlist", "icon" => "copy");
|
|
|
|
} else {
|
|
|
|
$menu["pl_add"] = array("name"=> "Add to Smart Playlist", "icon" => "add-playlist", "icon" => "copy");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
|
|
|
|
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete");
|
|
|
|
$menu["edit"] = array("name"=> "Edit", "icon" => "edit", "url" => "/library/edit-file-md/id/{$id}");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-04-18 18:43:04 +02:00
|
|
|
}
|
2010-12-30 00:43:17 +01:00
|
|
|
|
2012-05-14 12:36:57 +02:00
|
|
|
//SOUNDCLOUD MENU OPTIONS
|
2012-07-16 03:17:13 +02:00
|
|
|
if ($type === "audioclip" && Application_Model_Preference::GetUploadToSoundcloudOption()) {
|
|
|
|
|
|
|
|
//create a menu separator
|
|
|
|
$menu["sep1"] = "-----------";
|
|
|
|
|
|
|
|
//create a sub menu for Soundcloud actions.
|
|
|
|
$menu["soundcloud"] = array("name" => "Soundcloud", "icon" => "soundcloud", "items" => array());
|
|
|
|
|
2012-05-14 15:48:09 +02:00
|
|
|
$scid = $file->getSoundCloudId();
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2012-07-16 03:17:13 +02:00
|
|
|
if ($scid > 0) {
|
|
|
|
$url = $file->getSoundCloudLinkToFile();
|
|
|
|
$menu["soundcloud"]["items"]["view"] = array("name" => "View on Soundcloud", "icon" => "soundcloud", "url" => $url);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!is_null($scid)) {
|
|
|
|
$text = "Re-upload to SoundCloud";
|
|
|
|
} else {
|
|
|
|
$text = "Upload to SoundCloud";
|
|
|
|
}
|
|
|
|
|
|
|
|
$menu["soundcloud"]["items"]["upload"] = array("name" => $text, "icon" => "soundcloud", "url" => "/library/upload-file-soundcloud/id/{$id}");
|
2012-05-14 12:36:57 +02:00
|
|
|
}
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2012-02-05 13:56:07 +01:00
|
|
|
$this->view->items = $menu;
|
2010-12-07 20:19:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function deleteAction()
|
|
|
|
{
|
2012-02-05 18:19:22 +01:00
|
|
|
//array containing id and type of media to delete.
|
|
|
|
$mediaItems = $this->_getParam('media', null);
|
2011-07-18 19:48:20 +02:00
|
|
|
|
2012-07-11 00:51:32 +02:00
|
|
|
$user = Application_Model_User::getCurrentUser();
|
2012-06-06 23:31:51 +02:00
|
|
|
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
2011-07-18 19:48:20 +02:00
|
|
|
|
2012-02-05 18:19:22 +01:00
|
|
|
$files = array();
|
|
|
|
$playlists = array();
|
2012-07-25 23:08:22 +02:00
|
|
|
$blocks = array();
|
2012-07-31 03:48:04 +02:00
|
|
|
$streams = array();
|
2011-07-18 19:48:20 +02:00
|
|
|
|
2012-02-05 18:19:22 +01:00
|
|
|
$message = null;
|
2011-07-18 19:48:20 +02:00
|
|
|
|
2012-02-05 18:19:22 +01:00
|
|
|
foreach ($mediaItems as $media) {
|
2011-07-18 19:48:20 +02:00
|
|
|
|
2012-02-05 18:19:22 +01:00
|
|
|
if ($media["type"] === "audioclip") {
|
|
|
|
$files[] = intval($media["id"]);
|
2012-07-16 03:17:13 +02:00
|
|
|
} elseif ($media["type"] === "playlist") {
|
2012-02-05 18:19:22 +01:00
|
|
|
$playlists[] = intval($media["id"]);
|
2012-07-25 23:08:22 +02:00
|
|
|
} elseif ($media["type"] === "block") {
|
|
|
|
$blocks[] = intval($media["id"]);
|
2012-07-31 03:48:04 +02:00
|
|
|
} elseif ($media["type"] === "stream") {
|
|
|
|
$streams[] = intval($media["id"]);
|
2011-05-17 23:30:17 +02:00
|
|
|
}
|
2012-02-05 18:19:22 +01:00
|
|
|
}
|
2011-04-18 18:43:04 +02:00
|
|
|
|
2012-07-10 23:24:57 +02:00
|
|
|
try {
|
2012-07-31 03:48:04 +02:00
|
|
|
Application_Model_Playlist::deletePlaylists($playlists, $user->getId());
|
2012-07-10 23:24:57 +02:00
|
|
|
} catch (PlaylistNoPermissionException $e) {
|
2012-07-25 23:08:22 +02:00
|
|
|
$this->view->message = "You don't have permission to delete selected items.";
|
2012-02-05 18:19:22 +01:00
|
|
|
return;
|
|
|
|
}
|
2012-01-16 09:56:57 +01:00
|
|
|
|
2012-07-31 03:48:04 +02:00
|
|
|
|
|
|
|
try {
|
|
|
|
Application_Model_Block::deleteBlocks($blocks, $user->getId());
|
|
|
|
} catch (Exception $e) {
|
|
|
|
//TODO: warn user that not all blocks could be deleted.
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
Application_Model_Webstream::deleteStreams($streams, $user->getId());
|
|
|
|
} catch (Exception $e) {
|
|
|
|
//TODO: warn user that not all streams could be deleted.
|
|
|
|
Logging::log($e);
|
|
|
|
}
|
|
|
|
|
2012-02-05 18:19:22 +01:00
|
|
|
foreach ($files as $id) {
|
|
|
|
|
|
|
|
$file = Application_Model_StoredFile::Recall($id);
|
|
|
|
|
|
|
|
if (isset($file)) {
|
|
|
|
try {
|
2012-02-06 11:07:10 +01:00
|
|
|
$res = $file->delete(true);
|
2012-07-31 03:48:04 +02:00
|
|
|
} catch (Exception $e) {
|
|
|
|
//could throw a scheduled in future exception.
|
2012-02-05 18:19:22 +01:00
|
|
|
$message = "Could not delete some scheduled files.";
|
2012-01-08 05:37:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-02-05 18:19:22 +01:00
|
|
|
|
|
|
|
if (isset($message)) {
|
|
|
|
$this->view->message = $message;
|
|
|
|
}
|
2012-01-08 05:37:37 +01:00
|
|
|
}
|
2010-12-07 20:19:27 +01:00
|
|
|
|
2012-03-12 15:32:24 +01:00
|
|
|
public function contentsFeedAction()
|
2010-12-07 20:19:27 +01:00
|
|
|
{
|
2012-01-27 21:06:04 +01:00
|
|
|
$params = $this->getRequest()->getParams();
|
2012-07-25 23:08:22 +02:00
|
|
|
|
2012-03-12 15:32:24 +01:00
|
|
|
$r = Application_Model_StoredFile::searchLibraryFiles($params);
|
2012-01-16 09:56:57 +01:00
|
|
|
|
2012-02-05 19:48:23 +01:00
|
|
|
//TODO move this to the datatables row callback.
|
2012-03-12 15:32:24 +01:00
|
|
|
foreach ($r["aaData"] as &$data) {
|
2012-02-05 19:48:23 +01:00
|
|
|
|
2012-07-16 03:17:13 +02:00
|
|
|
if ($data['ftype'] == 'audioclip') {
|
2012-01-11 16:41:58 +01:00
|
|
|
$file = Application_Model_StoredFile::Recall($data['id']);
|
2011-09-22 17:47:24 +02:00
|
|
|
$scid = $file->getSoundCloudId();
|
2012-02-05 19:48:23 +01:00
|
|
|
|
2012-07-16 03:17:13 +02:00
|
|
|
if ($scid == "-2") {
|
2012-02-05 19:48:23 +01:00
|
|
|
$data['track_title'] .= '<span class="small-icon progress"/>';
|
2012-07-16 03:17:13 +02:00
|
|
|
} elseif ($scid == "-3") {
|
2012-02-05 19:48:23 +01:00
|
|
|
$data['track_title'] .= '<span class="small-icon sc-error"/>';
|
2012-07-16 03:17:13 +02:00
|
|
|
} elseif (!is_null($scid)) {
|
2012-02-05 19:48:23 +01:00
|
|
|
$data['track_title'] .= '<span class="small-icon soundcloud"/>';
|
2011-09-22 17:47:24 +02:00
|
|
|
}
|
|
|
|
}
|
2011-06-24 21:51:21 +02:00
|
|
|
}
|
2012-07-16 03:17:13 +02:00
|
|
|
|
|
|
|
$this->view->sEcho = $r["sEcho"];
|
|
|
|
$this->view->iTotalDisplayRecords = $r["iTotalDisplayRecords"];
|
|
|
|
$this->view->iTotalRecords = $r["iTotalRecords"];
|
2012-03-12 15:32:24 +01:00
|
|
|
$this->view->files = $r["aaData"];
|
2010-12-07 20:19:27 +01:00
|
|
|
}
|
|
|
|
|
2010-12-30 23:26:44 +01:00
|
|
|
public function editFileMdAction()
|
2010-12-07 20:19:27 +01:00
|
|
|
{
|
2012-07-11 00:51:32 +02:00
|
|
|
$user = Application_Model_User::getCurrentUser();
|
2012-06-06 23:31:51 +02:00
|
|
|
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
2012-07-16 03:17:13 +02:00
|
|
|
if (!$isAdminOrPM) {
|
2012-06-06 23:31:51 +02:00
|
|
|
return;
|
|
|
|
}
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2010-12-30 23:26:44 +01:00
|
|
|
$request = $this->getRequest();
|
2011-05-17 23:30:17 +02:00
|
|
|
$form = new Application_Form_EditAudioMD();
|
2011-11-29 16:20:09 +01:00
|
|
|
|
2011-02-24 17:06:19 +01:00
|
|
|
$file_id = $this->_getParam('id', null);
|
2011-09-22 18:24:17 +02:00
|
|
|
$file = Application_Model_StoredFile::Recall($file_id);
|
2011-08-30 22:50:46 +02:00
|
|
|
$form->populate($file->getDbColMetadata());
|
2011-05-17 23:30:17 +02:00
|
|
|
|
2010-12-30 23:26:44 +01:00
|
|
|
if ($request->isPost()) {
|
2011-05-17 23:30:17 +02:00
|
|
|
if ($form->isValid($request->getPost())) {
|
|
|
|
|
2011-04-18 18:43:04 +02:00
|
|
|
$formdata = $form->getValues();
|
2011-06-09 11:50:03 +02:00
|
|
|
$file->setDbColMetadata($formdata);
|
2010-12-30 23:26:44 +01:00
|
|
|
|
2011-06-15 14:20:14 +02:00
|
|
|
$data = $file->getMetadata();
|
2011-11-29 16:20:09 +01:00
|
|
|
|
2011-10-03 20:10:47 +02:00
|
|
|
// set MDATA_KEY_FILEPATH
|
|
|
|
$data['MDATA_KEY_FILEPATH'] = $file->getFilePath();
|
|
|
|
Logging::log($data['MDATA_KEY_FILEPATH']);
|
2011-09-26 21:19:04 +02:00
|
|
|
Application_Model_RabbitMq::SendMessageToMediaMonitor("md_update", $data);
|
2011-05-05 16:55:14 +02:00
|
|
|
|
2012-04-02 11:02:03 +02:00
|
|
|
$this->_redirect('playlist/index');
|
2010-12-30 23:26:44 +01:00
|
|
|
}
|
|
|
|
}
|
2011-02-24 17:06:19 +01:00
|
|
|
|
2010-12-30 23:26:44 +01:00
|
|
|
$this->view->form = $form;
|
2010-12-07 20:19:27 +01:00
|
|
|
}
|
2011-02-04 06:15:56 +01:00
|
|
|
|
2012-07-31 03:48:04 +02:00
|
|
|
public function getFileMetadataAction()
|
2011-02-04 06:15:56 +01:00
|
|
|
{
|
2011-02-04 07:28:55 +01:00
|
|
|
$id = $this->_getParam('id');
|
|
|
|
$type = $this->_getParam('type');
|
2011-02-04 06:15:56 +01:00
|
|
|
|
2012-02-06 11:59:20 +01:00
|
|
|
try {
|
|
|
|
if ($type == "audioclip") {
|
|
|
|
$file = Application_Model_StoredFile::Recall($id);
|
|
|
|
$this->view->type = $type;
|
2012-02-27 12:23:22 +01:00
|
|
|
$md = $file->getMetadata();
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2012-05-02 22:52:49 +02:00
|
|
|
foreach ($md as $key => $value) {
|
|
|
|
if ($key == 'MDATA_KEY_DIRECTORY') {
|
|
|
|
$musicDir = Application_Model_MusicDir::getDirByPK($value);
|
2012-05-03 15:59:31 +02:00
|
|
|
$md['MDATA_KEY_FILEPATH'] = Application_Common_OsPath::join($musicDir->getDirectory(), $md['MDATA_KEY_FILEPATH']);
|
2012-05-02 22:52:49 +02:00
|
|
|
}
|
|
|
|
}
|
2012-07-11 00:53:06 +02:00
|
|
|
|
2012-02-27 12:23:22 +01:00
|
|
|
$formatter = new SamplerateFormatter($md["MDATA_KEY_SAMPLERATE"]);
|
|
|
|
$md["MDATA_KEY_SAMPLERATE"] = $formatter->format();
|
|
|
|
|
|
|
|
$formatter = new BitrateFormatter($md["MDATA_KEY_BITRATE"]);
|
|
|
|
$md["MDATA_KEY_BITRATE"] = $formatter->format();
|
|
|
|
|
|
|
|
$formatter = new LengthFormatter($md["MDATA_KEY_DURATION"]);
|
|
|
|
$md["MDATA_KEY_DURATION"] = $formatter->format();
|
|
|
|
|
|
|
|
$this->view->md = $md;
|
|
|
|
|
2012-07-31 03:48:04 +02:00
|
|
|
} else if ($type == "playlist") {
|
2012-02-06 11:59:20 +01:00
|
|
|
|
|
|
|
$file = new Application_Model_Playlist($id);
|
|
|
|
$this->view->type = $type;
|
2012-02-27 12:23:22 +01:00
|
|
|
$md = $file->getAllPLMetaData();
|
|
|
|
|
|
|
|
$formatter = new LengthFormatter($md["dcterms:extent"]);
|
|
|
|
$md["dcterms:extent"] = $formatter->format();
|
|
|
|
|
|
|
|
$this->view->md = $md;
|
2012-02-06 11:59:20 +01:00
|
|
|
$this->view->contents = $file->getContents();
|
2012-08-01 18:04:48 +02:00
|
|
|
} else if ($type == "block") {
|
2012-08-02 22:36:12 +02:00
|
|
|
$block = new Application_Model_Block($id);
|
2012-08-01 18:04:48 +02:00
|
|
|
$this->view->type = $type;
|
2012-08-02 22:36:12 +02:00
|
|
|
$md = $block->getAllPLMetaData();
|
2012-08-01 18:04:48 +02:00
|
|
|
|
|
|
|
$formatter = new LengthFormatter($md["dcterms:extent"]);
|
|
|
|
$md["dcterms:extent"] = $formatter->format();
|
|
|
|
|
|
|
|
$this->view->md = $md;
|
2012-08-02 22:36:12 +02:00
|
|
|
if ($block->isStatic()) {
|
2012-08-01 18:04:48 +02:00
|
|
|
$this->view->blType = 'Static';
|
2012-08-02 22:36:12 +02:00
|
|
|
$this->view->contents = $block->getContents();
|
2012-08-01 18:04:48 +02:00
|
|
|
} else {
|
|
|
|
$this->view->blType = 'Dynamic';
|
2012-08-02 22:36:12 +02:00
|
|
|
$this->view->contents = $block->getCriteria();
|
2012-08-01 18:04:48 +02:00
|
|
|
}
|
2012-08-02 22:36:12 +02:00
|
|
|
$this->view->block = $block;
|
2012-07-31 03:48:04 +02:00
|
|
|
} else if ($type == "stream") {
|
|
|
|
$file = new Application_Model_Webstream($id);
|
|
|
|
|
|
|
|
$md = $file->getMetadata();
|
|
|
|
|
|
|
|
$this->view->md = $md;
|
|
|
|
$this->view->type = $type;
|
2012-02-06 11:59:20 +01:00
|
|
|
}
|
2012-07-16 03:17:13 +02:00
|
|
|
} catch (Exception $e) {
|
2012-02-06 11:59:20 +01:00
|
|
|
Logging::log($e->getMessage());
|
2011-02-04 06:15:56 +01:00
|
|
|
}
|
|
|
|
}
|
2011-11-29 16:20:09 +01:00
|
|
|
|
2012-07-16 03:17:13 +02:00
|
|
|
public function uploadFileSoundcloudAction()
|
|
|
|
{
|
2011-09-22 17:47:24 +02:00
|
|
|
$id = $this->_getParam('id');
|
|
|
|
$res = exec("/usr/lib/airtime/utils/soundcloud-uploader $id > /dev/null &");
|
|
|
|
// we should die with ui info
|
|
|
|
die();
|
|
|
|
}
|
2011-11-29 16:20:09 +01:00
|
|
|
|
2012-07-16 03:17:13 +02:00
|
|
|
public function getUploadToSoundcloudStatusAction()
|
|
|
|
{
|
2011-09-22 17:47:24 +02:00
|
|
|
$id = $this->_getParam('id');
|
|
|
|
$type = $this->_getParam('type');
|
2012-02-05 18:19:22 +01:00
|
|
|
|
|
|
|
if ($type == "show") {
|
2011-09-23 16:54:20 +02:00
|
|
|
$show_instance = new Application_Model_ShowInstance($id);
|
2011-09-22 17:47:24 +02:00
|
|
|
$this->view->sc_id = $show_instance->getSoundCloudFileId();
|
|
|
|
$file = $show_instance->getRecordedFile();
|
|
|
|
$this->view->error_code = $file->getSoundCloudErrorCode();
|
|
|
|
$this->view->error_msg = $file->getSoundCloudErrorMsg();
|
2012-07-16 03:17:13 +02:00
|
|
|
} elseif ($type == "file") {
|
2011-09-22 20:01:05 +02:00
|
|
|
$file = Application_Model_StoredFile::Recall($id);
|
2011-09-22 17:47:24 +02:00
|
|
|
$this->view->sc_id = $file->getSoundCloudId();
|
|
|
|
$this->view->error_code = $file->getSoundCloudErrorCode();
|
|
|
|
$this->view->error_msg = $file->getSoundCloudErrorMsg();
|
|
|
|
}
|
|
|
|
}
|
2010-12-07 20:19:27 +01:00
|
|
|
}
|