def generatePackages(self, links): """ Parses links, generates packages names from urls :param links: list of urls :return: package names mapped to urls """ result = parseNames((x, x) for x in links) return result
def generatePackages(self, urls): """Generates :class:`Package` instances and names from urls. Useful for many different links and no\ given package name. :param urls: list of urls :return: list of `Package` """ return [Package(name, purls) for name, purls in parseNames([(url,url) for url in urls]).iteritems()]
def updateResult(self, plugin, result, force=False): #parse package name and generate result #accumulate results self.cache.extend(result) if len(self.cache) >= 20 or force: #used for package generating tmp = [(name, (url, LinkStatus(name, plugin, "unknown", status, int(size)))) for name, size, status, url in self.cache] data = parseNames(tmp) result = {} for k, v in data.iteritems(): for url, status in v: status.packagename = k result[url] = status self.m.setInfoResults(self.rid, result) self.cache = []
def checkOnlineStatus(self, urls): """ initiates online status check, will also decrypt files. :param urls: :return: initial set of data as :class:`OnlineCheck` instance containing the result id """ data, crypter = self.core.pluginManager.parseUrls(urls) # initial result does not contain the crypter links tmp = [(url, (url, LinkStatus(url, pluginname, "unknown", 3, 0))) for url, pluginname in data] data = parseNames(tmp) result = {} for k, v in data.iteritems(): for url, status in v: status.packagename = k result[url] = status data.update(crypter) # hoster and crypter will be processed rid = self.core.threadManager.createResultThread(data, False) return OnlineCheck(rid, result)