diff --git a/modules/scheduling/scheduler.py b/modules/scheduling/scheduler.py index aca0d4b1728535fa5921f0ed2ddf11ec728f72d3..6a57278f8c7938ba5a77aec54032992c18e6d58c 100644 --- a/modules/scheduling/scheduler.py +++ b/modules/scheduling/scheduler.py @@ -130,8 +130,6 @@ class AuraScheduler(threading.Thread): 1. `self.fetch_new_programme()` periodically from the API depending on the `fetching_frequency` defined in the engine configuration. 2. Loads the latest programme from the database and sets the instance state `self.programme` with current schedules. 3. Queues all schedules of the programme, if the soundssystem is ready to accept commands. - 4. As long the scheduling window is not reached any existing, queued item will be re-evaluationed if it has changed or if some - playlist is valid. If not the relevant fallback playlist will be queued (compare "pro-active fallback handling"). On every cycle the configuration file is reloaded, to allow modifications while running the engine. """ @@ -276,13 +274,13 @@ class AuraScheduler(threading.Thread): # Check for current schedule current_schedule = self.get_active_schedule() if not current_schedule: - self.logger.warning(SU.red("There's no active schedule")) + self.logger.warning(SU.red("There's no active timeslot")) return None # Check for scheduled playlist current_playlist = current_schedule.get_playlist() if not current_playlist: - msg = "There's no playlist assigned to the current schedule. Most likely a fallback will make things okay again." + msg = "There's no playlist assigned to the current timeslot. Most likely a fallback will make things okay again." self.logger.warning(SU.red(msg)) return None @@ -387,54 +385,6 @@ class AuraScheduler(threading.Thread): - # ------------------------------------------------------------------------------------------ # - def set_next_file_for(self, playlistname): - self.logger.critical("HAVE TO <SET> NEXT FILE FOR: " + playlistname) - self.logger.critical(str(self.get_active_entry(0))) - - if playlistname == "station": - file = "/home/david/Code/aura/engine2/test/content/ernie_mayne_sugar.mp3" - elif playlistname == "timeslot": - file = "/home/david/Code/aura/engine2/test/content/ernie_mayne_sugar.mp3" - elif playlistname == "show": - file = "/home/david/Code/aura/engine2/test/content/ernie_mayne_sugar.mp3" - else: - file = "" - self.logger.critical("Should set next fallback file for " + playlistname + ", but this playlist is unknown!") - - self.logger.info("Set next fallback file for " + playlistname + ": " + file) - self.redismessenger.set_next_file_for(playlistname, file) - return file - - - def get_next_file_for(self, fallbackname): - """ - Evaluates the next **fallback files/playlists** to be played for a given fallback-type. - Valid fallback-types are: - - * timeslot - * show - * station - - Args: - fallbackname (String): The name of the fallback-type - - Returns: - (String): Absolute path to the file to be played as a fallback. - """ - - file = self.fallback.get_fallback_for(fallbackname) - - if file: - self.logger.info("Got next file '%s' (fallback type: %s)" % (file, fallbackname)) - - #set_next_file_thread = SetNextFile(fallbackname, show) - #set_next_file_thread.start() - #self.redismessenger.set_next_file_for(playlistname, file) - return file - - - def get_ascii_programme(self): """ @@ -730,8 +680,7 @@ class AuraScheduler(threading.Thread): if entries[-1].status != EntryPlayState.READY: self.logger.critical(SU.red("PLAY: For some reason the entry/entries are not yet ready to be played (Entries: %s)" % ResourceUtil.get_entries_string(entries))) - # At this point it's too late to do any pro-active fallback handling. Is it? Wait for the silence detector to deal with it. - # TODO Observe the actual handling of this section and think about possible improvements. + # Let 'em play anyway ... self.engine.player.play(entries[0], transition_type) self.logger.info(self.get_ascii_programme()) @@ -956,15 +905,9 @@ class AuraScheduler(threading.Thread): except LoadSourceException as e: self.logger.critical(SU.red("Could not pre-roll entries %s" % ResourceUtil.get_entries_string(entries)), e) - # # Pro-active fallback handling, avoiding the need of the silence detector kicking-in. - # self.fallback.handle_proactive_fallback(self, entries[0].playlist) - if entries[-1].status != EntryPlayState.READY: self.logger.critical(SU.red("Entries didn't reach 'ready' state during pre-rolling (Entries: %s)" % ResourceUtil.get_entries_string(entries))) - # # Pro-active fallback handling, avoiding the need of the silence detector kicking-in. - # self.fallback.handle_proactive_fallback(self, entries[0].playlist) - loader_diff = diff - self.config.get("preroll_offset") loader = CallFunctionTimer(diff=loader_diff, func=do_preroll, param=param, fadein=fadein, fadeout=fadeout, switcher=False, loader=True) self.message_timer.append(loader)