Commit 746649c4 authored by David Trattnig's avatar David Trattnig
Browse files

Renamed simpleutil to util.

parent 6edac656
......@@ -40,7 +40,7 @@ from sqlalchemy import create_engine
from modules.base.enum import Channel, ChannelType
from modules.base.config import AuraConfig
from modules.base.simpleutil import SimpleUtil, EngineUtil
from modules.base.utils import SimpleUtil, EngineUtil
# Init Config
......@@ -30,7 +30,7 @@ import logging
from multiprocessing import Lock
from modules.base.exceptions import LQConnectionError
from modules.base.simpleutil import TerminalColors
from modules.base.utils import TerminalColors
LiquidSoapClient Class
......@@ -6,7 +6,7 @@ import simplejson
from datetime import datetime, timedelta
#from modules.models.schedule import Schedule
from modules.base.simpleutil import SimpleUtil
from modules.base.utils import SimpleUtil
class CalendarFetcher:
......@@ -36,7 +36,8 @@ import random
import librosa
from accessify import private, protected
from modules.base.simpleutil import SimpleUtil
from modules.base.enum import FallbackType
from modules.base.utils import SimpleUtil
from modules.communication.mail import AuraMailer
......@@ -83,6 +84,40 @@ class FallbackManager:
def get_fallback(self, schedule, type):
Checks if the given schedule is valid and returns a valid fallback
if required.
type = None
playlist_id = schedule.playlist_id
if not schedule.playlist_id:
if not schedule.show_fallback_id:
if not schedule.schedule_fallback_id:
if not schedule.station_fallback_id:
raise Exception
type = FallbackType.STATION
playlist_id = schedule.station_fallback_id
type = FallbackType.TIMESLOT
playlist_id = schedule.schedule_fallback_id
type = FallbackType.SHOW
playlist_id = schedule.show_fallback_id
if type:
self.logger.warn("Detected fallback type '%s' required for schedule %s" % (type, str(schedule)))
return (type, playlist_id)
def validate_playlist(self, playlist_id):
def get_fallback_for(self, fallbackname):
Retrieves a random fallback audio source for any of the types:
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