def run(self): plugins = accumulate(self.data) crypter = {} # db or info result cb = self.update_db if self.pid > 1 else self.update_result # filter out crypter plugins for name in self.pyload_core.pgm.get_plugins("crypter"): if name in plugins: crypter[name] = plugins[name] del plugins[name] if crypter: # decrypt them links, packages = self.decrypt(crypter) # push these as initial result and save package names cb(links) for pack in packages: for url in pack.get_urls(): self.names[url] = pack.name links.extend(pack.links) cb(pack.links) # TODO: no plugin information pushed to GUI # parse links and merge hoster, crypter = self.pyload_core.pgm.parse_urls(l.url for l in links) accumulate(hoster + crypter, plugins) self.__pi = ProgressInfo("BasePlugin", "", self._("online check"), 0, 0, sum(len(urls) for urls in plugins.values()), self.owner, ProgressType.LinkCheck) for pluginname, urls in plugins.items(): plugin = self.pyload_core.pgm.load_module("hoster", pluginname) klass = self.pyload_core.pgm.get_plugin_class("hoster", pluginname, overwrite=False) if hasmethod(klass, "get_info"): self.fetch_for_plugin(klass, urls, cb) # TODO: this branch can be removed in the future elif hasmethod(plugin, "get_info"): self.pyload_core.log.debug( "Deprecated .get_info() method on module level, " "use staticmethod instead") self.fetch_for_plugin(plugin, urls, cb) if self.oc: self.oc.done = True self.names.clear() self.__manager.timestamp = time.time() + 5 * 60 self.__pi = None self.finished()
def run(self): plugins = accumulate(self.data) crypter = {} # db or info result cb = self.update_db if self.pid > 1 else self.update_result # filter out crypter plugins for name in self.pyload.pgm.get_plugins('crypter'): if name in plugins: crypter[name] = plugins[name] del plugins[name] if crypter: # decrypt them links, packages = self.decrypt(crypter) # push these as initial result and save package names cb(links) for pack in packages: for url in pack.get_urls(): self.names[url] = pack.name links.extend(pack.links) cb(pack.links) # TODO: no plugin information pushed to GUI # parse links and merge hoster, crypter = self.pyload.pgm.parse_urls( l.url for l in links) accumulate(hoster + crypter, plugins) self.__progress_info = ProgressInfo( 'BasePlugin', '', self._('online check'), 0, 0, sum(len(urls) for urls in plugins.values()), self.owner, ProgressType.LinkCheck ) for pluginname, urls in plugins.items(): plugin = self.pyload.pgm.load_module('hoster', pluginname) klass = self.pyload.pgm.get_plugin_class( 'hoster', pluginname, overwrite=False) if hasmethod(klass, 'get_info'): self.fetch_for_plugin(klass, urls, cb) # TODO: this branch can be removed in the future elif hasmethod(plugin, 'get_info'): self.pyload.log.debug( 'Deprecated .get_info() method on module level, ' 'use staticmethod instead') self.fetch_for_plugin(plugin, urls, cb) if self.oc: self.oc.done = True self.names.clear() self.manager.timestamp = time.time() + 5 * 60 self.__progress_info = None self.finished()
def run(self): pack = self.pyload.files.get_package(self.pid) api = self.pyload.api.with_user_context(self.owner) links, packages = self.decrypt(accumulate(self.data), pack.password) # if there is only one package links will be added to current one if len(packages) == 1: # TODO: also rename the package (optionally) links.extend(packages[0].links) del packages[0] if links: self.pyload.log.info( self._('Decrypted {0:d} links into package {1}').format( len(links), pack.name)) api.add_links(self.pid, [l.url for l in links]) for pack_ in packages: api.add_package(pack_.name, pack_.get_urls(), pack.password) self.pyload.files.set_download_status( self.fid, DownloadStatus.Finished if not self.error else DownloadStatus.Failed) self.manager.done(self)
def update_result(self, result): tmp = {} res = [] # separate these with name and without for link in result: if link.url in self.names: tmp[link] = self.names[link.url] else: res.append(link) data = parse.packs((link.name, link) for link in res) # merge in packages that already have a name data = accumulate(tmp.items(), data) # TODO: self.oc is None ?! self.__manager.set_info_results(self.oc, data)
def update_result(self, result): tmp = {} res = [] # separate these with name and without for link in result: if link.url in self.names: tmp[link] = self.names[link.url] else: res.append(link) data = parse.packs((link.name, link) for link in res) # merge in packages that already have a name data = accumulate(tmp.items(), data) # TODO: self.oc is None ?! self.manager.set_info_results(self.oc, data)