def _find_resolvers(self):
     urlresolver.lazy_plugin_scan()
     imps = []
     for imp in UrlResolver.implementors():
         if imp.valid_url(self.get_url(), self.get_host()):
             imps.append(imp)
     return imps
예제 #2
0
    def __find_resolvers(self, universal=False):
        urlresolver.lazy_plugin_scan()
        resolvers = []
        found = False
        for resolver in UrlResolver.implementors():
            if (self._domain in resolver.domains) or any(self._domain in domain for domain in resolver.domains):
                found = True
                resolvers.append(resolver)
            elif (universal and ('*' in resolver.domains)):
                resolvers.append(resolver)

        if not found: common.addon.log_debug('no resolver found for: %s' % (self._domain))
        else: common.addon.log_debug('resolvers for %s are %s' % (self._domain, [r.name for r in resolvers]))

        return resolvers
예제 #3
0
    def __find_resolvers(self, universal=False):
        urlresolver.lazy_plugin_scan()
        resolvers = []
        found = False
        for resolver in UrlResolver.implementors():
            if (self._domain in resolver.domains) or any(self._domain in domain for domain in resolver.domains):
                found = True
                resolvers.append(resolver)
            elif (universal and ('*' in resolver.domains)):
                resolvers.append(resolver)

        if not found: common.addon.log_debug('no resolver found for: %s' % (self._domain))
        else: common.addon.log_debug('resolvers for %s are %s' % (self._domain, [r.name for r in resolvers]))

        return resolvers
    def __find_resolvers(self, universal=False):
        urlresolver.lazy_plugin_scan()
        resolvers = []
        found = False
        for resolver in UrlResolver.implementors():
            if resolver.get_setting("enabled") != "true":
                continue
            if (self._domain in resolver.domains) or any(self._domain in domain for domain in resolver.domains):
                found = True
                resolvers.append(resolver)
            elif universal and ("*" in resolver.domains):
                resolvers.append(resolver)

        if not found:
            common.addon.log_debug("no resolver found for: %s" % (self._domain))
        else:
            common.addon.log_debug("resolvers for %s are %s" % (self._domain, [r.name for r in resolvers]))

        return resolvers
예제 #5
0
def find_resolver(web_url):
    '''
    Finds the first resolver that says it can resolve the given URL to a media 
    file. Note that it might not actually be able to, but it advertises the
    fact that it can.
    
    .. note::
    
        You probably won't need to access this function for normal usage - just
        use :func:`urlresolver.resolve`.
        
    Args:
        web_url (str): A URL to a web page associated with a piece of media
        content.
        
    Returns:
        An instance of a class that implements 
        :class:`urlresolver.plugnplay.interfaces.UrlResolver` and advertises
        that it can resolve the given ``web_url``.
    '''
    for imp in UrlResolver.implementors():
        if imp.valid_url(web_url):
            return imp
    return False
예제 #6
0
def find_resolver(web_url):
    '''
    Finds the first resolver that says it can resolve the given URL to a media 
    file. Note that it might not actually be able to, but it advertises the
    fact that it can.
    
    .. note::
    
        You probably won't need to access this function for normal usage - just
        use :func:`urlresolver.resolve`.
        
    Args:
        web_url (str): A URL to a web page associated with a piece of media
        content.
        
    Returns:
        An instance of a class that implements 
        :class:`urlresolver.plugnplay.interfaces.UrlResolver` and advertises
        that it can resolve the given ``web_url``.
    '''
    for imp in UrlResolver.implementors():
        if imp.valid_url(web_url):
            return imp
    return False
예제 #7
0
 def _find_resolvers(self):
     imps = []
     for imp in UrlResolver.implementors():
         if imp.valid_url(self.get_url(), self.get_host()):
             imps.append(imp)
     return imps
예제 #8
0
def lazy_plugin_scan():
    if not UrlResolver.implementors():
        plugnplay.scan_plugins(UrlWrapper)
예제 #9
0
def lazy_plugin_scan():
    if not UrlResolver.implementors():
        plugnplay.scan_plugins(UrlWrapper)