Commit 27aac36e authored by David Trattnig's avatar David Trattnig
Browse files

Small improvements for fallback storage.

parent 23bc0fad
......@@ -135,7 +135,7 @@ class AuraCalendarService(threading.Thread):
schedule_db = self.store_schedule(schedule)
# Store playlists to play
self.store_playlist(schedule_db, schedule_db.playlist_id, schedule["playlist"])
self.store_playlist(schedule_db, schedule_db.playlist_id, schedule["playlist"], 0)
if schedule_db.schedule_fallback_id:
self.store_playlist(schedule_db, schedule_db.schedule_fallback_id, schedule["schedule_fallback"], 1)
if schedule_db.show_fallback_id:
......@@ -208,6 +208,10 @@ class AuraCalendarService(threading.Thread):
"""
Stores the Playlist to the database.
"""
if not playlist_id or not fetched_playlist:
self.logger.warn("Cannot store invalid playlist with ID '%s'!" % playlist_id)
return
playlist_db = Playlist.select_playlist_for_schedule(schedule_db.schedule_start, playlist_id)
havetoadd = False
......
......@@ -207,9 +207,9 @@ class CalendarFetcher:
# If Steering doesn't provide a station fallback, the local one is used
if not schedule["station_fallback"] and int(local_station_fallback_id) > 0:
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"]:
self.logger.info("Set station fallback to playlist #%s" % local_station_fallback_id)
self.logger.info("Assigned playlist #%s as local station fallback" % local_station_fallback_id)
except Exception as e:
self.logger.error("Error while fetching playlists from API endpoints: " + str(e), e)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment