Renamed IThumbnail interface to IThumbnails
authorThierry Florac <thierry.florac@onf.fr>
Thu, 05 Jul 2018 15:18:17 +0200
changeset 95 b379aa42a359
parent 94 7c1ed13e4b91
child 96 4b305c1f9e0b
Renamed IThumbnail interface to IThumbnails
src/pyams_media/video.py
src/pyams_media/zmi/media.py
src/pyams_media/zmi/video.py
--- a/src/pyams_media/video.py	Mon Jun 11 16:01:56 2018 +0200
+++ b/src/pyams_media/video.py	Thu Jul 05 15:18:17 2018 +0200
@@ -20,7 +20,7 @@
 from tempfile import NamedTemporaryFile
 
 # import interfaces
-from pyams_file.interfaces import IVideo, IThumbnail, IThumbnailFile
+from pyams_file.interfaces import IVideo, IThumbnails, IThumbnailFile
 from pyams_media.interfaces import IVideoType
 from pyams_utils.interfaces.tales import ITALESExtension
 from zope.annotation.interfaces import IAnnotations
@@ -43,7 +43,7 @@
 THUMBNAIL_SIZE_ANNOTATION_KEY = 'pyams_media.video.thumbnail_size'
 
 
-@adapter_config(context=IVideo, provides=IThumbnail)
+@adapter_config(context=IVideo, provides=IThumbnails)
 class VideoThumbnailAdapter(object):
     """Video thumbnail adapter"""
 
@@ -70,13 +70,13 @@
 
     def get_thumbnail_size(self, thumbnail_name, forced=False):
         if self.thumbnail is not None:
-            return IThumbnail(self.thumbnail).get_thumbnail_size(thumbnail_name, forced)
+            return IThumbnails(self.thumbnail).get_thumbnail_size(thumbnail_name, forced)
         else:
             return self.get_image_size()
 
     def get_geometry(self, selection_name):
         if self.thumbnail is not None:
-            return IThumbnail(self.thumbnail).get_geometry(selection_name)
+            return IThumbnails(self.thumbnail).get_geometry(selection_name)
         else:
             size = self.get_image_size()
             if size:
@@ -89,15 +89,15 @@
 
     def set_geometry(self, selection_name, geometry):
         if self.thumbnail is not None:
-            IThumbnail(self.thumbnail).set_geometry(selection_name, geometry)
+            IThumbnails(self.thumbnail).set_geometry(selection_name, geometry)
 
     def clear_geometries(self):
         if self.thumbnail is not None:
-            IThumbnail(self.thumbnail).clear_geometries()
+            IThumbnails(self.thumbnail).clear_geometries()
 
     def get_thumbnail_name(self, thumbnail_name, with_size=False):
         if self.thumbnail is not None:
-            return IThumbnail(self.thumbnail).get_thumbnail_name(thumbnail_name, with_size)
+            return IThumbnails(self.thumbnail).get_thumbnail_name(thumbnail_name, with_size)
         else:
             size = self.get_image_size()
             if size is not None:
@@ -141,9 +141,9 @@
             if thumbnail_name != size_name:
                 watermark = os.path.abspath(os.path.join(__file__, '..',
                                                          'skin', 'resources', 'img', 'video-play-mask.png'))
-                return IThumbnail(self.thumbnail).get_thumbnail(thumbnail_name, format, watermark)
+                return IThumbnails(self.thumbnail).get_thumbnail(thumbnail_name, format, watermark)
             else:
-                return IThumbnail(self.thumbnail).get_thumbnail(thumbnail_name, format)
+                return IThumbnails(self.thumbnail).get_thumbnail(thumbnail_name, format)
 
     def delete_thumbnail(self, thumbnail_name):
         annotations = IAnnotations(self.video)
@@ -167,7 +167,7 @@
         else:
             thumbnail_name = name
             format = None
-        thumbnails = IThumbnail(self.context)
+        thumbnails = IThumbnails(self.context)
         result = thumbnails.get_thumbnail(thumbnail_name, format)
         transaction.commit()
         return result
--- a/src/pyams_media/zmi/media.py	Mon Jun 11 16:01:56 2018 +0200
+++ b/src/pyams_media/zmi/media.py	Thu Jul 05 15:18:17 2018 +0200
@@ -16,7 +16,7 @@
 # import standard library
 
 # import interfaces
-from pyams_file.interfaces import IVideo, IThumbnail, IAudio, IMediaFile, IMediaWidget
+from pyams_file.interfaces import IVideo, IThumbnails, IAudio, IMediaFile, IMediaWidget
 from pyams_form.interfaces.form import IWidgetsPrefixViewletsManager, IFormHelp
 from pyams_media.interfaces import IMediaConversionUtility, VIDEO_FRAME_SIZE, IMediaConverter, IMediaConversions
 from pyams_media.zmi.interfaces import IMediaConversionsForm
@@ -150,7 +150,7 @@
 
     @property
     def original_frame_size(self):
-        return IThumbnail(self.context).get_image_size()
+        return IThumbnails(self.context).get_image_size()
 
     def has_conversion(self, converter, frame_size):
         conversions = IMediaConversions(self.context)
--- a/src/pyams_media/zmi/video.py	Mon Jun 11 16:01:56 2018 +0200
+++ b/src/pyams_media/zmi/video.py	Thu Jul 05 15:18:17 2018 +0200
@@ -18,7 +18,7 @@
 from decimal import Decimal
 
 # import interfaces
-from pyams_file.interfaces import IVideo, IThumbnail, IMediaWidget
+from pyams_file.interfaces import IVideo, IThumbnails, IMediaWidget
 from pyams_form.interfaces.form import IWidgetsPrefixViewletsManager, IFormHelp
 from pyams_skin.interfaces.viewlet import IContextActions
 from pyams_utils.interfaces import MANAGE_PERMISSION, VIEW_PERMISSION
@@ -126,7 +126,7 @@
 
     def createAndAdd(self, data):
         data = data.get(self, data)
-        thumbnailer = IThumbnail(self.context, None)
+        thumbnailer = IThumbnails(self.context, None)
         if thumbnailer is not None:
             size = thumbnailer.get_image_size()
             time = data.get('time')