streaming link for seances (#1003)
This commit is contained in:
parent
ba5e9da460
commit
7a2f61e849
|
@ -226,15 +226,22 @@ jq('#tabellio-agenda tbody a').click(
|
|||
class event/klass">
|
||||
<div>
|
||||
<p class="date"><a tal:attributes="href event/absolute_url"><span tal:content="event/shortdatetime"/></a></p>
|
||||
<div>
|
||||
<a tal:attributes="href string:${event/absolute_url}/ecouter.m3u" class="streaming">Streaming</a>
|
||||
<a class="cri" tal:condition="event/cri" href="#"
|
||||
<div tal:define="stream_url event/get_stream_url">
|
||||
<a tal:condition="stream_url" tal:attributes="href stream_url" class="streaming">Streaming</a>
|
||||
<a class="cri" tal:condition="python: event.cri and event.cri.to_object" href="#"
|
||||
tal:attributes="href event/cri/to_object/absolute_url">Compte-rendu intégral</a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<script>
|
||||
$('a.streaming').click(function(event) {
|
||||
if ($(this).attr('href').indexOf('.m3u') == -1) {
|
||||
window.open($(this).attr('href'), 'streaming', 'width=220,height=220');
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -10,6 +10,9 @@ from plone.formwidget.contenttree import ObjPathSourceBinder
|
|||
from themis.fields import LegisSession
|
||||
from plone.app.textfield import RichText
|
||||
|
||||
from plone.registry.interfaces import IRegistry
|
||||
from tabellio.config.interfaces import ITabellioSettings
|
||||
|
||||
from tabellio.agenda.interfaces import MessageFactory as _
|
||||
from event import IBaseEvent, BaseEvent, EventBaseView
|
||||
|
||||
|
@ -28,6 +31,29 @@ class ParlEvent(BaseEvent):
|
|||
def klass(self):
|
||||
return 'parlementary-event'
|
||||
|
||||
def get_stream_url(self):
|
||||
# this brings some knowledge about the view into the object, this is
|
||||
# not ideal.
|
||||
settings = component.getUtility(IRegistry).forInterface(ITabellioSettings, False)
|
||||
if settings.audiofiles_path:
|
||||
if os.path.exists(os.path.join(settings.audiofiles_path, self.get_stream_name())):
|
||||
if settings.embedded_audio_player_url:
|
||||
return settings.embedded_audio_player_url + '?' + self.get_stream_name()
|
||||
else:
|
||||
return self.absolute_url() + '/ecouter.m3u'
|
||||
if not self.is_now():
|
||||
return None
|
||||
|
||||
if settings.embedded_audio_player_url:
|
||||
return settings.embedded_audio_player_url
|
||||
else:
|
||||
return self.absolute_url() + '/ecouter.m3u'
|
||||
|
||||
def get_stream_name(self):
|
||||
filename = '%04d%02d%02d%02d-SEAN.mp3' % (
|
||||
self.start.year, self.start.month,
|
||||
self.start.day, self.start.hour)
|
||||
return filename
|
||||
|
||||
class ParlEventBaseView(EventBaseView):
|
||||
def next_event_url(self):
|
||||
|
|
Reference in New Issue