From ef801c7a100c2e8d85375885264eca331f831468 Mon Sep 17 00:00:00 2001 From: James Date: Mon, 26 Mar 2012 17:44:07 -0400 Subject: [PATCH] CC-3484: Pypo: On bootup, it should grab station name and stream label for liquidsoap - fixed --- python_apps/api_clients/api_client.py | 1 + python_apps/pypo/pypofetch.py | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index 4ff0f1cf9..1f32a993b 100755 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -660,6 +660,7 @@ class AirTimeApiClient(ApiClientInterface): response = json.loads(response) logger.info("Bootstrap info retrieved %s", response) except Exception, e: + response = None import traceback top = traceback.format_exc() logger.error('Exception: %s', e) diff --git a/python_apps/pypo/pypofetch.py b/python_apps/pypo/pypofetch.py index 9c1d70f56..2526c5ac0 100644 --- a/python_apps/pypo/pypofetch.py +++ b/python_apps/pypo/pypofetch.py @@ -150,12 +150,16 @@ class PypoFetch(Thread): def set_bootstrap_variables(self): self.logger.debug('Getting information needed on bootstrap from Airtime') info = self.api_client.get_bootstrap_info() - self.logger.debug('info:%s',info) - for k, v in info['switch_status'].iteritems(): - self.switch_source(k, v) - self.update_liquidsoap_stream_format(info['stream_label']) - self.update_liquidsoap_station_name(info['station_name']) - self.update_liquidsoap_transition_fade(info['transition_fade']) + if info == None: + self.logger.error('Unable to get bootstrap info.. Existing pypo...') + sys.exit(0) + else: + self.logger.debug('info:%s',info) + for k, v in info['switch_status'].iteritems(): + self.switch_source(k, v) + self.update_liquidsoap_stream_format(info['stream_label']) + self.update_liquidsoap_station_name(info['station_name']) + self.update_liquidsoap_transition_fade(info['transition_fade']) def regenerateLiquidsoapConf(self, setting_p): existing = {}