parent
afb55c7b51
commit
d1f655d79d
|
@ -971,14 +971,14 @@ class ApiController extends Zend_Controller_Action
|
||||||
$this->_helper->viewRenderer->setNoRender(true);
|
$this->_helper->viewRenderer->setNoRender(true);
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$data = json_decode($request->getParam('data'));
|
$data = json_decode($request->getParam('data'), $assoc = true);
|
||||||
|
|
||||||
foreach ($data as $pair) {
|
foreach ($data as $pair) {
|
||||||
list($id, $info) = $pair;
|
list($id, $info) = $pair;
|
||||||
// TODO : move this code into model -- RG
|
// TODO : move this code into model -- RG
|
||||||
$cuein = $info->cuein;
|
|
||||||
$cueout = $info->cueout;
|
|
||||||
$file = Application_Model_StoredFile::Recall($p_id = $id)->getPropelOrm();
|
$file = Application_Model_StoredFile::Recall($p_id = $id)->getPropelOrm();
|
||||||
|
$cuein = isset($info['cuein']) ? $info['cuein'] : 0;
|
||||||
|
$cueout = isset($info['cueout']) ? $info['cueout'] : $file->getDbLength();
|
||||||
$file->setDbCuein($cuein);
|
$file->setDbCuein($cuein);
|
||||||
$file->setDbCueout($cueout);
|
$file->setDbCueout($cueout);
|
||||||
$file->setDbSilanCheck(true);
|
$file->setDbSilanCheck(true);
|
||||||
|
|
|
@ -58,7 +58,8 @@ class ReplayGainUpdater(Thread):
|
||||||
total += 1
|
total += 1
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.api_client.update_replay_gain_values(processed_data)
|
if len(processed_data):
|
||||||
|
self.api_client.update_replay_gain_values(processed_data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.error(e)
|
self.logger.error(e)
|
||||||
self.logger.debug(traceback.format_exc())
|
self.logger.debug(traceback.format_exc())
|
||||||
|
|
|
@ -45,11 +45,13 @@ class SilanAnalyzer(Thread):
|
||||||
command = ['nice', '-n', '19', 'silan', '-b', '-f', 'JSON', full_path]
|
command = ['nice', '-n', '19', 'silan', '-b', '-f', 'JSON', full_path]
|
||||||
try:
|
try:
|
||||||
proc = subprocess.Popen(command, stdout=subprocess.PIPE)
|
proc = subprocess.Popen(command, stdout=subprocess.PIPE)
|
||||||
out = proc.communicate()[0].strip('\r\n')
|
comm = proc.communicate()
|
||||||
info = json.loads(out)
|
if len(comm):
|
||||||
if len(info['sound']) >= 2:
|
out = comm[0].strip('\r\n')
|
||||||
data['cuein'] = str('{0:f}'.format(info['sound'][0][0]))
|
info = json.loads(out)
|
||||||
data['cueout'] = str('{0:f}'.format(info['sound'][-1][1]))
|
if len(info['sound']) >= 2:
|
||||||
|
data['cuein'] = str('{0:f}'.format(info['sound'][0][0]))
|
||||||
|
data['cueout'] = str('{0:f}'.format(info['sound'][-1][1]))
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.logger.error(str(command))
|
self.logger.error(str(command))
|
||||||
self.logger.error(e)
|
self.logger.error(e)
|
||||||
|
|
Loading…
Reference in New Issue