Commit 9d9c534c authored by Simon Daron's avatar Simon Daron
Browse files

Remove HTML view for onair

parent 9296e2c6
......@@ -16,7 +16,6 @@ urlpatterns = patterns('',
url(r'^ckeditor/', include('ckeditor.urls')),
url(r'^get$', 'panikweb.views.get', name='get'),
url(r'^player$', 'panikweb.views.player', name='player'),
url(r'^what$', 'panikweb.views.what', name='what'),
(r'^api/v2/', include('fiber.rest_api.urls')),
(r'^admin/fiber/', include('fiber.admin_urls')),
......
......@@ -173,44 +173,12 @@ class Get(TemplateView):
get = Get.as_view()
class WhatsOnAir(TemplateView):
template_name = 'whatsonair.html'
def get_context_data(self, **kwargs):
context = super(WhatsOnAir, self).get_context_data(**kwargs)
now = datetime.now()
date_start = now - timedelta(days=1)
date_end = now + timedelta(days=1)
diffusions = Diffusion.objects.filter(
datetime__range=(date_start, date_end)).order_by('datetime')
diffusions = [x for x in diffusions if x.datetime <= now and
now <= x.datetime + timedelta(minutes=x.episode.emission.duration)]
episode = None
emission = None
if diffusions: # there should be only one
diffusion = diffusions[0]
episode = diffusion.episode
emission = episode.emission
else:
for schedule in Schedule.objects.all():
if not schedule.matches(now):
continue
emission = schedule.emission
break
context['episode'] = episode
context['emission'] = emission
return context
what = WhatsOnAir.as_view()
class Player(TemplateView):
template_name = 'player.html'
def get_context_data(self, **kwargs):
context = super(Player, self).get_context_data(**kwargs)
#context['whatsonair'] = WhatsOnAir.as_view() #HOW TO PRELOAD WHATSONAIR ON PLAYER?
return context
return context
player = Player.as_view()
......
Markdown is supported
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