Merge branch 'cc-5709-airtime-analyzer' of github.com:sourcefabric/Airtime into cc-5709-airtime-analyzer

This commit is contained in:
drigato 2014-04-03 10:12:32 -04:00
commit 2ea3ea012a
1 changed files with 11 additions and 2 deletions

View File

@ -74,6 +74,14 @@ class MessageListener:
@staticmethod
def msg_received_callback(channel, method_frame, header_frame, body):
logging.info(" - Received '%s' on routing_key '%s'" % (body, method_frame.routing_key))
#Declare all variables here so they exist in the exception handlers below, no matter what.
audio_file_path = ""
#final_file_path = ""
import_directory = ""
original_filename = ""
callback_url = ""
api_key = ""
# Spin up a worker process. We use the multiprocessing module and multiprocessing.Queue
# to pass objects between the processes so that if the analyzer process crashes, it does not
@ -116,8 +124,9 @@ class MessageListener:
# TODO: If the JSON was invalid or the web server is down,
# then don't report that failure to the REST API
#TODO: Catch exceptions from this HTTP request too:
StatusReporter.report_failure_to_callback_url(callback_url, api_key, import_status=2,
reason=u'An error occurred while importing this file')
if callback_url: # If we got an invalid message, there might be no callback_url in the JSON
StatusReporter.report_failure_to_callback_url(callback_url, api_key, import_status=2,
reason=u'An error occurred while importing this file')
else: