CC-5709: Airtime Analyzer

* Fixed error in media API authentication
* Improved documentation
This commit is contained in:
Albert Santoni 2014-03-17 14:43:50 -04:00
parent 13a664207f
commit 16c56e6aff
4 changed files with 55 additions and 12 deletions

View file

@ -12,6 +12,15 @@ You will need to allow the "airtime" RabbitMQ user to access all exchanges and q
Usage
==========
This program must run as a user with permissions to write to your Airtime music library
directory. For standard Airtime installations, run it as the www-data user:
$ sudo -u www-data airtime_analyzer --debug
Or during development, add the --debug flag for more verbose output:
$ sudo -u www-data airtime_analyzer --debug
To print usage instructions, run:
$ airtime_analyzer --help
@ -35,6 +44,8 @@ For example, run:
$ php tools/message_sender.php '{ "tmp_file_path" : "foo.mp3", "final_directory" : ".", "callback_url" : "http://airtime.localhost/rest/media/1", "api_key" : "YOUR_API_KEY" }'
$ php tools/message_sender.php '{"tmp_file_path":"foo.mp3", "import_directory":"/srv/airtime/stor/imported/1","original_filename":"foo.mp3","callback_url": "http://airtime.localhost/rest/media/1", "api_key":"YOUR_API_KEY"}'
Logging
=========

View file

@ -112,12 +112,13 @@ class MessageListener:
# TODO: Report this as a failed upload to the File Upload REST API.
#
# TODO: If the JSON was invalid, then don't report to the REST API
# TODO: If the JSON was invalid or the web server is down,
# then don't report that failure to the REST API
StatusReporter.report_failure_to_callback_url(callback_url, api_key, error_status=1,
reason=u'An error occurred while importing this file')
logging.error(e)
logging.exception(e)
else:
# ACK at the very end, after the message has been successfully processed.

View file

@ -19,9 +19,9 @@ class StatusReporter():
timeout=StatusReporter._HTTP_REQUEST_TIMEOUT)
logging.debug("HTTP request returned status: " + str(r.status_code))
logging.debug(r.text) # Log the response body
r.raise_for_status() # Raise an exception if there was an HTTP error code returned
#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
@classmethod
def report_failure_to_callback_url(self, callback_url, api_key, error_status, reason):