CC-4841: Silan script
done
This commit is contained in:
parent
bb2f9316af
commit
f70ca93b53
6 changed files with 180 additions and 0 deletions
|
@ -38,6 +38,7 @@ class ApiController extends Zend_Controller_Action
|
|||
->addActionContext('update-source-status' , 'json')
|
||||
->addActionContext('get-bootstrap-info' , 'json')
|
||||
->addActionContext('get-files-without-replay-gain' , 'json')
|
||||
->addActionContext('get-files-without-silan-value' , 'json')
|
||||
->addActionContext('reload-metadata-group' , 'json')
|
||||
->addActionContext('notify-webstream-data' , 'json')
|
||||
->addActionContext('get-stream-parameters' , 'json')
|
||||
|
@ -903,6 +904,18 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
echo json_encode($rows);
|
||||
}
|
||||
|
||||
public function getFilesWithoutSilanValueAction()
|
||||
{
|
||||
// disable the view and the layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
//connect to db and get get sql
|
||||
$rows = Application_Model_StoredFile::getAllFilesWithoutSilan();
|
||||
|
||||
echo json_encode($rows);
|
||||
}
|
||||
|
||||
public function updateReplayGainValueAction()
|
||||
{
|
||||
|
@ -921,6 +934,28 @@ class ApiController extends Zend_Controller_Action
|
|||
$file->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function updateCueValuesBySilanAction()
|
||||
{
|
||||
// disable layout
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
$data = json_decode($request->getParam('data'));
|
||||
Logging::info($data);
|
||||
foreach ($data as $pair) {
|
||||
list($id, $info) = $pair;
|
||||
// TODO : move this code into model -- RG
|
||||
$cuein = $info->cuein;
|
||||
$cueout = $info->cueout;
|
||||
$file = Application_Model_StoredFile::Recall($p_id = $id)->getPropelOrm();
|
||||
$file->setDbCuein($cuein);
|
||||
$file->setDbCueout($cueout);
|
||||
$file->setDbSilanCheck(true);
|
||||
$file->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function notifyWebstreamDataAction()
|
||||
{
|
||||
|
|
|
@ -1111,6 +1111,29 @@ SQL;
|
|||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public static function getAllFilesWithoutSilan() {
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$sql = <<<SQL
|
||||
SELECT f.id,
|
||||
m.directory || f.filepath AS fp
|
||||
FROM cc_files as f
|
||||
JOIN cc_music_dirs as m ON f.directory = m.id
|
||||
WHERE file_exists = 'TRUE'
|
||||
AND silan_check IS FALSE Limit 100
|
||||
SQL;
|
||||
$stmt = $con->prepare($sql);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
} else {
|
||||
$msg = implode(',', $stmt->errorInfo());
|
||||
throw new Exception("Error: $msg");
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/* Gets number of tracks uploaded to
|
||||
* Soundcloud in the last 24 hours
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue