From e08732fba713432be2a595913cce150c69bab07e Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 25 Feb 2013 19:45:26 -0500 Subject: [PATCH] CC-4975: airtime-silan cmd error -fixed --- airtime_mvc/application/controllers/ApiController.php | 9 ++++++--- python_apps/api_clients/api_client.py | 6 +++++- utils/airtime-silan.py | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 083666945..512eb1b10 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -45,6 +45,7 @@ class ApiController extends Zend_Controller_Action ->addActionContext('push-stream-stats' , 'json') ->addActionContext('update-stream-setting-table' , 'json') ->addActionContext('update-replay-gain-value' , 'json') + ->addActionContext('update-cue-values-by-silan' , 'json') ->initContext(); } @@ -962,13 +963,13 @@ class ApiController extends Zend_Controller_Action public function updateCueValuesBySilanAction() { - // disable layout + // disable the view and the 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 @@ -980,6 +981,8 @@ class ApiController extends Zend_Controller_Action $file->setDbSilanCheck(true); $file->save(); } + + echo json_encode(array()); } public function notifyWebstreamDataAction() diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index e8dbbd16a..991fd3f7c 100644 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -92,7 +92,11 @@ class ApiRequest(object): raise # Ghetto hack for now because we don't the content type we are getting # (Pointless to look at mime since it's not being set correctly always) - return json.loads(response) + try: + return json.loads(response) + except Exception: + self.logger.error(response) + raise def req(self, *args, **kwargs): self.__req = lambda : self(*args, **kwargs) diff --git a/utils/airtime-silan.py b/utils/airtime-silan.py index 04ec86745..08bc04b55 100644 --- a/utils/airtime-silan.py +++ b/utils/airtime-silan.py @@ -67,7 +67,7 @@ try: break print "Processed: %d songs" % total subtotal += total - total = 0 + try: print api_client.update_cue_values_by_silan(processed_data) except Exception ,e: