Commit 01e0e61f authored by David Trattnig's avatar David Trattnig
Browse files

Trackservice init fixes.

parent 2b4cfec0
......@@ -261,11 +261,12 @@ class Playlog:
data["schedule_start"] = datetime.now()
if next_timeslot:
data["schedule_end"] = next_timeslot.schedule_end
data["schedule_end"] = next_timeslot.schedule_start
else:
# Fake the end, because the timeslot is actually not existing
data["schedule_end"] = datetime.now() + timedelta(hours=1)
self.current_timeslot = data
def set_timeslot(self, timeslot):
......@@ -285,7 +286,10 @@ class Playlog:
data = {}
next_timeslot = self.engine.scheduler.get_next_timeslots(1)
if next_timeslot: next_timeslot = next_timeslot[0]
if next_timeslot:
next_timeslot = next_timeslot[0]
else:
next_timeslot = None
# A valid timeslot from the scheduler is available
if timeslot:
......@@ -301,11 +305,12 @@ class Playlog:
if not self.previous_timeslot:
self.current_timeslot["schedule_end"] = timeslot.schedule_start
self.previous_timeslot = self.current_timeslot
self.current_timeslot = data
# Defaults for a not existing timeslot
else:
self.init_timeslot(next_timeslot)
# A valid following timeslot is available
if next_timeslot:
ns = {}
......@@ -318,8 +323,7 @@ class Playlog:
ns["playlist_id"] = next_timeslot.playlist_id
ns = SU.clean_dictionary(ns)
self.next_timeslot = ns
self.current_timeslot = data
def assign_fallback_playlist(self, data, timeslot):
......
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