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

Filter out of scheduling window.

parent 0ccbdae5
Branches
No related tags found
No related merge requests found
......@@ -544,6 +544,21 @@ class AuraScheduler(threading.Thread):
def filter_scheduling_window(self, playlists):
"""
Ignore playlists which are beyond the scheduling window
"""
now_unix = self.get_virtual_now()
len_before = len(playlists)
scheduling_window = self.config.get("scheduling_window_offset")
playlists = list(filter(lambda entry: entry.start_unix > now_unix+scheduling_window, playlists))
len_after = len(playlists)
self.logger.info("Removed %s playlist(s) which are out of the scheduling window (%ss)" % ((len_before - len_after), scheduling_window))
return playlists
def queue_programme(self):
"""
Queues the current programme (playlists as per schedule) by creating
......@@ -551,6 +566,7 @@ class AuraScheduler(threading.Thread):
"""
current_schedule, current_playlist = self.get_active_playlist()
playlists = self.get_next_playlists()
playlists = self.filter_scheduling_window(playlists)
if current_schedule and current_playlist:
active_entry = self.get_active_entry()
......@@ -831,7 +847,7 @@ class AuraScheduler(threading.Thread):
self.logger("Could not load entries %s:" % EngineUtil.get_entries_string(entries), e)
# TODO Fallback logic here
loader_diff = diff - self.config.get("preload_offset")
loader_diff = diff - self.config.get("preroll_offset")
loader = CallFunctionTimer(diff=loader_diff, func=do_preroll, param=entries, fadein=fadein, fadeout=fadeout, switcher=False, loader=True)
self.message_timer.append(loader)
loader.start()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment