From 13328322307cde0c9fdd62bfccbcf4a78404164b Mon Sep 17 00:00:00 2001 From: mkaay Date: Tue, 15 Dec 2009 23:09:09 +0100 Subject: incomplete: stable gui O.o, folder fix --- module/download_thread.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/download_thread.py') diff --git a/module/download_thread.py b/module/download_thread.py index 539f3e62f..be7896b5f 100644 --- a/module/download_thread.py +++ b/module/download_thread.py @@ -127,7 +127,7 @@ class Download_Thread(threading.Thread): status.type = "downloading" - local_file = pyfile.download_folder + "/" + status.filename + local_file = pyfile.folder + "/" + status.filename pyfile.plugin.proceed(status.url, local_file) status.type = "checking" -- cgit v1.2.3 From de5a37e0ffc97bc5893077f935429ba32a9b8f6c Mon Sep 17 00:00:00 2001 From: spoob Date: Tue, 15 Dec 2009 23:37:20 +0100 Subject: Incomplete: Rapidshare Folder --- module/download_thread.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'module/download_thread.py') diff --git a/module/download_thread.py b/module/download_thread.py index be7896b5f..3ec49218d 100644 --- a/module/download_thread.py +++ b/module/download_thread.py @@ -19,6 +19,7 @@ ### import threading import traceback +from os.path import join from time import sleep, time from module.network.Request import AbortDownload @@ -122,17 +123,14 @@ class Download_Thread(threading.Thread): pyfile.plugin.prepare(self) pyfile.plugin.req.set_timeout(self.parent.parent.config['general']['max_download_time']) - if status.url == "": - status.url = pyfile.plugin.get_file_url() - status.type = "downloading" - local_file = pyfile.folder + "/" + status.filename - pyfile.plugin.proceed(status.url, local_file) + location = join(pyfile.folder, status.filename) + pyfile.plugin.proceed(status.url, location) status.type = "checking" - check, code = pyfile.plugin.check_file(local_file) + check, code = pyfile.plugin.check_file(location) """ return codes: 0 - checksum ok -- cgit v1.2.3 From 851559594effc57c9cfd4194703f1783fd3fed82 Mon Sep 17 00:00:00 2001 From: spoob Date: Wed, 16 Dec 2009 16:14:34 +0100 Subject: Checksum fixed --- module/download_thread.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/download_thread.py') diff --git a/module/download_thread.py b/module/download_thread.py index 3ec49218d..89a10533a 100644 --- a/module/download_thread.py +++ b/module/download_thread.py @@ -148,7 +148,7 @@ class Download_Thread(threading.Thread): elif code == 10: self.parent.parent.logger.debug("Checksum not implemented for %s" % status.filename) if not check: - raise Checksum(code, local_file) + raise Checksum(code, location) #print "checksum check returned: %s, %s" % (check, code) status.type = "finished" -- cgit v1.2.3 From 9fd8d0c20d4495319b72bd2faa7275c75a7fcacc Mon Sep 17 00:00:00 2001 From: spoob Date: Wed, 16 Dec 2009 22:28:57 +0100 Subject: Fixed Relink.us, Uploaded.to Name Bug --- module/download_thread.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'module/download_thread.py') diff --git a/module/download_thread.py b/module/download_thread.py index 89a10533a..401d6f943 100644 --- a/module/download_thread.py +++ b/module/download_thread.py @@ -140,22 +140,17 @@ class Download_Thread(threading.Thread): 20 - unknown error """ if code == 0: - self.parent.parent.logger.info("Checksum ok ('%s')" % status.filename) + self.parent.parent.logger.info("Checksum ok ('%s')" % status.filename) elif code == 1: - self.parent.parent.logger.info("Checksum not matched! ('%s')" % status.filename) + self.parent.parent.logger.info("Checksum not matched! ('%s')" % status.filename) elif code == 5: - self.parent.parent.logger.debug("Can't get checksum for %s" % status.filename) + self.parent.parent.logger.debug("Can't get checksum for %s" % status.filename) elif code == 10: - self.parent.parent.logger.debug("Checksum not implemented for %s" % status.filename) + self.parent.parent.logger.debug("Checksum not implemented for %s" % status.filename) if not check: - raise Checksum(code, location) - #print "checksum check returned: %s, %s" % (check, code) - - status.type = "finished" + raise Checksum(code, location) - #startet downloader - #urllib.urlretrieve(status.url, pyfile.download_folder + "/" + status.filename, status) - #self.shutdown = True + status.type = "finished" def wait(self, pyfile): pyfile.status.type = "waiting" -- cgit v1.2.3 From 504b313112be6a82d6eee418ae059646ecfc4b30 Mon Sep 17 00:00:00 2001 From: mkaay Date: Sat, 26 Dec 2009 20:18:11 +0100 Subject: fixed ddl-music, cleaned up, new status (starting), some more fixes --- module/download_thread.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/download_thread.py') diff --git a/module/download_thread.py b/module/download_thread.py index 401d6f943..be6ff6bf0 100644 --- a/module/download_thread.py +++ b/module/download_thread.py @@ -117,6 +117,7 @@ class Download_Thread(threading.Thread): def download(self, pyfile): status = pyfile.status + status.type = "starting" pyfile.init_download() -- cgit v1.2.3 From 48588a0d05492e46126776c3e7023397b9ad0b90 Mon Sep 17 00:00:00 2001 From: spoob Date: Sun, 27 Dec 2009 02:40:56 +0100 Subject: Fixed reconnect loop (easy doing) --- module/download_thread.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/download_thread.py') diff --git a/module/download_thread.py b/module/download_thread.py index be6ff6bf0..3d4aa065d 100644 --- a/module/download_thread.py +++ b/module/download_thread.py @@ -77,7 +77,7 @@ class Download_Thread(threading.Thread): self.start() def run(self): - while (not self.shutdown): + while not self.shutdown: self.loadedPyFile = self.parent.get_job() if self.loadedPyFile: try: @@ -165,4 +165,3 @@ class Download_Thread(threading.Thread): sleep(1) pyfile.status.want_reconnect = False return True - -- cgit v1.2.3 From 66c2411b04217a8ae5b9d5698e6d9d66cd997b42 Mon Sep 17 00:00:00 2001 From: mkaay Date: Mon, 28 Dec 2009 22:25:53 +0100 Subject: checksum is now optional --- module/download_thread.py | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'module/download_thread.py') diff --git a/module/download_thread.py b/module/download_thread.py index 3d4aa065d..3c008d000 100644 --- a/module/download_thread.py +++ b/module/download_thread.py @@ -128,28 +128,28 @@ class Download_Thread(threading.Thread): location = join(pyfile.folder, status.filename) pyfile.plugin.proceed(status.url, location) - - status.type = "checking" - check, code = pyfile.plugin.check_file(location) - """ - return codes: - 0 - checksum ok - 1 - checksum wrong - 5 - can't get checksum - 10 - not implemented - 20 - unknown error - """ - if code == 0: - self.parent.parent.logger.info("Checksum ok ('%s')" % status.filename) - elif code == 1: - self.parent.parent.logger.info("Checksum not matched! ('%s')" % status.filename) - elif code == 5: - self.parent.parent.logger.debug("Can't get checksum for %s" % status.filename) - elif code == 10: - self.parent.parent.logger.debug("Checksum not implemented for %s" % status.filename) - if not check: - raise Checksum(code, location) + if self.parent.parent.xmlconfig.get("general", "checksum", True): + status.type = "checking" + check, code = pyfile.plugin.check_file(location) + """ + return codes: + 0 - checksum ok + 1 - checksum wrong + 5 - can't get checksum + 10 - not implemented + 20 - unknown error + """ + if code == 0: + self.parent.parent.logger.info("Checksum ok ('%s')" % status.filename) + elif code == 1: + self.parent.parent.logger.info("Checksum not matched! ('%s')" % status.filename) + elif code == 5: + self.parent.parent.logger.debug("Can't get checksum for %s" % status.filename) + elif code == 10: + self.parent.parent.logger.debug("Checksum not implemented for %s" % status.filename) + if not check: + raise Checksum(code, location) status.type = "finished" -- cgit v1.2.3 From 7c28259f92c2b3c608583ff128a5ae4134d4c48f Mon Sep 17 00:00:00 2001 From: mkaay Date: Wed, 30 Dec 2009 17:33:14 +0100 Subject: moved captcha stuff, extended serienjunkies, some other stuff --- module/download_thread.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'module/download_thread.py') diff --git a/module/download_thread.py b/module/download_thread.py index 3c008d000..a07f4511f 100644 --- a/module/download_thread.py +++ b/module/download_thread.py @@ -66,6 +66,9 @@ class Checksum(Exception): def getFile(self): return self.file +class CaptchaError(Exception): + pass + class Download_Thread(threading.Thread): def __init__(self, parent): threading.Thread.__init__(self) @@ -93,8 +96,10 @@ class Download_Thread(threading.Thread): f = open("%s.info" % e.getFile(), "w") f.write("Checksum not matched!") f.close() + except CaptchaError: + self.loadedPyFile.status.type = "failed" + self.loadedPyFile.status.error = "Can't solve captcha" except Exception, e: - try: if self.parent.parent.config['general']['debug_mode']: traceback.print_exc() @@ -123,8 +128,11 @@ class Download_Thread(threading.Thread): pyfile.plugin.prepare(self) pyfile.plugin.req.set_timeout(self.parent.parent.config['general']['max_download_time']) - - status.type = "downloading" + + if pyfile.plugin.props["type"] == "container": + status.type = "decrypting" + else: + status.type = "downloading" location = join(pyfile.folder, status.filename) pyfile.plugin.proceed(status.url, location) -- cgit v1.2.3 From 4eb1404eca2b795d809ee626a057a543043060cb Mon Sep 17 00:00:00 2001 From: RaNaN Date: Thu, 21 Jan 2010 22:13:21 +0100 Subject: some optimizations --- module/download_thread.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'module/download_thread.py') diff --git a/module/download_thread.py b/module/download_thread.py index a07f4511f..4a031a04c 100644 --- a/module/download_thread.py +++ b/module/download_thread.py @@ -49,7 +49,8 @@ class Status(object): return self.pyfile.plugin.req.dl_size / 1024 def percent(self): if not self.kB_left() == 0 and not self.size() == 0: - return ((self.size()-self.kB_left()) * 100) / self.size() + percent = ((self.size()-self.kB_left()) * 100) / self.size() + return percent if percent < 101 else 0 return 0 class Reconnect(Exception): @@ -115,7 +116,9 @@ class Download_Thread(threading.Thread): self.loadedPyFile.status.error = str(e) finally: self.parent.job_finished(self.loadedPyFile) - sleep(0.5) + else: + sleep(3) + sleep(0.8) if self.shutdown: sleep(1) self.parent.remove_thread(self) -- cgit v1.2.3