Skip to content
Snippets Groups Projects
Commit 37b41e7f authored by David Trattnig's avatar David Trattnig
Browse files

Handle no fetched schedules.

parent 13679533
No related branches found
No related tags found
No related merge requests found
...@@ -73,6 +73,9 @@ class CalendarFetcher: ...@@ -73,6 +73,9 @@ class CalendarFetcher:
try: try:
self.logger.debug("Fetching schedules from STEERING") self.logger.debug("Fetching schedules from STEERING")
self.fetched_schedule_data = self.__fetch_schedule_data__() self.fetched_schedule_data = self.__fetch_schedule_data__()
if not self.fetched_schedule_data:
self.logger.critical(SimpleUtil.red("No schedules fetched from API!"))
return None
except urllib.error.HTTPError as e: except urllib.error.HTTPError as e:
self.logger.critical("Cannot fetch from " + self.url["api_steering_calendar"] + "! Reason: " + str(e)) self.logger.critical("Cannot fetch from " + self.url["api_steering_calendar"] + "! Reason: " + str(e))
self.fetched_schedule_data = None self.fetched_schedule_data = None
...@@ -214,7 +217,7 @@ class CalendarFetcher: ...@@ -214,7 +217,7 @@ class CalendarFetcher:
schedule["station_fallback_id"] = local_station_fallback_id schedule["station_fallback_id"] = local_station_fallback_id
schedule["station_fallback"] = self.__fetch_schedule_playlist__(schedule, local_station_fallback_id, fetched_entries) schedule["station_fallback"] = self.__fetch_schedule_playlist__(schedule, local_station_fallback_id, fetched_entries)
if schedule["station_fallback"]: if schedule["station_fallback"]:
self.logger.info("Assigned playlist #%s as local station fallback" % local_station_fallback_id) self.logger.info("Assigned playlist #%s as local station fallback to schedule #%s" % (local_station_fallback_id, schedule["schedule_id"]))
except Exception as e: except Exception as e:
self.logger.error("Error while fetching playlists from API endpoints: " + str(e), e) self.logger.error("Error while fetching playlists from API endpoints: " + str(e), e)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment