added error handling on the caller of replaygain instead of in api client
This commit is contained in:
parent
18d8e24a56
commit
2556f3ba30
|
@ -705,17 +705,12 @@ class AirtimeApiClient(object):
|
||||||
'pairs' is a list of pairs in (x, y), where x is the file's database
|
'pairs' is a list of pairs in (x, y), where x is the file's database
|
||||||
row id and y is the file's replay_gain value in dB
|
row id and y is the file's replay_gain value in dB
|
||||||
"""
|
"""
|
||||||
|
|
||||||
#http://localhost/api/update-replay-gain-value/
|
#http://localhost/api/update-replay-gain-value/
|
||||||
try:
|
url = self.construct_url("update_replay_gain_value")
|
||||||
url = self.construct_url("update_replay_gain_value")
|
data = urllib.urlencode({'data': json.dumps(pairs)})
|
||||||
data = urllib.urlencode({'data': json.dumps(pairs)})
|
request = urllib2.Request(url, data)
|
||||||
request = urllib2.Request(url, data)
|
|
||||||
|
|
||||||
self.logger.debug(self.get_response_from_server(request))
|
self.logger.debug(self.get_response_from_server(request))
|
||||||
except Exception, e:
|
|
||||||
self.logger.error("Exception: %s", e)
|
|
||||||
raise
|
|
||||||
|
|
||||||
|
|
||||||
def notify_webstream_data(self, data, media_id):
|
def notify_webstream_data(self, data, media_id):
|
||||||
|
|
|
@ -56,7 +56,10 @@ class ReplayGainUpdater(Thread, Loggable):
|
||||||
full_path = os.path.join(dir_path, f['fp'])
|
full_path = os.path.join(dir_path, f['fp'])
|
||||||
processed_data.append((f['id'], replaygain.calculate_replay_gain(full_path)))
|
processed_data.append((f['id'], replaygain.calculate_replay_gain(full_path)))
|
||||||
|
|
||||||
self.api_client.update_replay_gain_values(processed_data)
|
try:
|
||||||
|
self.api_client.update_replay_gain_values(processed_data)
|
||||||
|
except Exception as e: self.unexpected_exception(e)
|
||||||
|
|
||||||
if len(files) == 0: break
|
if len(files) == 0: break
|
||||||
self.logger.info("Processed: %d songs" % total)
|
self.logger.info("Processed: %d songs" % total)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue