]> git.0d.be Git - django-panik-emissions.git/blobdiff - emissions/utils.py
adjust time of dawn
[django-panik-emissions.git] / emissions / utils.py
index def59d6353c77cc01baa342b6c170c89e2c979fd..cec0f63bdb31b1329e4cf9a1038e90b371f9bf3d 100644 (file)
@@ -56,7 +56,7 @@ def whatsonair():
     now = datetime.now()
     # get program of today minus a few hours, as radio days are not from
     # midnight to midnigth but from 5am to 5am
-    program = day_program(now - timedelta(hours=Schedule.DAY_HOUR_START),
+    program = day_program(now - timedelta(hours=Schedule.DAY_HOUR_START) + timedelta(minutes=Schedule.DAY_MINUTE_START),
             prefetch_sounds=False, prefetch_categories=False, include_nonstop=False)
     program = [x for x in program if not x.datetime > now]
 
@@ -220,7 +220,7 @@ def period_program(date_start, date_end, prefetch_sounds=True,
     # last step is adding nonstop zones between slots
     nonstops = list(Nonstop.objects.all().order_by('start'))
     nonstops = [x for x in nonstops if x.start != x.end]
-    dawn = time(Schedule.DAY_HOUR_START, 0)
+    dawn = time(Schedule.DAY_HOUR_START, Schedule.DAY_MINUTE_START)
     try:
         first_of_the_day = [x for x in nonstops if x.start <= dawn][-1]
         nonstops = nonstops[nonstops.index(first_of_the_day):] + nonstops[:nonstops.index(first_of_the_day)]