diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-10-17 14:03:52 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-10-17 14:03:52 +0200 |
commit | 705d0e5163876c94b9b90a440eb38b152bcba1e0 (patch) | |
tree | c48a726a761e8ffd8e88b62ac5eae598984d985a /module | |
parent | hotfile (diff) | |
download | pyload-705d0e5163876c94b9b90a440eb38b152bcba1e0.tar.xz |
rs fix, more cleanup stuff
Diffstat (limited to 'module')
-rw-r--r-- | module/FileDatabase.py | 7 | ||||
-rw-r--r-- | module/PluginThread.py | 6 | ||||
-rw-r--r-- | module/RequestFactory.py | 12 | ||||
-rwxr-xr-x | module/network/Request.py | 5 | ||||
-rw-r--r-- | module/plugins/hoster/RapidshareCom.py | 2 |
5 files changed, 24 insertions, 8 deletions
diff --git a/module/FileDatabase.py b/module/FileDatabase.py index 1ac83cd21..cdb939529 100644 --- a/module/FileDatabase.py +++ b/module/FileDatabase.py @@ -957,7 +957,7 @@ class PyFile(): def __repr__(self): return "PyFile %s: %s@%s" % (self.id, self.name, self.pluginname) - + def initPlugin(self): """ inits plugin instance """ if not self.plugin: @@ -1029,8 +1029,9 @@ class PyFile(): if self.plugin and self.plugin.req: self.plugin.req.abort = True sleep(0.1) - self.abort = False - if self.plugin and self.plugin.req: self.plugin.req.abort = False + self.abort = False + if hasattr(self, "plugin") and self.plugin and self.plugin.req: self.plugin.req.abort = False + self.release() def finishIfDone(self): """set status to finish and release file if every thread is finished with it""" diff --git a/module/PluginThread.py b/module/PluginThread.py index d3801788e..572561eb0 100644 --- a/module/PluginThread.py +++ b/module/PluginThread.py @@ -25,7 +25,7 @@ from time import time from time import strftime from traceback import print_exc, format_exc from pprint import pformat -from sys import exc_info +from sys import exc_info, exc_clear from types import MethodType from os.path import join, exists @@ -124,8 +124,10 @@ class DownloadThread(PluginThread): #---------------------------------------------------------------------- def run(self): """run method""" + pyfile = None while True: + del pyfile self.active = self.queue.get() pyfile = self.active @@ -264,6 +266,7 @@ class DownloadThread(PluginThread): finally: self.m.core.files.save() + exc_clear() self.m.log.info(_("Download finished: %s") % pyfile.name) @@ -360,6 +363,7 @@ class DecrypterThread(PluginThread): self.active = False self.m.core.files.save() self.m.localThreads.remove(self) + exc_clear() #self.m.core.hookManager.downloadFinished(pyfile) diff --git a/module/RequestFactory.py b/module/RequestFactory.py index 260a4a1d5..9f93836f4 100644 --- a/module/RequestFactory.py +++ b/module/RequestFactory.py @@ -27,7 +27,7 @@ class RequestFactory(): def __init__(self, core): self.lock = Lock() self.core = core - self.requests = [] + self.requests = [] #seems useless self.cookiejars = [] self.iface = self.core.config["general"]["download_interface"] @@ -47,10 +47,10 @@ class RequestFactory(): elif type == "FTP": req = FtpRequest() - self.requests.append((pluginName, account, req)) + #self.requests.append((pluginName, account, req)) self.lock.release() return req - + def clean(self): self.lock.acquire() for req in self.requests: @@ -70,6 +70,12 @@ class CookieJar(): self.cookies = {} self.plugin = plugin self.account = account + + def __del__(self): + if hasattr(self, "cookies"): + del self.cookies + if hasattr(self, "plugin"): + del self.plugin def addCookies(self, clist): for c in clist: diff --git a/module/network/Request.py b/module/network/Request.py index 14c9f0a7a..31a5a7288 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -395,10 +395,15 @@ class Request: self.clean() if hasattr(self, "pycurl"): del self.pycurl + if hasattr(self, "cookieJar"): + del self.cookieJar def clean(self): + """ clean Reqest, its unusable after this """ try: self.pycurl.close() + if hasattr(self, "cookieJar"): + del self.cookieJar except: pass diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py index 2e6ada837..e449cbc9a 100644 --- a/module/plugins/hoster/RapidshareCom.py +++ b/module/plugins/hoster/RapidshareCom.py @@ -197,7 +197,7 @@ class RapidshareCom(Hoster): self.setWait(60) self.log.info(_("Already downloading from this ip address, waiting 60 seconds")) self.wait() - elif "Too many users downloading from this server right now" in result: + elif "Too many users downloading from this server right now" in result or "All free download slots are full" in result: self.setWait(120) self.log.info(_("RapidShareCom: No free slots")) self.wait() |