diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index 95fdd3d4c..84e1a4d43 100644 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -318,6 +318,7 @@ class AirTimeApiClient(ApiClientInterface): except Exception, e: logger.error("Exception: %s", e) + response = None return response diff --git a/python_apps/show-recorder/recorder.py b/python_apps/show-recorder/recorder.py index 783ad81e6..a6352729a 100644 --- a/python_apps/show-recorder/recorder.py +++ b/python_apps/show-recorder/recorder.py @@ -166,21 +166,18 @@ class Record(): def get_shows(self): - shows = self.api_client.get_shows_to_record() - - if self.sr is not None: - if not shows['is_recording'] and self.sr.is_recording(): - self.sr.cancel_recording() - - - if shows is not None: - shows = shows[u'shows'] - else: - shows = [] + response = self.api_client.get_shows_to_record() - if len(shows): - self.process_shows(shows) - self.check_record() + if response is not None and 'is_recording' in response: + if self.sr is not None: + if not response['is_recording'] and self.sr.is_recording(): + self.sr.cancel_recording() + + shows = response[u'shows'] + + if len(shows): + self.process_shows(shows) + self.check_record() if __name__ == '__main__':