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

Wire playlist storage to PlaylistType.

parent bc0ac0e4
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,7 @@ import logging
from mutagen.flac import FLAC
from datetime import datetime, timedelta
from modules.base.enum import PlaylistType
from modules.base.utils import SimpleUtil
from modules.database.model import Schedule, Playlist, PlaylistEntry, PlaylistEntryMetaData
from modules.communication.redis.messenger import RedisMessenger
......@@ -135,13 +136,13 @@ 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"], 0)
self.store_playlist(schedule_db, schedule_db.playlist_id, schedule["playlist"], PlaylistType.DEFAULT.id)
if schedule_db.schedule_fallback_id:
self.store_playlist(schedule_db, schedule_db.schedule_fallback_id, schedule["schedule_fallback"], 1)
self.store_playlist(schedule_db, schedule_db.schedule_fallback_id, schedule["schedule_fallback"], PlaylistType.TIMESLOT.id)
if schedule_db.show_fallback_id:
self.store_playlist(schedule_db, schedule_db.show_fallback_id, schedule["show_fallback"], 2)
self.store_playlist(schedule_db, schedule_db.show_fallback_id, schedule["show_fallback"], PlaylistType.SHOW.id)
if schedule_db.station_fallback_id:
self.store_playlist(schedule_db, schedule_db.station_fallback_id, schedule["station_fallback"], 3)
self.store_playlist(schedule_db, schedule_db.station_fallback_id, schedule["station_fallback"], PlaylistType.STATION.id)
......@@ -209,7 +210,7 @@ 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)
self.logger.debug("Playlist type %s with ID '%s' is not available!" % (fallbackplaylist_type, playlist_id))
return
playlist_db = Playlist.select_playlist_for_schedule(schedule_db.schedule_start, playlist_id)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment