(and mark them as unavailable when appropriate)
This commit is contained in:
parent
8a4e116d76
commit
90ae2c4d40
|
@ -1,8 +1,30 @@
|
|||
from five import grok
|
||||
from Products.CMFCore.utils import getToolByName
|
||||
from parlevent import ParlEventBaseView
|
||||
from tabellio.agenda.comevent import IComEvent
|
||||
import tabellio.config.utils
|
||||
|
||||
class View(grok.View, ParlEventBaseView):
|
||||
class CommissionView(ParlEventBaseView):
|
||||
def get_stream_name(self):
|
||||
com_id = self.context.commission.to_path.split('/')[-1]
|
||||
com_audio_code = tabellio.config.utils.get_com_audio_code(com_id)
|
||||
filename = '%04d%02d%02d%02d-%s.mp3' % (
|
||||
self.context.start.year, self.context.start.month,
|
||||
self.context.start.day, self.context.start.hour,
|
||||
com_audio_code)
|
||||
return filename
|
||||
|
||||
class View(grok.View, CommissionView):
|
||||
grok.context(IComEvent)
|
||||
grok.require('zope2.View')
|
||||
|
||||
class M3U(grok.View, CommissionView):
|
||||
grok.context(IComEvent)
|
||||
grok.require('zope2.View')
|
||||
grok.name('ecouter.m3u')
|
||||
|
||||
def render(self):
|
||||
portal_url = getToolByName(self.context, 'portal_url').getPortalObject().absolute_url()
|
||||
self.request.response.setHeader('Content-type', 'audio/x-mpegurl')
|
||||
return portal_url + '/mp3/' + self.get_stream_name() + '\n'
|
||||
|
||||
|
|
|
@ -32,6 +32,13 @@
|
|||
Lieu : <span tal:replace="context/place"/>
|
||||
</p>
|
||||
|
||||
<ul id="cri-stream">
|
||||
<li><a href="#" class="cri" tal:condition="python: context.cri and context.cri.to_object"
|
||||
tal:attributes="href context/cri/to_object/absolute_url">Compte-rendu intégral</a>
|
||||
<span class="cri" tal:condition="python: not(context.cri and context.cri.to_object)">Compte-rendu intégral (non disponible)</span></li>
|
||||
<li><a tal:attributes="href string:${context/absolute_url}/ecouter.m3u" class="streaming" tal:condition="view/has_stream">Streaming</a>
|
||||
<span class="streaming" tal:condition="not: view/has_stream">Streaming (non disponible)</span></li>
|
||||
</ul>
|
||||
|
||||
<div class="order-of-the-day" tal:condition="python: context.order_of_the_day and context.order_of_the_day.output">
|
||||
<h2>Ordre du jour</h2>
|
||||
|
|
|
@ -11,12 +11,6 @@ import tabellio.agenda.parlevent
|
|||
|
||||
|
||||
class ParlEventBaseView(tabellio.agenda.parlevent.ParlEventBaseView):
|
||||
def get_stream_name(self):
|
||||
filename = '%04d%02d%02d%02d-SEAN.mp3' % (
|
||||
self.context.start.year, self.context.start.month,
|
||||
self.context.start.day, self.context.start.hour)
|
||||
return filename
|
||||
|
||||
def has_stream(self):
|
||||
settings = component.getUtility(IRegistry).forInterface(ITabellioSettings, False)
|
||||
if not settings.audiofiles_path:
|
||||
|
@ -24,11 +18,19 @@ class ParlEventBaseView(tabellio.agenda.parlevent.ParlEventBaseView):
|
|||
return os.path.exists(os.path.join(settings.audiofiles_path, self.get_stream_name()))
|
||||
|
||||
|
||||
class View(grok.View, ParlEventBaseView):
|
||||
class ParlEventView(ParlEventBaseView):
|
||||
def get_stream_name(self):
|
||||
filename = '%04d%02d%02d%02d-SEAN.mp3' % (
|
||||
self.context.start.year, self.context.start.month,
|
||||
self.context.start.day, self.context.start.hour)
|
||||
return filename
|
||||
|
||||
|
||||
class View(grok.View, ParlEventView):
|
||||
grok.context(tabellio.agenda.parlevent.IParlEvent)
|
||||
grok.require('zope2.View')
|
||||
|
||||
class M3U(grok.View, ParlEventBaseView):
|
||||
class M3U(grok.View, ParlEventView):
|
||||
grok.context(tabellio.agenda.parlevent.IParlEvent)
|
||||
grok.require('zope2.View')
|
||||
grok.name('seance.m3u')
|
||||
|
|
|
@ -32,6 +32,14 @@
|
|||
Lieu : <span tal:replace="context/place"/>
|
||||
</p>
|
||||
|
||||
<ul id="cri-stream">
|
||||
<li><a href="#" class="cri" tal:condition="python: context.cri and context.cri.to_object"
|
||||
tal:attributes="href context/cri/to_object/absolute_url">Compte-rendu intégral</a>
|
||||
<span class="cri" tal:condition="python: not(context.cri and context.cri.to_object)">Compte-rendu intégral (non disponible)</span></li>
|
||||
<li><a tal:attributes="href string:${context/absolute_url}/seance.m3u" class="streaming" tal:condition="view/has_stream">Streaming</a>
|
||||
<span class="streaming" tal:condition="not: view/has_stream">Streaming (non disponible)</span></li>
|
||||
</ul>
|
||||
|
||||
<div class="order-of-the-day" tal:condition="python: context.order_of_the_day and context.order_of_the_day.output">
|
||||
<h2>Ordre du jour</h2>
|
||||
<div tal:content="structure context/order_of_the_day/output"/>
|
||||
|
|
Reference in New Issue