summaryrefslogtreecommitdiffstats
path: root/module/PluginThread.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-08-07 22:46:19 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-08-07 22:46:19 +0200
commit8a8a521b3c4af39ca8d3fb29d1e322cca230b3c2 (patch)
tree9509772e03ac887ad73392da876f10f405ff0a0e /module/PluginThread.py
parentfile info prefetching (RapidshareCom UploadedTo), download folder fix, Serien... (diff)
downloadpyload-8a8a521b3c4af39ca8d3fb29d1e322cca230b3c2.tar.xz
better link checking
Diffstat (limited to 'module/PluginThread.py')
-rw-r--r--module/PluginThread.py47
1 files changed, 25 insertions, 22 deletions
diff --git a/module/PluginThread.py b/module/PluginThread.py
index d17f638f0..592fc7521 100644
--- a/module/PluginThread.py
+++ b/module/PluginThread.py
@@ -267,34 +267,37 @@ class HookThread(PluginThread):
class InfoThread(PluginThread):
#----------------------------------------------------------------------
- def __init__(self, manager):
+ def __init__(self, manager, data):
"""Constructor"""
PluginThread.__init__(self, manager)
- self.queue = Queue() # job queue
- self.active = False
-
+ self.data = data
+ # [ .. (name, plugin) .. ]
self.start()
#----------------------------------------------------------------------
def run(self):
"""run method"""
- while True:
- self.active = self.queue.get()
- if self.active == "quit":
- return True
- pyfile = self.active
-
- pyfile.plugin.getInfo()
-
- #----------------------------------------------------------------------
- def put(self, job):
- """assing job to thread"""
- self.queue.put(job)
-
- #----------------------------------------------------------------------
- def stop(self):
- """stops the thread"""
- self.put("quit")
-
+ plugins = {}
+
+ for url, plugin in self.data:
+ if plugins.has_key(plugin):
+ plugins[plugin].append(url)
+ else:
+ plugins[plugin] = [url]
+
+ for pluginname, urls in plugins.iteritems():
+ plugin = self.m.core.pluginManager.getPlugin(plugin)
+ if hasattr(plugin, "getInfo"):
+ print "get", urls
+ print ""
+ for result in plugin.getInfo(urls):
+ if not type(result) == list: result = [result]
+ print "updating", result
+ print ""
+ self.m.core.files.updateFileInfo(result)
+
+ print ""
+ print "finished info fetching"
+ self.m.core.files.save() \ No newline at end of file