diff options
-rw-r--r-- | module/download_thread.py | 36 | ||||
-rw-r--r-- | module/plugins/RapidshareCom.py | 2 | ||||
-rw-r--r-- | module/plugins/UploadedTo.py | 2 | ||||
-rwxr-xr-x | pyLoadCli.py | 2 |
4 files changed, 34 insertions, 8 deletions
diff --git a/module/download_thread.py b/module/download_thread.py index 9c7fe1a42..ff9c25766 100644 --- a/module/download_thread.py +++ b/module/download_thread.py @@ -53,6 +53,17 @@ class Status(object): class Reconnect(Exception): pass +class Checksum(Exception): + def __init__(self, code, local_file): + self.code = code + self.file = local_file + + def getCode(self): + return self.code + + def getFile(self): + return self.file + class Download_Thread(threading.Thread): def __init__(self, parent): threading.Thread.__init__(self) @@ -74,19 +85,24 @@ class Download_Thread(threading.Thread): self.loadedPyFile.status.type = "aborted" except Reconnect: pass + except Checksum, e: + self.loadedPyFile.status.type = "failed" + self.loadedPyFile.status.error = "Checksum error: %d" % e.getCode() + with open("%s.info" % e.getFile(), "w") as f: + f.write("Checksum not matched!") except Exception, e: try: + if self.parent.parent.config['general']['debug_mode']: + traceback.print_exc() code, msg = e if code == 7: sleep(60) self.parent.parent.logger.info("Hoster unvailable, wait 60 seconds") except Exception, f: self.parent.parent.logger.debug("Error getting error code: "+ str(f)) - - - if self.parent.parent.config['general']['debug_mode']: - traceback.print_exc() + if self.parent.parent.config['general']['debug_mode']: + traceback.print_exc() self.loadedPyFile.status.type = "failed" self.loadedPyFile.status.error = str(e) finally: @@ -100,7 +116,7 @@ class Download_Thread(threading.Thread): status = pyfile.status pyfile.init_download() - + pyfile.plugin.prepare(self) if status.url == "": @@ -122,6 +138,16 @@ class Download_Thread(threading.Thread): 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, local_file) #print "checksum check returned: %s, %s" % (check, code) status.type = "finished" diff --git a/module/plugins/RapidshareCom.py b/module/plugins/RapidshareCom.py index 53e47b518..67db37245 100644 --- a/module/plugins/RapidshareCom.py +++ b/module/plugins/RapidshareCom.py @@ -135,7 +135,7 @@ class RapidshareCom(Plugin): self.time_plus_wait = time() + 60 * int(wait_minutes) self.want_reconnect = True except: - if re.search(r"Currently a lot of users", self.html[1], re.I) != None: + if re.search(r"(Currently a lot of users|There are no more download slots)", self.html[1], re.I) != None: self.time_plus_wait = time() + 130 return True wait_seconds = re.search(r"var c=(.*);.*", self.html[1]).group(1) diff --git a/module/plugins/UploadedTo.py b/module/plugins/UploadedTo.py index bf5582d7c..89ad9e4e8 100644 --- a/module/plugins/UploadedTo.py +++ b/module/plugins/UploadedTo.py @@ -88,7 +88,7 @@ class UploadedTo(Plugin): if not src.find("404 Not Found"): return self.api_data = {} - lines = src.split("\r\n") + lines = src.splitlines() self.api_data["filename"] = lines[0] self.api_data["size"] = lines[1] # in kbytes self.api_data["checksum"] = lines[2] #sha1 diff --git a/pyLoadCli.py b/pyLoadCli.py index 11158cb7b..3294e8fc9 100755 --- a/pyLoadCli.py +++ b/pyLoadCli.py @@ -185,7 +185,7 @@ class pyLoadCli: self.print_input() def handle_input(self): - inp = self.input + inp = self.input.strip() if inp == "0": self.pos = [0, 0] self.build_menu() |