diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-07-19 19:37:09 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-07-19 19:37:09 +0200 |
commit | 7c00440dfb7fd9772a5674f8e04f66aea2e73a10 (patch) | |
tree | e1dbb1eb2ad2d453f8b1ce1932ced58e1e8183fc /module/PluginThread.py | |
parent | cleanup (diff) | |
download | pyload-7c00440dfb7fd9772a5674f8e04f66aea2e73a10.tar.xz |
fix in unrar plugin
Diffstat (limited to 'module/PluginThread.py')
-rw-r--r-- | module/PluginThread.py | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/module/PluginThread.py b/module/PluginThread.py index a036b4878..0a8151a25 100644 --- a/module/PluginThread.py +++ b/module/PluginThread.py @@ -407,7 +407,7 @@ class HookThread(PluginThread): class InfoThread(PluginThread): - def __init__(self, manager, data, pid=-1, rid=-1): + def __init__(self, manager, data, pid=-1, rid=-1, add=False): """Constructor""" PluginThread.__init__(self, manager) @@ -416,6 +416,7 @@ class InfoThread(PluginThread): # [ .. (name, plugin) .. ] self.rid = rid #result id + self.add = add #add packages instead of return result self.cache = [] #accumulated data @@ -440,6 +441,29 @@ class InfoThread(PluginThread): self.fetchForPlugin(pluginname, plugin, urls, self.updateDB) self.m.core.files.save() + elif self.add: + for pluginname, urls in plugins.iteritems(): + plugin = self.m.core.pluginManager.getPlugin(pluginname, True) + if hasattr(plugin, "getInfo"): + self.fetchForPlugin(pluginname, plugin, urls, self.updateCache, True) + + else: + #generate default result + result = [(url, 0, 3, url) for url in urls] + + self.updateCache(pluginname, result) + + + packs = parseNames([(name, url) for name, x,y, url in self.cache]) + + self.m.core.log.debug("Fetched and generated %d packages" % len(packs)) + + for k, v in packs: + self.m.core.api.addPackage(k, v) + + #empty cache + del self.cache[:] + else: #post the results self.m.infoResults[self.rid] = {} @@ -489,6 +513,9 @@ class InfoThread(PluginThread): self.cache = [] + def updateCache(self, plugin, result): + self.cache.extend(result) + def fetchForPlugin(self, pluginname, plugin, urls, cb, err=None): try: result = [] #result loaded from cache |