Use track metadata from Airtime in playout engine
* Resolves CC-5893: Metadata not updated on Airtime Pro * Report track metadata in the schedule API, and make pypo pass that along to Liquidsoap via annotations. * Move HTTP response sanitization for file metadata out of the REST module and into CcFiles * Slightly improved the terrible exception handling in pypo
This commit is contained in:
parent
1aa99e2896
commit
7438ecd2b4
5 changed files with 62 additions and 41 deletions
|
@ -4,7 +4,7 @@
|
|||
class Rest_MediaController extends Zend_Rest_Controller
|
||||
{
|
||||
//fields that are not modifiable via our RESTful API
|
||||
private $blackList = array(
|
||||
private static $blackList = array(
|
||||
'id',
|
||||
'directory',
|
||||
'filepath',
|
||||
|
@ -18,14 +18,6 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
'is_playlist'
|
||||
);
|
||||
|
||||
//fields we should never expose through our RESTful API
|
||||
private $privateFields = array(
|
||||
'file_exists',
|
||||
'silan_check',
|
||||
'is_scheduled',
|
||||
'is_playlist'
|
||||
);
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->view->layout()->disableLayout();
|
||||
|
@ -41,7 +33,7 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
$files_array = array();
|
||||
foreach (CcFilesQuery::create()->find() as $file)
|
||||
{
|
||||
array_push($files_array, $this->sanitizeResponse($file));
|
||||
array_push($files_array, CcFiles::sanitizeResponse($file));
|
||||
}
|
||||
|
||||
$this->getResponse()
|
||||
|
@ -134,7 +126,7 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(200)
|
||||
->appendBody(json_encode($this->sanitizeResponse($file)));
|
||||
->appendBody(json_encode(CcFiles::sanitizeResponse($file)));
|
||||
} else {
|
||||
$this->fileNotFoundResponse();
|
||||
}
|
||||
|
@ -201,7 +193,7 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(201)
|
||||
->appendBody(json_encode($this->sanitizeResponse($file)));
|
||||
->appendBody(json_encode(CcFiles::sanitizeResponse($file)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -265,7 +257,7 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(200)
|
||||
->appendBody(json_encode($this->sanitizeResponse($file)));
|
||||
->appendBody(json_encode(CcFiles::sanitizeResponse($file)));
|
||||
} else {
|
||||
$file->setDbImportStatus(2)->save();
|
||||
$this->fileNotFoundResponse();
|
||||
|
@ -490,30 +482,15 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
* from outside of Airtime
|
||||
* @param array $data
|
||||
*/
|
||||
private function removeBlacklistedFieldsFromRequestData($data)
|
||||
private static function removeBlacklistedFieldsFromRequestData($data)
|
||||
{
|
||||
foreach ($this->blackList as $key) {
|
||||
foreach (self::$blackList as $key) {
|
||||
unset($data[$key]);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Strips out the private fields we do not want to send back in API responses
|
||||
*/
|
||||
//TODO: rename this function?
|
||||
public function sanitizeResponse($file)
|
||||
{
|
||||
$response = $file->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
|
||||
foreach ($this->privateFields as $key) {
|
||||
unset($response[$key]);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
private function removeEmptySubFolders($path)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue