当前位置: 首页>>代码示例>>Python>>正文


Python thumbnails.thumb_url函数代码示例

本文整理汇总了Python中mediacore.lib.thumbnails.thumb_url函数的典型用法代码示例。如果您正苦于以下问题:Python thumb_url函数的具体用法?Python thumb_url怎么用?Python thumb_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了thumb_url函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: flashvars

    def flashvars(self):
        playlist = []
        vars = {
            'canvas': {'backgroundColor': '#000', 'backgroundGradient': 'none'},
            'clip': {'scaling': 'fit'},
            'playlist': playlist,
        }

        # Show a preview image
        if self.media.type == AUDIO or not self.autoplay:
            playlist.append({
                'url': thumb_url(self.media, 'l', qualified=self.qualified),
                'autoPlay': True,
                'autoBuffer': True,
            })

        playlist.append({
            'url': self.file.play_url(qualified=self.qualified),
            'autoPlay': self.autoplay,
            'autoBuffer': self.autoplay or self.autobuffer,
        })

        # Flowplayer wants these options passed as an escaped JSON string
        # inside a single 'config' flashvar. When using the flowplayer's
        # own JS, this is automatically done, but since we use Swiff, a
        # SWFObject clone, we have to do this ourselves.
        vars = {'config': json.dumps(vars, separators=(',', ':'))}
        return vars
开发者ID:vinces1979,项目名称:mediacore,代码行数:28,代码来源:players.py

示例2: flashvars

    def flashvars(self):
        """Return a python dict of flashvars for this player."""
        http_uri = self.uris[0]

        playlist = []
        vars = {
            "canvas": {"backgroundColor": "#000", "backgroundGradient": "none"},
            "plugins": {"controls": {"autoHide": True}},
            "clip": {"scaling": "fit"},
            "playlist": playlist,
        }

        # Show a preview image
        if self.media.type == AUDIO or not self.autoplay:
            playlist.append(
                {"url": thumb_url(self.media, "l", qualified=self.qualified), "autoPlay": True, "autoBuffer": True}
            )

        playlist.append(
            {"url": str(http_uri), "autoPlay": self.autoplay, "autoBuffer": self.autoplay or self.autobuffer}
        )

        # Flowplayer wants these options passed as an escaped JSON string
        # inside a single 'config' flashvar. When using the flowplayer's
        # own JS, this is automatically done, but since we use Swiff, a
        # SWFObject clone, we have to do this ourselves.
        vars = {"config": simplejson.dumps(vars, separators=(",", ":"))}
        return vars
开发者ID:greentv,项目名称:mediacore,代码行数:28,代码来源:players.py

示例3: player_vars

    def player_vars(self):
        """Return a python dict of vars for this player."""
        vars = {
            'autostart': self.autoplay,
            'height': self.adjusted_height,
            'width': self.adjusted_width,
            'controlbar': 'bottom',
            'players': [
                # XXX: Currently flash *must* come first for the RTMP/HTTP logic.
                {'type': 'flash', 'src': self.swf_url()},
                {'type': 'html5'},
                {'type': 'download'},
            ],
        }
        playlist = self.playlist()
        plugins = self.plugins()
        if playlist:
            vars['playlist'] = playlist
        if plugins:
            vars['plugins'] = plugins

        # Playlists have 'image's and <video> elements have provide 'poster's,
        # but <audio> elements have no 'poster' attribute. Set an image via JS:
        if self.media.type == AUDIO and not playlist:
            vars['image'] = thumb_url(self.media, 'l', qualified=self.qualified)

        return vars
开发者ID:axxis7,项目名称:mediacore-community,代码行数:27,代码来源:players.py

示例4: html5_attrs

 def html5_attrs(self):
     attrs = {
         'src': self.file.play_url(qualified=self.qualified),
         'controls': 'controls',
     }
     if self.autoplay:
         attrs['autoplay'] = 'autoplay'
     elif self.autobuffer:
         # This isn't included in the HTML5 spec, but Safari supports it
         attrs['autobuffer'] = 'autobuffer'
     if self.file.type == VIDEO:
         attrs['poster'] = thumb_url(self.media, 'l', qualified=self.qualified)
     return attrs
开发者ID:vinces1979,项目名称:mediacore,代码行数:13,代码来源:players.py

示例5: playlist

    def playlist(self):
        if self.uris:
            return None

        if self.rtmp_uris:
            return self.rtmp_playlist()

        uri = self.flash_uris[0]
        return [{
            'image': thumb_url(self.media, 'l', qualified=self.qualified),
            'file': str(uri),
            'duration': self.media.duration,
            'provider': self.providers[uri.file.type],
        }]
开发者ID:axxis7,项目名称:mediacore-community,代码行数:14,代码来源:players.py

示例6: html5_attrs

 def html5_attrs(self):
     attrs = {
         "id": self.elem_id,
         "controls": "controls",
         "width": self.adjusted_width,
         "height": self.adjusted_height,
     }
     if self.autoplay:
         attrs["autoplay"] = "autoplay"
     elif self.autobuffer:
         # This isn't included in the HTML5 spec, but Safari supports it
         attrs["autobuffer"] = "autobuffer"
     if self.media.type == VIDEO:
         attrs["poster"] = thumb_url(self.media, "l", qualified=self.qualified)
     return attrs
开发者ID:greentv,项目名称:mediacore,代码行数:15,代码来源:players.py

示例7: flashvars

    def flashvars(self):
        """Return a python dict of flashvars for this player."""
        youtube = self.get_uris(container='youtube')
        rtmp = self.get_uris(scheme=RTMP)
        http = self.get_uris(scheme=HTTP)
        audio_desc = self.get_uris(type=AUDIO_DESC)
        captions = self.get_uris(type=CAPTIONS)

        vars = {
            'image': thumb_url(self.media, 'l', qualified=self.qualified),
            'autostart': self.autoplay,
        }
        if youtube:
            vars['provider'] = 'youtube'
            vars['file'] = str(youtube[0])
        elif rtmp:
            if len(rtmp) > 1:
                # For multiple RTMP bitrates, use Media RSS playlist
                vars = {}
                vars['playlistfile'] = url_for(
                    controller='/media',
                    action='jwplayer_rtmp_mrss',
                    slug=self.media.slug,
                )
            else:
                # For a single RTMP stream, use regular Flash vars.
                rtmp_uri = rtmp[0]
                vars['file'] = rtmp_uri.file_uri
                vars['streamer'] = rtmp_uri.server_uri
            vars['provider'] = 'rtmp'
        else:
            http_uri = http[0]
            vars['provider'] = self.providers[http_uri.file.type]
            vars['file'] = str(http_uri)

        plugins = []
        if rtmp:
            plugins.append('rtmp')
        if audio_desc:
            plugins.append('audiodescription');
            vars['audiodescription.file'] = audio_desc[0].uri
        if captions:
            plugins.append('captions');
            vars['captions.file'] = captions[0].uri
        if plugins:
            vars['plugins'] = ','.join(plugins)

        return vars
开发者ID:kiberpipa,项目名称:mediacore,代码行数:48,代码来源:players.py

示例8: html5_attrs

 def html5_attrs(self):
     attrs = {
         'id': self.elem_id,
         'controls': 'controls',
         'width': self.adjusted_width,
         'height': self.adjusted_height,
     }
     if self.autoplay:
         attrs['autoplay'] = 'autoplay'
     elif self.autobuffer:
         # This isn't included in the HTML5 spec, but Safari supports it
         attrs['autobuffer'] = 'autobuffer'
     if self.media.type == VIDEO:
         attrs['poster'] = thumb_url(self.media, 'l',
                                     qualified=self.qualified)
     return attrs
开发者ID:axxis7,项目名称:mediacore-community,代码行数:16,代码来源:players.py

示例9: rtmp_playlist

 def rtmp_playlist(self):
     levels = []
     item = {
         "streamer": self.rtmp_uris[0].server_uri,
         "provider": "rtmp",
         "levels": levels,
         "duration": self.media.duration,
     }
     # If no HTML5 uris exist, no <video> tag will be output, so we have to
     # say which thumb image to use. Otherwise it's unnecessary bytes.
     if not self.uris:
         item["image"] = thumb_url(self.media, "l", qualified=self.qualified)
     for uri in self.rtmp_uris:
         levels.append({"file": uri.file_uri, "bitrate": uri.file.bitrate, "width": uri.file.width})
     playlist = [item]
     return playlist
开发者ID:greentv,项目名称:mediacore,代码行数:16,代码来源:players.py

示例10: playlist

    def playlist(self):
        if self.uris:
            return None

        if self.rtmp_uris:
            return self.rtmp_playlist()

        uri = self.flash_uris[0]
        return [
            {
                "image": thumb_url(self.media, "l", qualified=self.qualified),
                "file": str(uri),
                "duration": self.media.duration,
                "provider": self.providers[uri.file.type],
            }
        ]
开发者ID:greentv,项目名称:mediacore,代码行数:16,代码来源:players.py

示例11: rtmp_playlist

 def rtmp_playlist(self):
     levels = []
     item = {'streamer': self.rtmp_uris[0].server_uri,
             'provider': 'rtmp',
             'levels': levels,
             'duration': self.media.duration}
     # If no HTML5 uris exist, no <video> tag will be output, so we have to
     # say which thumb image to use. Otherwise it's unnecessary bytes.
     if not self.uris:
         item['image'] = thumb_url(self.media, 'l', qualified=self.qualified)
     for uri in self.rtmp_uris:
         levels.append({
             'file': uri.file_uri,
             'bitrate': uri.file.bitrate,
             'width': uri.file.width,
         })
     playlist = [item]
     return playlist
开发者ID:axxis7,项目名称:mediacore-community,代码行数:18,代码来源:players.py


注:本文中的mediacore.lib.thumbnails.thumb_url函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。