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

Possiblity to limit count of next schedules.

parent 48dc589b
No related branches found
No related tags found
No related merge requests found
...@@ -320,6 +320,30 @@ class AuraScheduler(threading.Thread): ...@@ -320,6 +320,30 @@ class AuraScheduler(threading.Thread):
return current_schedule return current_schedule
def get_next_schedules(self, max_count=0):
"""
Retrieves the schedules to be played after the current one.
Args:
max_count (Integer): Maximum of schedules to return, if `0` all exitsing ones are returned
Returns:
([Schedule]): The next schedules
"""
now_unix = self.get_virtual_now()
next_schedules = []
for schedule in self.programme:
if schedule.start_unix > now_unix:
if (len(next_schedules) < max_count) or max_count == 0:
next_schedules.append(schedule)
else:
break
return next_schedules
# FIXME Review relevance. # FIXME Review relevance.
def get_act_programme_as_string(self): def get_act_programme_as_string(self):
""" """
...@@ -561,24 +585,6 @@ class AuraScheduler(threading.Thread): ...@@ -561,24 +585,6 @@ class AuraScheduler(threading.Thread):
def get_next_schedules(self):
"""
Retrieves the schedules to be played after the current one.
Returns:
([Schedule]): The next schedules
"""
now_unix = self.get_virtual_now()
next_schedules = []
for schedule in self.programme:
if schedule.start_unix > now_unix:
next_schedules.append(schedule)
return next_schedules
def filter_scheduling_window(self, schedules): def filter_scheduling_window(self, schedules):
""" """
Ignore schedules which are beyond the scheduling window. The end of the scheduling window Ignore schedules which are beyond the scheduling window. The end of the scheduling window
......
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