CC-1799 : Live Studio Playout from media library (pytagsfs)
if a tag is edited by easytag, the change is now reflected in airtime database.
This commit is contained in:
parent
dbcfabfb76
commit
5be039d349
4 changed files with 59 additions and 18 deletions
|
@ -8,10 +8,10 @@ class ApiController extends Zend_Controller_Action
|
|||
/* Initialize action controller here */
|
||||
$context = $this->_helper->getHelper('contextSwitch');
|
||||
$context->addActionContext('version', 'json')
|
||||
->addActionContext('recorded-shows', 'json')
|
||||
->addActionContext('upload-recorded', 'json')
|
||||
->addActionContext('reload-metadata', 'json')
|
||||
->initContext();
|
||||
->addActionContext('recorded-shows', 'json')
|
||||
->addActionContext('upload-recorded', 'json')
|
||||
->addActionContext('reload-metadata', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
|
@ -332,7 +332,20 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
$md = $this->_getParam('md');
|
||||
|
||||
$this->view->response = $md;
|
||||
$file = StoredFile::Recall(null, $md['gunid']);
|
||||
if (PEAR::isError($file) || is_null($file)) {
|
||||
$this->view->response = "File not in Airtime's Database";
|
||||
return;
|
||||
}
|
||||
|
||||
$res = $file->replaceDbMetadata($md);
|
||||
|
||||
if (PEAR::isError($res)) {
|
||||
$this->view->response = "Metadata Change Failed";
|
||||
}
|
||||
else {
|
||||
$this->view->response = "Success!";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -543,16 +543,25 @@ class StoredFile {
|
|||
public function replaceDbMetadata($p_values)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
|
||||
$data = array();
|
||||
foreach ($p_values as $category => $value) {
|
||||
$escapedValue = pg_escape_string($value);
|
||||
$columnName = $category;
|
||||
if (!is_null($columnName)) {
|
||||
$sql = "UPDATE ".$CC_CONFIG["filesTable"]
|
||||
." SET $columnName='$escapedValue'"
|
||||
." WHERE gunid = '".$this->gunid."'";
|
||||
$CC_DBC->query($sql);
|
||||
$data[] = "$columnName='$escapedValue'";
|
||||
}
|
||||
}
|
||||
|
||||
$data = join(",", $data);
|
||||
$sql = "UPDATE ".$CC_CONFIG["filesTable"]
|
||||
." SET $data"
|
||||
." WHERE gunid = '".$this->gunid."'";
|
||||
$res = $CC_DBC->query($sql);
|
||||
if (PEAR::isError($res)) {
|
||||
$CC_DBC->query("ROLLBACK");
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
public function clearMetadata()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue