Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
martin 2011-09-22 16:10:32 -04:00
commit 1494e43ada
9 changed files with 37 additions and 50 deletions

View file

@ -14,7 +14,7 @@ class LibraryController extends Zend_Controller_Action
->addActionContext('context-menu', 'json') ->addActionContext('context-menu', 'json')
->addActionContext('get-file-meta-data', 'html') ->addActionContext('get-file-meta-data', 'html')
->addActionContext('upload-file-soundcloud', 'json') ->addActionContext('upload-file-soundcloud', 'json')
->addActionContext('get-upload-to-sc-status', 'json') ->addActionContext('get-upload-to-soundcloud-status', 'json')
->initContext(); ->initContext();
$this->pl_sess = new Zend_Session_Namespace(UI_PLAYLIST_SESSNAME); $this->pl_sess = new Zend_Session_Namespace(UI_PLAYLIST_SESSNAME);
@ -180,7 +180,7 @@ class LibraryController extends Zend_Controller_Action
//format clip lengh to 1 decimal //format clip lengh to 1 decimal
foreach($datatables["aaData"] as &$data){ foreach($datatables["aaData"] as &$data){
if($data[6] == 'audioclip'){ if($data[6] == 'audioclip'){
$file = StoredFile::Recall($data[0]); $file = Application_Model_StoredFile::Recall($data[0]);
$scid = $file->getSoundCloudId(); $scid = $file->getSoundCloudId();
if($scid == "-2"){ if($scid == "-2"){
$data[1] .= '<span id="'.$data[0].'" class="small-icon progress"></span>'; $data[1] .= '<span id="'.$data[0].'" class="small-icon progress"></span>';
@ -249,7 +249,7 @@ class LibraryController extends Zend_Controller_Action
die(); die();
} }
public function getUploadToScStatusAction(){ public function getUploadToSoundcloudStatusAction(){
$id = $this->_getParam('id'); $id = $this->_getParam('id');
$type = $this->_getParam('type'); $type = $this->_getParam('type');
if($type == "show"){ if($type == "show"){
@ -259,7 +259,7 @@ class LibraryController extends Zend_Controller_Action
$this->view->error_code = $file->getSoundCloudErrorCode(); $this->view->error_code = $file->getSoundCloudErrorCode();
$this->view->error_msg = $file->getSoundCloudErrorMsg(); $this->view->error_msg = $file->getSoundCloudErrorMsg();
}else{ }else{
$file = StoredFile::Recall($id); $file = Application_Model_StoredFile::Recall($id);
$this->view->sc_id = $file->getSoundCloudId(); $this->view->sc_id = $file->getSoundCloudId();
$this->view->error_code = $file->getSoundCloudErrorCode(); $this->view->error_code = $file->getSoundCloudErrorCode();
$this->view->error_msg = $file->getSoundCloudErrorMsg(); $this->view->error_msg = $file->getSoundCloudErrorMsg();

View file

@ -1245,7 +1245,7 @@ class Show {
// get soundcloud_id // get soundcloud_id
if(!is_null($show["file_id"])){ if(!is_null($show["file_id"])){
$file = StoredFile::Recall($show["file_id"]); $file = Application_Model_StoredFile::Recall($show["file_id"]);
$soundcloud_id = $file->getSoundCloudId(); $soundcloud_id = $file->getSoundCloudId();
}else{ }else{
$soundcloud_id = null; $soundcloud_id = null;
@ -1364,13 +1364,13 @@ class ShowInstance {
public function setSoundCloudFileId($p_soundcloud_id) public function setSoundCloudFileId($p_soundcloud_id)
{ {
$file = StoredFile::Recall($this->_showInstance->getDbRecordedFile()); $file = Application_Model_StoredFile::Recall($this->_showInstance->getDbRecordedFile());
$file->setSoundCloudFileId($p_soundcloud_id); $file->setSoundCloudFileId($p_soundcloud_id);
} }
public function getSoundCloudFileId() public function getSoundCloudFileId()
{ {
$file = StoredFile::Recall($this->_showInstance->getDbRecordedFile()); $file = Application_Model_StoredFile::Recall($this->_showInstance->getDbRecordedFile());
return $file->getSoundCloudId(); return $file->getSoundCloudId();
} }

View file

@ -438,10 +438,10 @@ class Application_Model_StoredFile {
* Get the URL to access this file. * Get the URL to access this file.
*/ */
public function getFileUrl() public function getFileUrl()
{ {
$serverName = $_SERVER['SERVER_NAME']; $serverName = $_SERVER['SERVER_NAME'];
$serverPort = $_SERVER['SERVER_PORT']; $serverPort = $_SERVER['SERVER_PORT'];
return "http://$serverName:$serverPort/api/get-media/file/".$this->getGunId().".".$this->getFileExtension(); return "http://$serverName:$serverPort/api/get-media/file/".$this->getGunId().".".$this->getFileExtension();
} }
@ -834,7 +834,7 @@ class Application_Model_StoredFile {
} }
if (file_exists($duplicate->getFilePath())) { if (file_exists($duplicate->getFilePath())) {
$duplicateName = $duplicate->getMetadataValue('MDATA_KEY_TITLE'); $duplicateName = $duplicate->getMetadataValue('MDATA_KEY_TITLE');
die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "An identical audioclip named ' . $duplicateName . ' already exists in the storage server."}}'); die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "An identical audioclip named \"' . $duplicateName . '\" already exists on the server."}}');
} }
} }
@ -878,39 +878,39 @@ class Application_Model_StoredFile {
return $results; return $results;
} }
public function setSoundCloudFileId($p_soundcloud_id) public function setSoundCloudFileId($p_soundcloud_id)
{ {
$this->_file->setDbSoundCloudId($p_soundcloud_id) $this->_file->setDbSoundCloudId($p_soundcloud_id)
->save(); ->save();
} }
public function getSoundCloudId(){ public function getSoundCloudId(){
return $this->_file->getDbSoundCloudId(); return $this->_file->getDbSoundCloudId();
} }
public function setSoundCloudErrorCode($code){ public function setSoundCloudErrorCode($code){
$this->_file->setDbSoundCloudErrorCode($code) $this->_file->setDbSoundCloudErrorCode($code)
->save(); ->save();
} }
public function getSoundCloudErrorCode(){ public function getSoundCloudErrorCode(){
return $this->_file->getDbSoundCloudErrorCode(); return $this->_file->getDbSoundCloudErrorCode();
} }
public function setSoundCloudErrorMsg($msg){ public function setSoundCloudErrorMsg($msg){
$this->_file->setDbSoundCloudErrorMsg($msg) $this->_file->setDbSoundCloudErrorMsg($msg)
->save(); ->save();
} }
public function getSoundCloudErrorMsg(){ public function getSoundCloudErrorMsg(){
return $this->_file->getDbSoundCloudErrorMsg(); return $this->_file->getDbSoundCloudErrorMsg();
} }
public function uploadToSoundCloud() public function uploadToSoundCloud()
{ {
global $CC_CONFIG; global $CC_CONFIG;
$file = $this->_file; $file = $this->_file;
if(is_null($file)) { if(is_null($file)) {
return "File does not exist"; return "File does not exist";

View file

@ -6,24 +6,12 @@
<title>Zend Framework Default Application</title> <title>Zend Framework Default Application</title>
</head> </head>
<body> <body>
<h1>An error occurred</h1> <div class="error-content">
<h2><?php echo $this->message ?></h2> <h2>Page not found!</h2>
<p>Looks like the page you were looking for doesn't exist!</p>
<?php if ('development' == APPLICATION_ENV): ?> <div class="button-bar">
<a class="toggle-button" href="dashboard/help">Help</a>
<h3>Exception information:</h3> </div>
<p> </div>
<b>Message:</b> <?php echo $this->exception->getMessage() ?>
</p>
<h3>Stack trace:</h3>
<pre><?php echo $this->exception->getTraceAsString() ?>
</pre>
<h3>Request Parameters:</h3>
<pre><?php echo var_export($this->request->getParams(), 1) ?>
</pre>
<?php endif ?>
</body> </body>
</html> </html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9 KiB

View file

@ -159,7 +159,7 @@ function addProgressIcon(id) {
} }
function checkSCUploadStatus(){ function checkSCUploadStatus(){
var url = '/Library/get-upload-to-sc-status/format/json'; var url = '/Library/get-upload-to-soundcloud-status/format/json';
$("span[class*=progress]").each(function(){ $("span[class*=progress]").each(function(){
var id = $(this).attr("id"); var id = $(this).attr("id");
$.post(url, {format: "json", id: id, type:"file"}, function(json){ $.post(url, {format: "json", id: id, type:"file"}, function(json){
@ -198,7 +198,7 @@ function addQtipToSCIcons(){
content: { content: {
text: "Retreiving data from the server...", text: "Retreiving data from the server...",
ajax: { ajax: {
url: "/Library/get-upload-to-sc-status", url: "/Library/get-upload-to-soundcloud-status",
type: "post", type: "post",
data: ({format: "json", id : id, type: "file"}), data: ({format: "json", id : id, type: "file"}),
success: function(json, status){ success: function(json, status){
@ -224,7 +224,7 @@ function addQtipToSCIcons(){
content: { content: {
text: "Retreiving data from the server...", text: "Retreiving data from the server...",
ajax: { ajax: {
url: "/Library/get-upload-to-sc-status", url: "/Library/get-upload-to-soundcloud-status",
type: "post", type: "post",
data: ({format: "json", id : id, type: "file"}), data: ({format: "json", id : id, type: "file"}),
success: function(json, status){ success: function(json, status){

View file

@ -374,16 +374,16 @@ function setAddShowEvents() {
function calculateDuration(endDateTime, startDateTime){ function calculateDuration(endDateTime, startDateTime){
var duration; var duration;
var durationSeconds = (endDateTime.getTime() - startDateTime.getTime())/1000; var durationSeconds = (endDateTime.getTime() - startDateTime.getTime())/1000;
if(durationSeconds != 0){ if(isNaN(durationSeconds)){
duration = '1h';
}
else if(durationSeconds != 0){
var durationHour = parseInt(durationSeconds/3600, 10); var durationHour = parseInt(durationSeconds/3600, 10);
var durationMin = parseInt((durationSeconds%3600)/60, 10); var durationMin = parseInt((durationSeconds%3600)/60, 10);
duration = (durationHour == 0 ? '' : durationHour+'h'+' ')+(durationMin == 0 ? '' : durationMin+'m'); duration = (durationHour == 0 ? '' : durationHour+'h'+' ')+(durationMin == 0 ? '' : durationMin+'m');
}else{ }else{
duration = '0m'; duration = '0m';
} }
if(isNaN(duration)){
duration = '1h';
}
$('#add_show_duration').val(duration); $('#add_show_duration').val(duration);
} }

View file

@ -330,7 +330,7 @@ function getFullCalendarEvents(start, end, callback) {
} }
function checkSCUploadStatus(){ function checkSCUploadStatus(){
var url = '/Library/get-upload-to-sc-status/format/json'; var url = '/Library/get-upload-to-soundcloud-status/format/json';
$("span[class*=progress]").each(function(){ $("span[class*=progress]").each(function(){
var id = $(this).attr("id"); var id = $(this).attr("id");
$.post(url, {format: "json", id: id, type:"show"}, function(json){ $.post(url, {format: "json", id: id, type:"show"}, function(json){
@ -368,7 +368,7 @@ function addQtipToSCIcons(ele){
content: { content: {
text: "Retreiving data from the server...", text: "Retreiving data from the server...",
ajax: { ajax: {
url: "/Library/get-upload-to-sc-status", url: "/Library/get-upload-to-soundcloud-status",
type: "post", type: "post",
data: ({format: "json", id : id, type: "file"}), data: ({format: "json", id : id, type: "file"}),
success: function(json, status){ success: function(json, status){
@ -394,7 +394,7 @@ function addQtipToSCIcons(ele){
content: { content: {
text: "Retreiving data from the server...", text: "Retreiving data from the server...",
ajax: { ajax: {
url: "/Library/get-upload-to-sc-status", url: "/Library/get-upload-to-soundcloud-status",
type: "post", type: "post",
data: ({format: "json", id : id, type: "show"}), data: ({format: "json", id : id, type: "show"}),
success: function(json, status){ success: function(json, status){

View file

@ -22,8 +22,7 @@ $CC_CONFIG['soundcloud-connection-wait'] = $values['soundcloud']['time_between_r
require_once($CC_CONFIG['phpDir'].'/application/configs/constants.php'); require_once($CC_CONFIG['phpDir'].'/application/configs/constants.php');
require_once($CC_CONFIG['phpDir'].'/application/configs/conf.php'); require_once($CC_CONFIG['phpDir'].'/application/configs/conf.php');
//$CC_CONFIG['phpDir'] = $values['general']['airtime_dir']; $CC_CONFIG['phpDir'] = $values['general']['airtime_dir'];
$CC_CONFIG['phpDir'] = "/home/james/src/airtime/airtime_mvc";
require_once($CC_CONFIG['phpDir'].'/application/models/StoredFile.php'); require_once($CC_CONFIG['phpDir'].'/application/models/StoredFile.php');
require_once($CC_CONFIG['phpDir'].'/application/models/Preference.php'); require_once($CC_CONFIG['phpDir'].'/application/models/Preference.php');
@ -59,7 +58,7 @@ if(count($argv) != 2){
} }
$id = $argv[1]; $id = $argv[1];
$file = StoredFile::Recall($id); $file = Application_Model_StoredFile::Recall($id);
// set id with -2 which is indicator for processing // set id with -2 which is indicator for processing
$file->setSoundCloudFileId(-2); $file->setSoundCloudFileId(-2);
$file->uploadToSoundCloud(); $file->uploadToSoundCloud();