From 5c587d56f7ff611b84f8b5b7950f2031f90cc66d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Fri, 6 May 2016 09:12:12 +0200 Subject: [PATCH] include audio player on event views --- tabellio/pfbviews/comevent.py | 9 +++++++++ tabellio/pfbviews/comevent_templates/view.pt | 9 ++++++++- tabellio/pfbviews/parlevent.py | 4 ++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/tabellio/pfbviews/comevent.py b/tabellio/pfbviews/comevent.py index 49ec9c5..ee6f386 100644 --- a/tabellio/pfbviews/comevent.py +++ b/tabellio/pfbviews/comevent.py @@ -1,11 +1,20 @@ +import os + from five import grok +from zope import schema, component from Products.CMFCore.utils import getToolByName from parlevent import ParlEventBaseView from tabellio.agenda.comevent import IComEvent import tabellio.config.utils +from plone.registry.interfaces import IRegistry +from tabellio.config.interfaces import ITabellioSettings class CommissionView(ParlEventBaseView): def get_stream_name(self): + settings = component.getUtility(IRegistry).forInterface(ITabellioSettings, False) + if settings.audiofiles_path: + if os.path.exists(os.path.join(settings.audiofiles_path, self.context.id + '.mp3')): + return self.context.id + '.mp3' if not self.context.commission: return 'XXXX' com_id = self.context.commission.to_path.split('/')[-1] diff --git a/tabellio/pfbviews/comevent_templates/view.pt b/tabellio/pfbviews/comevent_templates/view.pt index ac69252..92ba279 100644 --- a/tabellio/pfbviews/comevent_templates/view.pt +++ b/tabellio/pfbviews/comevent_templates/view.pt @@ -36,7 +36,14 @@
  • Rapport / Compte rendu Rapport / Compte rendu (non disponible)
  • -
  • Streaming +
  • + Réécouter : +
    +
    +
    Streaming (non disponible)
  • diff --git a/tabellio/pfbviews/parlevent.py b/tabellio/pfbviews/parlevent.py index ad90fa5..46f7126 100644 --- a/tabellio/pfbviews/parlevent.py +++ b/tabellio/pfbviews/parlevent.py @@ -20,6 +20,10 @@ class ParlEventBaseView(tabellio.agenda.parlevent.ParlEventBaseView): class ParlEventView(ParlEventBaseView): def get_stream_name(self): + settings = component.getUtility(IRegistry).forInterface(ITabellioSettings, False) + if settings.audiofiles_path: + if os.path.exists(os.path.join(settings.audiofiles_path, self.context.id + '.mp3')): + return self.context.id + '.mp3' filename = '%04d%02d%02d%02d-SEAN.mp3' % ( self.context.start.year, self.context.start.month, self.context.start.day, self.context.start.hour)