diff --git a/airtime_mvc/application/modules/rest/controllers/MediaController.php b/airtime_mvc/application/modules/rest/controllers/MediaController.php index 245da3b0b..63d60d4b1 100644 --- a/airtime_mvc/application/modules/rest/controllers/MediaController.php +++ b/airtime_mvc/application/modules/rest/controllers/MediaController.php @@ -155,7 +155,7 @@ class Rest_MediaController extends Zend_Rest_Controller //Our RESTful API takes "full_path" as a field, which we then split and translate to match //our internal schema. Internally, file path is stored relative to a directory, with the directory //as a foreign key to cc_music_dirs. - if ($requestData["full_path"]) { + if (isset($requestData["full_path"])) { Application_Model_Preference::updateDiskUsage(filesize($requestData["full_path"])); $fullPath = $requestData["full_path"]; diff --git a/python_apps/airtime_analyzer/airtime_analyzer/message_listener.py b/python_apps/airtime_analyzer/airtime_analyzer/message_listener.py index 5fc04058e..c5e4da373 100644 --- a/python_apps/airtime_analyzer/airtime_analyzer/message_listener.py +++ b/python_apps/airtime_analyzer/airtime_analyzer/message_listener.py @@ -100,6 +100,7 @@ class MessageListener: requeue=False) #Important that it doesn't requeue the message except Exception as e: + logging.exception(e) #If ANY exception happens while processing a file, we're going to NACK to the #messaging server and tell it to remove the message from the queue. #(NACK is a negative acknowledgement. We could use ACK instead, but this might come @@ -118,7 +119,6 @@ class MessageListener: StatusReporter.report_failure_to_callback_url(callback_url, api_key, import_status=2, reason=u'An error occurred while importing this file') - logging.exception(e) else: # ACK at the very end, after the message has been successfully processed. diff --git a/python_apps/airtime_analyzer/airtime_analyzer/status_reporter.py b/python_apps/airtime_analyzer/airtime_analyzer/status_reporter.py index 75769a692..2a0963dd9 100644 --- a/python_apps/airtime_analyzer/airtime_analyzer/status_reporter.py +++ b/python_apps/airtime_analyzer/airtime_analyzer/status_reporter.py @@ -15,9 +15,9 @@ class StatusReporter(): put_payload = json.dumps(audio_metadata) logging.debug("sending http put with payload: " + put_payload) r = requests.put(callback_url, data=put_payload, - auth=requests.auth.httpbasicauth(api_key, ''), - timeout=statusreporter._http_request_timeout) - logging.debug("http request returned status: " + str(r.status_code)) + auth=requests.auth.HTTPBasicAuth(api_key, ''), + timeout=StatusReporter._HTTP_REQUEST_TIMEOUT) + logging.debug("HTTP request returned status: " + str(r.status_code)) logging.debug(r.text) # log the response body #todo: queue up failed requests and try them again later. @@ -28,16 +28,17 @@ class StatusReporter(): # TODO: Make import_status is an int? logging.debug("Reporting import failure to Airtime REST API...") + audio_metadata = dict() audio_metadata["import_status"] = import_status audio_metadata["comment"] = reason # hack attack put_payload = json.dumps(audio_metadata) logging.debug("sending http put with payload: " + put_payload) r = requests.put(callback_url, data=put_payload, - auth=requests.auth.httpbasicauth(api_key, ''), - timeout=statusreporter._http_request_timeout) - logging.debug("http request returned status: " + str(r.status_code)) + auth=requests.auth.HTTPBasicAuth(api_key, ''), + timeout=StatusReporter._HTTP_REQUEST_TIMEOUT) + logging.debug("HTTP request returned status: " + str(r.status_code)) logging.debug(r.text) # log the response body - #todo: queue up failed requests and try them again later. + #TODO: queue up failed requests and try them again later. r.raise_for_status() # raise an exception if there was an http error code returned