Commit ac56a061 authored by fred's avatar fred

publish nonstop playlists

parent 4b9a732f
......@@ -20,6 +20,8 @@ urlpatterns = patterns('',
'panikweb.views.soundfile_embed', name='soundfile-embed-view'),
url(r'^emissions/(?P<emission_slug>[\w,-]+)/(?P<episode_slug>[\w,-]+)/dlg-embed/(?P<pk>\d+)/$',
'panikweb.views.soundfile_dlg_embed', name='soundfile-dialog-embed-view'),
url(r'^emissions/(?P<slug>[\w,-]+)/playlist/(?P<year>[0-9]{4})-(?P<month>[-\w]+)-(?P<day>[0-9]+)/$',
'panikweb.views.nonstop_playlist', name='nonstop-playlist'),
url(r'^emissions/(?P<slug>[\w,-]+)/$', 'panikweb.views.emission', name='emission-view'),
url(r'^ckeditor/', include('ckeditor.urls')),
url(r'^emissions/archives$', 'panikweb.views.emissionsArchives', name='emissionsArchives'),
......
......@@ -31,6 +31,7 @@ from emissions.utils import whatsonair, period_program
from newsletter.forms import SubscribeForm
from nonstop.utils import get_current_nonstop_track
from nonstop.models import SomaLogLine
from panikombo.models import ItemTopik
......@@ -102,6 +103,18 @@ class EmissionDetailView(DetailView, EmissionMixin):
context['schedules'] = Schedule.objects.select_related().filter(
emission=self.object).order_by('rerun', 'datetime')
context['news'] = NewsItem.objects.all().filter(emission=self.object.id).order_by('-date')[:3]
try:
nonstop_object = Nonstop.objects.get(slug=self.object.slug)
except Nonstop.DoesNotExist:
pass
else:
today = date.today()
dates = [today - timedelta(days=x) for x in range(7)]
if datetime.now().time() < nonstop_object.start and not (
nonstop_object.end < nonstop_object.start):
dates = dates[1:]
context['nonstop'] = nonstop_object
context['nonstop_dates'] = dates
context.update(self.get_emission_context(self.object))
return context
emission = EmissionDetailView.as_view()
......@@ -125,6 +138,32 @@ class EpisodeDetailView(DetailView, EmissionMixin):
episode = EpisodeDetailView.as_view()
class NonstopPlaylistView(TemplateView):
template_name = 'nonstop_playlist.html'
def get_context_data(self, **kwargs):
context = super(NonstopPlaylistView, self).get_context_data(**kwargs)
context['emission'] = Emission.objects.get(slug=kwargs.get('slug'))
context['date'] = date(int(kwargs.get('year')),
int(kwargs.get('month')), int(kwargs.get('day')))
nonstop_object = Nonstop.objects.get(slug=kwargs.get('slug'))
start = datetime(
int(kwargs.get('year')), int(kwargs.get('month')), int(kwargs.get('day')),
nonstop_object.start.hour, nonstop_object.start.minute)
end = datetime(
int(kwargs.get('year')), int(kwargs.get('month')), int(kwargs.get('day')),
nonstop_object.end.hour, nonstop_object.end.minute)
if end < start:
end = end + timedelta(days=1)
context['tracks'] = SomaLogLine.objects.filter(
play_timestamp__gte=start,
play_timestamp__lte=end,
on_air=True).select_related()
return context
nonstop_playlist = NonstopPlaylistView.as_view()
class EmissionEpisodesDetailView(DetailView, EmissionMixin):
model = Emission
template_name = 'emissions/episodes.html'
......
......@@ -1823,3 +1823,23 @@ body#embed ul.custom .soundfile-info {
body#embed span.fragment-title {
font-weight: normal;
}
table.playlist {
width: 90%;
}
table.playlist td {
padding: 0.5ex;
text-align: left;
}
table.playlist td.tracktime {
width: 6ex;
text-align: center;
}
p.playlist-disclaimer {
margin-top: 2em;
max-width: 60ex;
font-style: italic;
}
{% extends "emissions.html" %}
{% load paniktags staticfiles i18n %}
{% load paniktags staticfiles i18n thumbnail %}
{% block bodyID %}Emissions{% endblock %}
{% block title %}{{ emission.title }}{% endblock %}
......@@ -31,7 +31,7 @@
{% endif %}
</div>
{% if episodes.exists or futurEpisodes.exists or news %}
{% if episodes.exists or futurEpisodes.exists or news or nonstop %}
<div id="Emission-tabs-menu" class="rightPart episodes">
{% if news %}
......@@ -45,6 +45,24 @@
</div>
{% endif %}
{% if nonstop %}
<div class="sub emissions-newsitems">
<h5 class="sectionLabel">{% trans 'Recently' %}</h5>
{% for date in nonstop_dates %}
<div class="episode inline episode-inline">
{% if emission.image %}
{% thumbnail emission.image "60x60" crop="50% 25%" as im %}
<img src="{{im.url}}"/>
{% endthumbnail %}
{% endif %}
<div class="title">
<h5 class="title"><a href="{% url 'nonstop-playlist' slug=emission.slug year=date.year month=date.month day=date.day %}">{{date|date:'D d M Y'|lower}}</a></h5>
</div>
</div>
{% endfor %}
</div>
{% endif %}
{% if episodes.exists or futurEpisodes.exists %}
<h5 class="sectionLabel right"><a class="" href="{% url 'emissionEpisodes' slug=emission.slug %}">Tous ({{ episodes.count }})</a></h5>
......
{% extends "emissions.html" %}
{% load paniktags staticfiles i18n thumbnail %}
{% block bodyID %}Emissions{% endblock %}
{% block title %}{{ emission.title }}{% endblock %}
{% block toptitle %}
<h1 class="top"><a href="{% url 'grid' %}">{% trans 'Program' %}</a></h1>
{% endblock %}
{% block nav %}
{% emission_nav %}
{% endblock %}
{% block main %}
<div class="wrapper navigation cf">
<div id="Emission-container" class="emission">
<header>
<h3>{% trans 'Playlist' %} - {{date|date:'l d F Y'|lower}}</h3>
</header>
<table class="playlist">
{% for track in tracks %}
<tr>
<td class="tracktime">{{track.play_timestamp|date:'h:i'}}</td>
<td class="tracktitle">{{track.filepath.track.title }}</td>
<td class="trackartist">{{track.filepath.track.artist.name }}</td>
</tr>
{% endfor %}
</table>
<p class="playlist-disclaimer">
N.B. Débordements d'émissions et autres manifestations
radiophoniques spontanées peuvent amener cette liste à ne pas être
totalement correcte.
</p>
</div>
</div>
{% endblock %}
{% block links %}
{% endblock %}
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