date = utils.tofirstdayinisoweek(year, week)
date = datetime(*date.timetuple()[:3])
+ now = date = datetime.now()
program = period_program(date, date+timedelta(days=7))[:20]
+ # keep first program then everything but nonstop slots
+ program = [program[0]] + [x for x in program if x.get_duration() != 0]
+ for slot in program:
+ if slot.get_duration() and slot.datetime > now and slot.end_datetime() < now:
+ slot.currently_playing = True
+ break
+ else:
+ program[0].currently_playing = True # first slot, nonstop
return {
'program': program,