CC-4796: Listener Stat: Authentication exception happens but no warning message on UI
- done
This commit is contained in:
parent
6d48e1faf0
commit
1263c04621
8 changed files with 62 additions and 10 deletions
|
@ -124,3 +124,5 @@ notify_liquidsoap_started = 'rabbitmq-do-push/api_key/%%api_key%%/format/json'
|
|||
get_stream_parameters = 'get-stream-parameters/api_key/%%api_key%%/format/json'
|
||||
|
||||
push_stream_stats = 'push-stream-stats/api_key/%%api_key%%/format/json'
|
||||
|
||||
update_stream_setting_table = 'update-stream-setting-table/api_key/%%api_key%%/format/json'
|
||||
|
|
|
@ -383,3 +383,7 @@ class AirtimeApiClient(object):
|
|||
# TODO : users of this method should do their own error handling
|
||||
response = self.services.push_stream_stats(_post_data={'data': json.dumps(data)})
|
||||
return response
|
||||
|
||||
def update_stream_setting_table(self, data):
|
||||
response = self.services.update_stream_setting_table(_post_data={'data': json.dumps(data)})
|
||||
return response
|
|
@ -95,15 +95,25 @@ class ListenerStat(Thread):
|
|||
#connections
|
||||
for k, v in stream_parameters.items():
|
||||
if v["enable"] == 'true':
|
||||
if v["output"] == "icecast":
|
||||
stats.append(self.get_icecast_stats(v))
|
||||
else:
|
||||
stats.append(self.get_shoutcast_stats(v))
|
||||
try:
|
||||
if v["output"] == "icecast":
|
||||
stats.append(self.get_icecast_stats(v))
|
||||
else:
|
||||
stats.append(self.get_shoutcast_stats(v))
|
||||
self.update_listener_stat_error(v["mount"], 'OK')
|
||||
except Exception, e:
|
||||
self.logger.error('Exception: %s', e)
|
||||
self.update_listener_stat_error(v["mount"], str(e))
|
||||
|
||||
return stats
|
||||
|
||||
def push_stream_stats(self, stats):
|
||||
self.api_client.push_stream_stats(stats)
|
||||
|
||||
def update_listener_stat_error(self, stream_id, error):
|
||||
keyname = '%s_listener_stat_error' % stream_id
|
||||
data = {keyname: error}
|
||||
self.api_client.update_stream_setting_table(data)
|
||||
|
||||
def run(self):
|
||||
#Wake up every 120 seconds and gather icecast statistics. Note that we
|
||||
|
@ -116,8 +126,11 @@ class ListenerStat(Thread):
|
|||
|
||||
stats = self.get_stream_stats(stream_parameters["stream_params"])
|
||||
self.logger.debug(stats)
|
||||
|
||||
self.push_stream_stats(stats)
|
||||
|
||||
if not stats:
|
||||
self.logger.error("Not able to get listener stats")
|
||||
else:
|
||||
self.push_stream_stats(stats)
|
||||
except Exception, e:
|
||||
self.logger.error('Exception: %s', e)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue