summaryrefslogtreecommitdiffstats
path: root/module/PluginThread.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-07-21 12:08:06 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-07-21 12:08:06 +0200
commit1fce480bc8ba6eeccae5036b6842c8f03c746e0c (patch)
treeb2af1aefad8a866f1ac94ad4b66f4527e42344d6 /module/PluginThread.py
parentonline check for container (diff)
downloadpyload-1fce480bc8ba6eeccae5036b6842c8f03c746e0c.tar.xz
improved online check
Diffstat (limited to 'module/PluginThread.py')
-rw-r--r--module/PluginThread.py41
1 files changed, 26 insertions, 15 deletions
diff --git a/module/PluginThread.py b/module/PluginThread.py
index b32361f4e..b415d7d60 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, add=False, container=None):
+ def __init__(self, manager, data, pid=-1, rid=-1, add=False):
"""Constructor"""
PluginThread.__init__(self, manager)
@@ -417,7 +417,6 @@ class InfoThread(PluginThread):
self.rid = rid #result id
self.add = add #add packages instead of return result
- self.container = container #container file
self.cache = [] #accumulated data
@@ -427,6 +426,7 @@ class InfoThread(PluginThread):
"""run method"""
plugins = {}
+ container = []
for url, plugin in self.data:
if plugin in plugins:
@@ -434,6 +434,14 @@ class InfoThread(PluginThread):
else:
plugins[plugin] = [url]
+
+ # filter out container plugins
+ for name in self.m.core.pluginManager.containerPlugins:
+ if name in plugins:
+ container.extend([(name, url) for url in plugins[name]])
+
+ del plugins[name]
+
#directly write to database
if self.pid > -1:
for pluginname, urls in plugins.iteritems():
@@ -467,10 +475,10 @@ class InfoThread(PluginThread):
else: #post the results
- if self.container:
+ for name, url in container:
#attach container content
try:
- data = self.decryptContainer()
+ data = self.decryptContainer(name, url)
except:
print_exc()
self.m.log.error("Could not decrypt container.")
@@ -570,17 +578,19 @@ class InfoThread(PluginThread):
cb(pluginname, result)
- def decryptContainer(self):
- url, plugin = self.m.core.pluginManager.parseUrls([self.container])[0]
- # decrypt only container
- if plugin in self.m.core.pluginManager.containerPlugins:
+ def decryptContainer(self, plugin, url):
+ data = []
+ # only works on container plugins
+
+ self.m.log.debug("Pre decrypting %s with %s" % (url, plugin))
- # dummy pyfile
- pyfile = PyFile(self.m.core.files, -1, url, url, 0, 0, "", plugin, -1, -1)
+ # dummy pyfile
+ pyfile = PyFile(self.m.core.files, -1, url, url, 0, 0, "", plugin, -1, -1)
- pyfile.initPlugin()
+ pyfile.initPlugin()
- # little plugin lifecycle
+ # little plugin lifecycle
+ try:
pyfile.plugin.setup()
pyfile.plugin.loadToDisk()
pyfile.plugin.decrypt(pyfile)
@@ -590,8 +600,9 @@ class InfoThread(PluginThread):
pyfile.plugin.urls.extend(pack[1])
data = self.m.core.pluginManager.parseUrls(pyfile.plugin.urls)
+ except :
+ pass
+ finally:
pyfile.release()
- return data
-
- return []
+ return data