def get_uris(self, media_file): """Return a list of URIs from which the stored file can be accessed. :type media_file: :class:`~mediadrop.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
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)
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)
def embed_iframe(media, width=400, height=225, frameborder=0, **kwargs): """Return an <iframe> tag that loads our universal player. :type media: :class:`mediadrop.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://mediadrop.video/community/topic/embed-iframe-closing-tag tag.append('') return tag
def embed_iframe(media, width=400, height=225, frameborder=0, **kwargs): """Return an <iframe> tag that loads our universal player. :type media: :class:`mediadrop.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://mediadrop.net/community/topic/embed-iframe-closing-tag tag.append("") return tag
def update_params(self, d): super(LinkifyMixin, self).update_params(d) d.link = url_for(d.link)
def js_url(self): return url_for('/scripts/third-party/jw_player/jwplayer.min.js', qualified=self.qualified)
def swf_url(self): return url_for('/scripts/third-party/jw_player/player.swf', qualified=self.qualified)
def swf_url(self): """Return the flash player URL.""" return url_for("/scripts/third-party/flowplayer/flowplayer-3.2.14.swf", qualified=self.qualified)
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])
def swf_url(self): """Return the flash player URL.""" return url_for('/scripts/third-party/flowplayer/flowplayer-3.2.14.swf', qualified=self.qualified)