• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python util.url_for函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get_uris

    def get_uris(self, media_file):
        """Return a list of URIs from which the stored file can be accessed.

        :type media_file: :class:`~mediacore.model.media.MediaFile`
        :param media_file: The associated media file object.
        :rtype: list
        :returns: All :class:`StorageURI` tuples for this file.

        """
        uris = []

        # Remotely accessible URL
        url = url_for(controller='/media', action='serve', id=media_file.id,
                      slug=media_file.media.slug, container=media_file.container,
                      qualified=True)
        uris.append(StorageURI(media_file, 'http', url, None))

        # An optional streaming RTMP URI
        rtmp_server_uri = self._data.get('rtmp_server_uri', None)
        if rtmp_server_uri:
            uris.append(StorageURI(media_file, 'rtmp', media_file.unique_id, rtmp_server_uri))

        # Remotely *download* accessible URL
        url = url_for(controller='/media', action='serve', id=media_file.id,
                      slug=media_file.media.slug, container=media_file.container,
                      qualified=True, download=1)
        uris.append(StorageURI(media_file, 'download', url, None))

        # Internal file URI that will be used by MediaController.serve
        path = urlunsplit(('file', '', self._get_path(media_file.unique_id), '', ''))
        uris.append(StorageURI(media_file, 'file', path, None))

        return uris
开发者ID:BlendedLearningCollaborative,项目名称:mediacore-community,代码行数:33,代码来源:localfiles.py


示例2: test_can_generate_static_url_with_proxy_prefix

 def test_can_generate_static_url_with_proxy_prefix(self):
     self.pylons_config['proxy_prefix'] = '/proxy'
     request = self.init_fake_request(server_name='server.example')
     request.environ['SCRIPT_NAME'] = '/proxy'
     
     assert_equals('/proxy/media', url_for('/media'))
     qualified_media_url = url_for('/media', qualified=True)
     assert_equals('http://server.example:80/proxy/media', qualified_media_url)
开发者ID:Jpoudrier,项目名称:mediacore-community,代码行数:8,代码来源:url_for_test.py


示例3: embed_iframe

def embed_iframe(media, width=400, height=225, frameborder=0, **kwargs):
    """Return an <iframe> tag that loads our universal player.

    :type media: :class:`mediacore.model.media.Media`
    :param media: The media object that is being rendered, to be passed
        to all instantiated player objects.
    :rtype: :class:`genshi.builder.Element`
    :returns: An iframe element stream.

    """
    src = url_for(controller="/media", action="embed_player", slug=media.slug, qualified=True)
    tag = Element("iframe", src=src, width=width, height=height, frameborder=frameborder, **kwargs)
    return tag
开发者ID:greentv,项目名称:mediacore,代码行数:13,代码来源:players.py


示例4: 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


示例5: embed_iframe

def embed_iframe(media, width=400, height=225, frameborder=0, **kwargs):
    """Return an <iframe> tag that loads our universal player.

    :type media: :class:`mediacore.model.media.Media`
    :param media: The media object that is being rendered, to be passed
        to all instantiated player objects.
    :rtype: :class:`genshi.builder.Element`
    :returns: An iframe element stream.

    """
    src = url_for(controller='/media', action='embed_player', slug=media.slug,
                  qualified=True)
    tag = Element('iframe', src=src, width=width, height=height,
                  frameborder=frameborder, **kwargs)
    # some software is known not to work with self-closing iframe tags 
    # ('<iframe ... />'). Several WordPress instances are affected as well as
    # TWiki http://opensource.mediacore.com/community/topic/embed-iframe-closing-tag
    tag.append('')
    return tag
开发者ID:axxis7,项目名称:mediacore-community,代码行数:19,代码来源:players.py


示例6: js_url

 def js_url(self):
     return url_for('/scripts/third-party/jw_player/jwplayer.min.js',
                    qualified=self.qualified)
开发者ID:axxis7,项目名称:mediacore-community,代码行数:3,代码来源:players.py


示例7: swf_url

 def swf_url(self):
     return url_for('/scripts/third-party/jw_player/player.swf',
                    qualified=self.qualified)
开发者ID:axxis7,项目名称:mediacore-community,代码行数:3,代码来源:players.py


示例8: update_params

 def update_params(self, d):
     super(LinkifyMixin, self).update_params(d)
     d.link = url_for(d.link)
开发者ID:Jpoudrier,项目名称:mediacore-community,代码行数:3,代码来源:__init__.py


示例9: swf_url

 def swf_url(self):
     """Return the flash player URL."""
     return url_for('/m3u8player/public/scripts/third-party/HLSProviderChromeless.swf', qualified=self.qualified)
开发者ID:g522342435,项目名称:m3u8player,代码行数:3,代码来源:player.py


示例10: js

def js(source):
    if config['debug'] and source in js_sources_debug:
        return url_for(js_sources_debug[source])
    return url_for(js_sources[source])
开发者ID:donspaulding,项目名称:mediacore,代码行数:4,代码来源:helpers.py


示例11: swf_url

 def swf_url(self):
     """Return the flash player URL."""
     return url_for('/scripts/third-party/jw_player/player.swf',
                    qualified=self.qualified)
开发者ID:kiberpipa,项目名称:mediacore,代码行数:4,代码来源:players.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python model.fetch_row函数代码示例发布时间:2022-05-27
下一篇:
Python thumbnails.thumb_url函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap