def resolve(web_url): """ Resolve a web page to a media stream. It is usually as simple as:: import urlresolver media_url = urlresolver.resolve(web_url) where ``web_url`` is the address of a web page which is associated with a media file and ``media_url`` is the direct URL to the media. Behind the scenes, :mod:`urlresolver` will check each of the available resolver plugins to see if they accept the ``web_url`` in priority order (lowest priotity number first). When it finds a plugin willing to resolve the URL, it passes the ``web_url`` to the plugin and returns the direct URL to the media file, or ``False`` if it was not possible to resolve. .. seealso:: :class:`HostedMediaFile` Args: web_url (str): A URL to a web page associated with a piece of media content. Returns: If the ``web_url`` could be resolved, a string containing the direct URL to the media file, if not, returns ``False``. """ source = HostedMediaFile(url=web_url) return source.resolve()
def resolve(url): # import the resolvers so that urlresolvers pick them up import resources.lib.resolvers hmf = HostedMediaFile(url) try: return hmf.resolve() except AttributeError: return False
def resolve(url): # import the resolvers so that urlresolvers pick them up import lib.resolvers hmf = HostedMediaFile(url) try: return hmf.resolve() except AttributeError: return False
def resolve(url): if type(url) is unicode: url = url.encode('utf8') url = quote(url, ':/') # import the resolvers so that urlresolvers pick them up import lib.resolvers hmf = HostedMediaFile(url) try: return hmf.resolve() except AttributeError: return False
def resolveVideo(url): import resolvers hmf = HostedMediaFile(url) vidurl = hmf.resolve() playVideo(vidurl)