diff options
author | mkaay <mkaay@mkaay.de> | 2010-05-17 00:01:05 +0200 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2010-05-17 00:01:05 +0200 |
commit | 32ba2f79389ccf4f7d40197837c02d28bb13261d (patch) | |
tree | 893de3556630eaa8242fa0fe3550039cab210b09 /module/ThreadManager.py | |
parent | new config option (outgoing intreface) (diff) | |
download | pyload-32ba2f79389ccf4f7d40197837c02d28bb13261d.tar.xz |
new plugin interface test, ShareonlineBiz + SerienjunkiesOrg + MegauploadedCom fix, other stuff
Diffstat (limited to 'module/ThreadManager.py')
-rw-r--r-- | module/ThreadManager.py | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/module/ThreadManager.py b/module/ThreadManager.py index 31a2f004a..4befebd28 100644 --- a/module/ThreadManager.py +++ b/module/ThreadManager.py @@ -103,7 +103,28 @@ class ThreadManager(Thread): if pyfile.plugin.__type__ == "container": return True return False - + + def handleNewInterface(self, pyfile): + plugin = pyfile.plugin + if plugin.__type__ == "container": + if plugin.createNewPackage(): + packages = plugin.getPackages() + if len(packages) == 1: + self.parent.logger.info(_("1 new package from %s") % (pyfile.status.filename,)) + else: + self.parent.logger.info(_("%i new packages from %s") % (len(packages), pyfile.status.filename)) + for name, links in packages: + pid = self.list.packager.addNewPackage(name) + for link in links: + newFile = self.list.collector.addLink(link) + self.list.packager.addFileToPackage(pid, self.list.collector.popFile(newFile)) + if len(links) == 1: + self.parent.logger.info(_("1 link in %s") % (name,)) + else: + self.parent.logger.info(_("%i links in %s") % (len(links), name)) + else: + pass + def jobFinished(self, pyfile): """manage completing download""" self.lock.acquire() @@ -122,7 +143,9 @@ class ThreadManager(Thread): self.py_downloading.remove(pyfile) if pyfile.status.type == "finished": - if pyfile.plugin.__type__ == "container": + if hasattr(pyfile.plugin, "__interface__") and pyfile.plugin.__interface__ >= 2: + self.handleNewInterface(pyfile) + elif pyfile.plugin.__type__ == "container": newLinks = 0 if pyfile.plugin.links: if isinstance(pyfile.plugin.links, dict): |