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
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
def __getPriorities(self, hosterList, filter = True): ''' Sort hosters based on their resolvers priority. ''' import urlresolver urlresolver.lazy_plugin_scan() ranking = [] for hoster in hosterList: #if not self.checkForResolver(hoster['name']): # continue found = False for imp in urlresolver.UrlResolver.implementors(): if imp.valid_url('dummy',hoster['name'].lower()): ranking.append([imp.priority,hoster]) found = True break if not found and not filter: ranking.append([999,hoster]) ranking.sort() hosterQueue = [] for i,hoster in ranking: hosterQueue.append(hoster) return hosterQueue
def getPlugins(): urlresolver.lazy_plugin_scan() resolvers = [] for resolver in UrlResolver.implementors(): resolvers.append(resolver) return resolvers