Merge branch 'cc-5709-airtime-analyzer' into cc-5709-airtime-analyzer-saas
This commit is contained in:
commit
a6e80e2789
9 changed files with 103 additions and 18 deletions
|
@ -44,7 +44,7 @@ class CcFilesTableMap extends TableMap {
|
|||
$this->addColumn('FTYPE', 'DbFtype', 'VARCHAR', true, 128, '');
|
||||
$this->addForeignKey('DIRECTORY', 'DbDirectory', 'INTEGER', 'cc_music_dirs', 'ID', false, null, null);
|
||||
$this->addColumn('FILEPATH', 'DbFilepath', 'LONGVARCHAR', false, null, '');
|
||||
$this->addColumn('IMPORT_STATUS', 'DbImportStatus', 'INTEGER', true, null, 0);
|
||||
$this->addColumn('IMPORT_STATUS', 'DbImportStatus', 'INTEGER', true, null, 1);
|
||||
$this->addColumn('CURRENTLYACCESSING', 'DbCurrentlyaccessing', 'INTEGER', true, null, 0);
|
||||
$this->addForeignKey('EDITEDBY', 'DbEditedby', 'INTEGER', 'cc_subjs', 'ID', false, null, null);
|
||||
$this->addColumn('MTIME', 'DbMtime', 'TIMESTAMP', false, 6, null);
|
||||
|
|
|
@ -66,7 +66,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* The value for the import_status field.
|
||||
* Note: this column has a database default value of: 0
|
||||
* Note: this column has a database default value of: 1
|
||||
* @var int
|
||||
*/
|
||||
protected $import_status;
|
||||
|
@ -524,7 +524,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
$this->mime = '';
|
||||
$this->ftype = '';
|
||||
$this->filepath = '';
|
||||
$this->import_status = 0;
|
||||
$this->import_status = 1;
|
||||
$this->currentlyaccessing = 0;
|
||||
$this->length = '00:00:00';
|
||||
$this->file_exists = true;
|
||||
|
@ -2892,7 +2892,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($this->import_status !== 0) {
|
||||
if ($this->import_status !== 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,13 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
//fields that are not modifiable via our RESTful API
|
||||
private $blackList = array(
|
||||
'id',
|
||||
'directory',
|
||||
'filepath',
|
||||
'file_exists',
|
||||
'hidden',
|
||||
'mtime',
|
||||
'utime',
|
||||
'lptime',
|
||||
'silan_check',
|
||||
'soundcloud_id',
|
||||
'is_scheduled',
|
||||
|
@ -147,9 +153,18 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
}
|
||||
|
||||
$file = CcFilesQuery::create()->findPk($id);
|
||||
if ($file)
|
||||
//validate fields
|
||||
$requestData = json_decode($this->getRequest()->getRawBody(), true);
|
||||
//TODO: rename EditAudioMD form?
|
||||
$fileForm = new Application_Form_EditAudioMD();
|
||||
$fileForm->startForm($file->getDbId());
|
||||
$fileForm->populate($requestData);
|
||||
|
||||
if (!$fileForm->isValidPartial($requestData)) {
|
||||
$file->setDbImportStatus(2)->save();
|
||||
$this->invalidDataResponse();
|
||||
} else if ($file)
|
||||
{
|
||||
$requestData = json_decode($this->getRequest()->getRawBody(), true);
|
||||
$file->fromArray($this->validateRequestData($requestData), BasePeer::TYPE_FIELDNAME);
|
||||
|
||||
//Our RESTful API takes "full_path" as a field, which we then split and translate to match
|
||||
|
@ -179,6 +194,7 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
->setHttpResponseCode(200)
|
||||
->appendBody(json_encode($this->sanitizeResponse($file)));
|
||||
} else {
|
||||
$file->setDbImportStatus(2)->save();
|
||||
$this->fileNotFoundResponse();
|
||||
}
|
||||
}
|
||||
|
@ -284,6 +300,13 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
$resp->setHttpResponseCode(404);
|
||||
$resp->appendBody("ERROR: Media not found.");
|
||||
}
|
||||
|
||||
private function invalidDataResponse()
|
||||
{
|
||||
$resp = $this->getResponse();
|
||||
$resp->setHttpResponseCode(400);
|
||||
$resp->appendBody("ERROR: Invalid data");
|
||||
}
|
||||
|
||||
private function processUploadedFile($callbackUrl, $originalFilename, $ownerId)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue