diff --git a/modules/scheduling/scheduler.py b/modules/scheduling/scheduler.py index 9088817e4b6326f32501794de4355580c20b7822..1689dcefe4e20d78412f7356ba911a2e83edc62b 100644 --- a/modules/scheduling/scheduler.py +++ b/modules/scheduling/scheduler.py @@ -320,6 +320,30 @@ class AuraScheduler(threading.Thread): 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. def get_act_programme_as_string(self): """ @@ -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): """ Ignore schedules which are beyond the scheduling window. The end of the scheduling window