src/pyams_content/component/video/interfaces.py
changeset 1059 34e6d07ea2e9
parent 967 1be26c1585fd
equal deleted inserted replaced
1058:1fe028e17f70 1059:34e6d07ea2e9
       
     1 #
       
     2 # Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
       
     3 # All Rights Reserved.
       
     4 #
       
     5 # This software is subject to the provisions of the Zope Public License,
       
     6 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
       
     7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
       
     8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
       
     9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
       
    10 # FOR A PARTICULAR PURPOSE.
       
    11 #
       
    12 
       
    13 __docformat__ = 'restructuredtext'
       
    14 
       
    15 from zope.annotation import IAttributeAnnotatable
       
    16 from zope.contentprovider.interfaces import IContentProvider
       
    17 from zope.interface import Interface, Attribute
       
    18 from zope.schema import Choice, TextLine
       
    19 
       
    20 from pyams_content import _
       
    21 from pyams_content.component.paragraph.interfaces import IBaseParagraph
       
    22 from pyams_i18n.schema import I18nTextField, I18nTextLineField
       
    23 
       
    24 
       
    25 class IExternalVideoSettings(Interface):
       
    26     """External video settings"""
       
    27 
       
    28     video_id = Attribute("Video ID")
       
    29 
       
    30 
       
    31 class IExternalVideoProvider(Interface):
       
    32     """External video provider"""
       
    33 
       
    34     label = Attribute("Video provider label")
       
    35     weight = Attribute("Video provider weight (used for ordering)")
       
    36     settings_interface = Attribute("Video provider settings interface")
       
    37 
       
    38 
       
    39 class IExternalVideo(IAttributeAnnotatable):
       
    40     """Base interface for external video integration"""
       
    41 
       
    42     author = TextLine(title=_("Author"),
       
    43                       description=_("Name of document's author"),
       
    44                       required=True)
       
    45 
       
    46     description = I18nTextField(title=_("Associated text"),
       
    47                                 description=_("Video description displayed by front-office template"),
       
    48                                 required=False)
       
    49 
       
    50     provider_name = Choice(title=_("Video provider"),
       
    51                            description=_("Name of external platform providing selected video"),
       
    52                            required=False,
       
    53                            vocabulary="PyAMS video providers")
       
    54 
       
    55     def get_provider(self):
       
    56         """Get external video provider utility"""
       
    57 
       
    58     settings = Attribute("Video settings")
       
    59 
       
    60 
       
    61 EXTERNAL_VIDEO_PARAGRAPH_TYPE = 'External video'
       
    62 EXTERNAL_VIDEO_PARAGRAPH_NAME = _("External video")
       
    63 EXTERNAL_VIDEO_PARAGRAPH_RENDERERS = 'PyAMS.paragraph.video.renderers'
       
    64 
       
    65 
       
    66 class IExternalVideoParagraph(IExternalVideo, IBaseParagraph):
       
    67     """External video paragraph"""
       
    68 
       
    69     title = I18nTextLineField(title=_("Legend"),
       
    70                               required=False)
       
    71 
       
    72     renderer = Choice(title=_("Video template"),
       
    73                       description=_("Presentation template used for this video"),
       
    74                       vocabulary=EXTERNAL_VIDEO_PARAGRAPH_RENDERERS,
       
    75                       default='default')
       
    76 
       
    77 
       
    78 class IExternalVideoRenderer(IContentProvider):
       
    79     """External video renderer"""