--- a/src/pyams_content/component/video/provider/zmi/__init__.py Wed May 22 15:15:52 2019 +0200
+++ b/src/pyams_content/component/video/provider/zmi/__init__.py Wed May 22 17:16:07 2019 +0200
@@ -34,11 +34,20 @@
return value or ''
+def get_playlist_id(settings):
+ """Include playlist ID if loop is required"""
+ if settings.loop:
+ return settings.video_id
+ else:
+ return None
+
+
YOUTUBE_PARAMS = (
('start_at', 'start', time_to_seconds),
('stop_at', 'end', time_to_seconds),
('autoplay', 'autoplay', int),
('loop', 'loop', int),
+ (None, 'playlist', get_playlist_id),
('show_commands', 'controls', int),
('hide_branding', 'modestbranding', int),
('show_related', 'rel', int),
@@ -77,7 +86,12 @@
settings = self.context
params = {}
for attr, param, handler in self.params:
- params[param] = handler(getattr(settings, attr))
+ if attr is None:
+ result = handler(settings)
+ else:
+ result = handler(getattr(settings, attr))
+ if result is not None:
+ params[param] = result
return urlencode(params)