summaryrefslogtreecommitdiffstats
path: root/module/threads
diff options
context:
space:
mode:
Diffstat (limited to 'module/threads')
-rw-r--r--module/threads/AddonThread.py (renamed from module/threads/HookThread.py)10
-rw-r--r--module/threads/DecrypterThread.py3
-rw-r--r--module/threads/DownloadThread.py12
-rw-r--r--module/threads/InfoThread.py6
-rw-r--r--module/threads/ThreadManager.py6
5 files changed, 19 insertions, 18 deletions
diff --git a/module/threads/HookThread.py b/module/threads/AddonThread.py
index bffa72ca0..3a378ad6e 100644
--- a/module/threads/HookThread.py
+++ b/module/threads/AddonThread.py
@@ -6,8 +6,8 @@ from traceback import print_exc
from BaseThread import BaseThread
-class HookThread(BaseThread):
- """thread for hooks"""
+class AddonThread(BaseThread):
+ """thread for addons"""
def __init__(self, m, function, args, kwargs):
"""Constructor"""
@@ -51,11 +51,11 @@ class HookThread(BaseThread):
self.f(*self.args, **self.kwargs)
except Exception, e:
if hasattr(self.f, "im_self"):
- hook = self.f.im_self
- hook.logError(_("An Error occured"), e)
+ addon = self.f.im_self
+ addon.logError(_("An Error occured"), e)
if self.m.core.debug:
print_exc()
- self.writeDebugReport(hook.__name__, plugin=hook)
+ self.writeDebugReport(addon.__name__, plugin=addon)
finally:
local = copy(self.active)
diff --git a/module/threads/DecrypterThread.py b/module/threads/DecrypterThread.py
index ce3c8cd83..39448a620 100644
--- a/module/threads/DecrypterThread.py
+++ b/module/threads/DecrypterThread.py
@@ -55,6 +55,7 @@ class DecrypterThread(BaseThread):
plugin.logDebug("Decrypted", plugin_result)
result.extend(plugin_result)
+ #TODO
result = uniqify(result)
pack_names = {}
urls = []
@@ -73,7 +74,7 @@ class DecrypterThread(BaseThread):
self.m.core.api.addFiles(self.pid, urls)
for p in pack_names.itervalues():
- self.m.core.api.addPackage(p.name, p.urls, p.dest, pack.password)
+ self.m.core.api.addPackage(p.name, p.urls, pack.password)
if not result:
self.log.info(_("No links decrypted"))
diff --git a/module/threads/DownloadThread.py b/module/threads/DownloadThread.py
index bd15b9b87..6239cddd8 100644
--- a/module/threads/DownloadThread.py
+++ b/module/threads/DownloadThread.py
@@ -64,11 +64,11 @@ class DownloadThread(BaseThread):
self.log.info(_("Download starts: %s" % pyfile.name))
# start download
- self.core.hookManager.downloadPreparing(pyfile)
+ self.core.addonManager.downloadPreparing(pyfile)
pyfile.plugin.preprocessing(self)
self.log.info(_("Download finished: %s") % pyfile.name)
- self.core.hookManager.downloadFinished(pyfile)
+ self.core.addonManager.downloadFinished(pyfile)
self.core.files.checkPackageFinished(pyfile)
except NotImplementedError:
@@ -117,7 +117,7 @@ class DownloadThread(BaseThread):
self.log.warning(_("Download failed: %(name)s | %(msg)s") % {"name": pyfile.name, "msg": msg})
pyfile.error = msg
- self.core.hookManager.downloadFailed(pyfile)
+ self.core.addonManager.downloadFailed(pyfile)
self.clean(pyfile)
continue
@@ -158,7 +158,7 @@ class DownloadThread(BaseThread):
print_exc()
self.writeDebugReport(pyfile.plugin.__name__, pyfile)
- self.core.hookManager.downloadFailed(pyfile)
+ self.core.addonManager.downloadFailed(pyfile)
self.clean(pyfile)
continue
@@ -179,7 +179,7 @@ class DownloadThread(BaseThread):
continue
- except (Exception, BadHeader), e:
+ except Exception, e:
if isinstance(e, BadHeader) and e.code == 500:
pyfile.setStatus("temp. offline")
self.log.warning(_("Download is temporary offline: %s") % pyfile.name)
@@ -194,7 +194,7 @@ class DownloadThread(BaseThread):
print_exc()
self.writeDebugReport(pyfile.plugin.__name__, pyfile)
- self.core.hookManager.downloadFailed(pyfile)
+ self.core.addonManager.downloadFailed(pyfile)
self.clean(pyfile)
continue
diff --git a/module/threads/InfoThread.py b/module/threads/InfoThread.py
index 7db85803a..a8a2c6e7e 100644
--- a/module/threads/InfoThread.py
+++ b/module/threads/InfoThread.py
@@ -4,7 +4,7 @@
from time import time
from traceback import print_exc
-from module.Api import OnlineStatus
+from module.Api import LinkStatus
from module.common.packagetools import parseNames
from module.utils import has_method, accumulate
@@ -100,7 +100,7 @@ class InfoThread(BaseThread):
if len(self.cache) >= 20 or force:
#used for package generating
- tmp = [(name, (url, OnlineStatus(name, plugin, "unknown", status, int(size))))
+ tmp = [(name, (url, LinkStatus(name, plugin, "unknown", status, int(size))))
for name, size, status, url in self.cache]
data = parseNames(tmp)
@@ -161,7 +161,7 @@ class InfoThread(BaseThread):
# only decrypt files
if has_method(klass, "decryptFile"):
- urls = p.decrypt(urls)
+ urls = klass.decrypt(urls)
data, crypter = self.m.core.pluginManager.parseUrls(urls)
return data
diff --git a/module/threads/ThreadManager.py b/module/threads/ThreadManager.py
index f8b5c0aba..b3a1e8c6c 100644
--- a/module/threads/ThreadManager.py
+++ b/module/threads/ThreadManager.py
@@ -47,7 +47,7 @@ class ThreadManager:
self.log = core.log
self.threads = [] # thread list
- self.localThreads = [] #hook+decrypter threads
+ self.localThreads = [] #addon+decrypter threads
self.pause = True
@@ -189,7 +189,7 @@ class ThreadManager:
ip = self.getIP()
- self.core.hookManager.beforeReconnecting(ip)
+ self.core.addonManager.beforeReconnecting(ip)
self.log.debug("Old IP: %s" % ip)
@@ -206,7 +206,7 @@ class ThreadManager:
reconn.wait()
sleep(1)
ip = self.getIP()
- self.core.hookManager.afterReconnecting(ip)
+ self.core.addonManager.afterReconnecting(ip)
self.log.info(_("Reconnected, new IP: %s") % ip)