diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-10-27 01:18:45 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-10-27 01:18:45 +0100 |
commit | 146fe1e309c33ab149bfaf58ad86c0dd4fb9b156 (patch) | |
tree | 22bf2ace19d926392dbe7ba48e44c13c63cd368a /module | |
parent | [SimpleHoster] Direct download link support (diff) | |
download | pyload-146fe1e309c33ab149bfaf58ad86c0dd4fb9b156.tar.xz |
Spare code cosmetics
Diffstat (limited to 'module')
41 files changed, 73 insertions, 75 deletions
diff --git a/module/plugins/Hook.py b/module/plugins/Hook.py index 4d43b70f7..5710aae84 100644 --- a/module/plugins/Hook.py +++ b/module/plugins/Hook.py @@ -91,7 +91,7 @@ class Hook(Base): try: if self.isActivated(): self.periodical() except Exception, e: - self.core.log.error(_("Error executing hooks: %s") % str(e)) + self.core.log.error(_("Error executing hooks: ") + str(e)) if self.core.debug: print_exc() diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 279edff4d..18f51aab7 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -422,7 +422,7 @@ class Plugin(Base): self.fail(_("No captcha result obtained in appropiate time by any of the plugins")) result = task.result - self.logDebug("Received captcha result: %s" % str(result)) + self.logDebug("Received captcha result: " + str(result)) if not self.core.debug: try: @@ -530,7 +530,7 @@ class Plugin(Base): chown(location, uid, gid) except Exception, e: - self.logWarning(_("Setting User and Group failed: %s") % str(e)) + self.logWarning(_("Setting User and Group failed: ") + str(e)) # convert back to unicode location = fs_decode(location) @@ -564,7 +564,7 @@ class Plugin(Base): chown(fs_filename, uid, gid) except Exception, e: - self.logWarning(_("Setting User and Group failed: %s") % str(e)) + self.logWarning(_("Setting User and Group failed: ") + str(e)) self.lastDownload = filename return self.lastDownload diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py index 15e25a7dd..cbe6b9654 100644 --- a/module/plugins/accounts/HellshareCz.py +++ b/module/plugins/accounts/HellshareCz.py @@ -44,7 +44,7 @@ class HellshareCz(Account): trafficleft = int(credit) * 1024 validuntil = -1 except Exception, e: - self.logError(_("Unable to parse credit info"), repr(e)) + self.logError(_("Unable to parse credit info"), str(e)) validuntil = -1 trafficleft = -1 diff --git a/module/plugins/accounts/MegaRapidCz.py b/module/plugins/accounts/MegaRapidCz.py index 04abf8c8a..c458210f8 100644 --- a/module/plugins/accounts/MegaRapidCz.py +++ b/module/plugins/accounts/MegaRapidCz.py @@ -18,7 +18,7 @@ class MegaRapidCz(Account): login_timeout = 60 - + LIMITDL_PATTERN = ur'<td>Max. počet paralelních stahování: </td><td>(\d+)' VALID_UNTIL_PATTERN = ur'<td>Paušální stahování aktivní. Vyprší </td><td><strong>(.*?)</strong>' TRAFFIC_LEFT_PATTERN = r'<tr><td>Kredit</td><td>(.*?) GiB' diff --git a/module/plugins/accounts/QuickshareCz.py b/module/plugins/accounts/QuickshareCz.py index f8ba3e7ff..e01058644 100644 --- a/module/plugins/accounts/QuickshareCz.py +++ b/module/plugins/accounts/QuickshareCz.py @@ -16,8 +16,8 @@ class QuickshareCz(Account): TRAFFIC_LEFT_PATTERN = r'Stav kreditu: <strong>(.+?)</strong>' - - + + def loadAccountInfo(self, user, req): html = req.load("http://www.quickshare.cz/premium", decode=True) diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index 55017eb30..8a4e14665 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -31,11 +31,10 @@ class UploadedTo(Account): if raw_valid == "unlimited": validuntil = -1 else: - raw_valid = re.findall(r"(\d+) (Week|weeks|days|day|hours|hour)", raw_valid) + raw_valid = re.findall(r"(\d+) (Week|weeks|day|hour)", raw_valid) validuntil = time() for n, u in raw_valid: - validuntil += int(n) * 60 * 60 * {"Week": 168, "weeks": 168, "days": 24, - "day": 24, "hours": 1, "hour": 1}[u] + validuntil += int(n) * 60 * 60 * {"Week": 168, "weeks": 168, "day": 24, "hour": 1}[u] return {"validuntil": validuntil, "trafficleft": traffic, "maxtraffic": 50 * 1024 * 1024} else: diff --git a/module/plugins/container/LinkList.py b/module/plugins/container/LinkList.py index af52b90f2..2b3f313f8 100644 --- a/module/plugins/container/LinkList.py +++ b/module/plugins/container/LinkList.py @@ -26,9 +26,6 @@ class LinkList(Container): except: file_enc = "utf-8" - print repr(pyfile.url) - print pyfile.url - file_name = fs_encode(pyfile.url) txt = codecs.open(file_name, 'r', file_enc) diff --git a/module/plugins/crypter/EmbeduploadCom.py b/module/plugins/crypter/EmbeduploadCom.py index 6af3194df..b968bb86d 100644 --- a/module/plugins/crypter/EmbeduploadCom.py +++ b/module/plugins/crypter/EmbeduploadCom.py @@ -30,14 +30,18 @@ class EmbeduploadCom(Crypter): if m: prefered_set = set(self.getConfig("preferedHoster").split('|')) prefered_set = map(lambda s: s.lower().split('.')[0], prefered_set) - print "PF", prefered_set + + self.logDebug("PF: %s" % prefered_set) + tmp_links.extend([x[1] for x in m if x[0] in prefered_set]) self.urls = self.getLocation(tmp_links) if not self.urls: ignored_set = set(self.getConfig("ignoredHoster").split('|')) ignored_set = map(lambda s: s.lower().split('.')[0], ignored_set) - print "IG", ignored_set + + self.logDebug("IG: %s" % ignored_set) + tmp_links.extend([x[1] for x in m if x[0] not in ignored_set]) self.urls = self.getLocation(tmp_links) diff --git a/module/plugins/hooks/BypassCaptcha.py b/module/plugins/hooks/BypassCaptcha.py index ef7ba01c3..d4c41b02a 100644 --- a/module/plugins/hooks/BypassCaptcha.py +++ b/module/plugins/hooks/BypassCaptcha.py @@ -92,7 +92,7 @@ class BypassCaptcha(Hook): response = getURL(self.RESPOND_URL, post={"task_id": ticket, "key": self.getConfig("passkey"), "cv": 1 if success else 0}) except BadHeader, e: - self.logError(_("Could not send response"), repr(e)) + self.logError(_("Could not send response"), str(e)) def newCaptchaTask(self, task): diff --git a/module/plugins/hooks/Captcha9kw.py b/module/plugins/hooks/Captcha9kw.py index 7bbfa2e73..eb6313bc0 100755 --- a/module/plugins/hooks/Captcha9kw.py +++ b/module/plugins/hooks/Captcha9kw.py @@ -137,7 +137,7 @@ class Captcha9kw(Hook): self.logInfo(_("Request correct"), response) except BadHeader, e: - self.logError(_("Could not send correct request"), repr(e)) + self.logError(_("Could not send correct request"), str(e)) else: self.logError(_("No CaptchaID for correct request (task %s) found") % task) @@ -157,6 +157,6 @@ class Captcha9kw(Hook): self.logInfo(_("Request refund"), response) except BadHeader, e: - self.logError(_("Could not send refund request"), repr(e)) + self.logError(_("Could not send refund request"), str(e)) else: self.logError(_("No CaptchaID for not correct request (task %s) found") % task) diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index f1d949544..d112b3a35 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -96,4 +96,4 @@ class ExpertDecoders(Hook): self.logInfo(_("Request refund"), response) except BadHeader, e: - self.logError(_("Could not send refund request"), repr(e)) + self.logError(_("Could not send refund request"), str(e)) diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 8164b3157..4a4f2d4d8 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -98,12 +98,12 @@ class ExtractArchive(Hook): if e.errno == 2: self.logInfo(_("No %s installed") % p) else: - self.logWarning(_("Could not activate %s") % p, repr(e)) + self.logWarning(_("Could not activate %s") % p, str(e)) if self.core.debug: print_exc() except Exception, e: - self.logWarning(_("Could not activate %s") % p, repr(e)) + self.logWarning(_("Could not activate %s") % p, str(e)) if self.core.debug: print_exc() @@ -202,7 +202,7 @@ class ExtractArchive(Hook): password = p.password.strip().splitlines() new_files = self._extract(klass, fid, password, thread) except Exception, e: - self.logError(basename(target), repr(e)) + self.logError(basename(target), str(e)) success = False continue @@ -289,13 +289,13 @@ class ExtractArchive(Hook): return extracted_files except ArchiveError, e: - self.logError(basename(plugin.file), _("Archive Error"), repr(e)) + self.logError(basename(plugin.file), _("Archive Error"), str(e)) except CRCError: self.logError(basename(plugin.file), _("CRC Mismatch")) except Exception, e: if self.core.debug: print_exc() - self.logError(basename(plugin.file), _("Unknown Error"), repr(e)) + self.logError(basename(plugin.file), _("Unknown Error"), str(e)) self.manager.dispatchEvent("archive_extract_failed", pyfile) raise Exception(_("Extract failed")) @@ -352,4 +352,4 @@ class ExtractArchive(Hook): gid = getgrnam(self.config['permission']['group'])[2] chown(f, uid, gid) except Exception, e: - self.logWarning(_("Setting User and Group failed"), repr(e)) + self.logWarning(_("Setting User and Group failed"), str(e)) diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py index 9a23951cf..061714757 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRCInterface.py @@ -184,7 +184,7 @@ class IRCInterface(Thread, Hook): for line in res: self.response(line, msg['origin']) except Exception, e: - self.logError(repr(e)) + self.logError(str(e)) def response(self, msg, origin=""): diff --git a/module/plugins/hooks/MergeFiles.py b/module/plugins/hooks/MergeFiles.py index 0eab0037c..7562df2a8 100644 --- a/module/plugins/hooks/MergeFiles.py +++ b/module/plugins/hooks/MergeFiles.py @@ -2,7 +2,8 @@ import os import re -import traceback + +from traceback import print_exc from module.plugins.Hook import Hook, threaded from module.utils import save_join, fs_encode @@ -68,7 +69,7 @@ class MergeFiles(Hook): s_file.close() self.logDebug("Finished merging part", splitted_file) except Exception, e: - print traceback.print_exc() + print_exc() finally: pyfile.setProgress(100) pyfile.setStatus("finished") diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index 1bddbf967..d5fb43ddc 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -218,7 +218,7 @@ class UpdateManager(Hook): else: raise Exception, _("Version mismatch") except Exception, e: - self.logError(_("Error updating plugin %s") % filename, repr(e)) + self.logError(_("Error updating plugin %s") % filename, str(e)) if blacklist: blacklisted = sorted(map(lambda x: (x.split('|')[0], x.split('|')[1].rsplit('.', 1)[0]), blacklist)) @@ -273,7 +273,7 @@ class UpdateManager(Hook): try: remove(filename) except Exception, e: - self.logDebug("Error deleting", path.basename(filename), repr(e)) + self.logDebug("Error deleting", path.basename(filename), str(e)) err = True filename += "c" @@ -283,7 +283,7 @@ class UpdateManager(Hook): self.manager.deactivateHook(name) remove(filename) except Exception, e: - self.logDebug("Error deleting", path.basename(filename), repr(e)) + self.logDebug("Error deleting", path.basename(filename), str(e)) err = True if not err: diff --git a/module/plugins/hooks/XMPPInterface.py b/module/plugins/hooks/XMPPInterface.py index c4d6e1b66..8a4e0e9d9 100644 --- a/module/plugins/hooks/XMPPInterface.py +++ b/module/plugins/hooks/XMPPInterface.py @@ -169,7 +169,7 @@ class XMPPInterface(IRCInterface, JabberClient): messages.append(m) except Exception, e: - self.logError(repr(e)) + self.logError(str(e)) return messages diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py index c5dd9b707..734c6b583 100644 --- a/module/plugins/hoster/AlldebridCom.py +++ b/module/plugins/hoster/AlldebridCom.py @@ -84,6 +84,6 @@ class AlldebridCom(Hoster): 'empty': re.compile(r"^$")}) if check == "error": - self.retry(wait_time=60, reason="An error occured while generating link") + self.retry(wait_time=60, reason=_("An error occured while generating link")) elif check == "empty": - self.retry(wait_time=60, reason="Downloaded File was empty") + self.retry(wait_time=60, reason=_("Downloaded File was empty")) diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index e5cf69914..fdbf0464a 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -58,7 +58,7 @@ class CatShareNet(SimpleHoster): m = re.search(self.LINK_PATTERN, self.html) if m is None: self.invalidCaptcha() - self.retry(reason="Wrong captcha entered") + self.retry(reason=_("Wrong captcha entered")) dl_link = m.group(1) self.download(dl_link, disposition=True) diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 5396a7826..91c3877f8 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -58,7 +58,7 @@ class CzshareCom(SimpleHoster): return False except Exception, e: # let's continue and see what happens... - self.logError(repr(e)) + self.logError(str(e)) return True @@ -69,7 +69,7 @@ class CzshareCom(SimpleHoster): form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.S).group(1) inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) except Exception, e: - self.logError(repr(e)) + self.logError(str(e)) self.resetAccount() # download the file, destination is determined by pyLoad diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index 3fad62693..efe9327b9 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -35,7 +35,7 @@ class EuroshareEu(SimpleHoster): def handlePremium(self): if self.ERR_NOT_LOGGED_IN_PATTERN in self.html: self.account.relogin(self.user) - self.retry(reason="User not logged in") + self.retry(reason=_("User not logged in")) self.download(self.pyfile.url.rstrip('/') + "/download/") @@ -43,7 +43,7 @@ class EuroshareEu(SimpleHoster): "json": re.compile(r'\{"status":"error".*?"message":"(.*?)"')}) if check == "login" or (check == "json" and self.lastCheck.group(1) == "Access token expired"): self.account.relogin(self.user) - self.retry(reason="Access token expired") + self.retry(reason=_("Access token expired")) elif check == "json": self.fail(self.lastCheck.group(1)) diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index cb6c44eb7..eddcd2fe6 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -68,6 +68,6 @@ class FastixRu(Hoster): "empty": re.compile(r"^$")}) if check == "error": - self.retry(wait_time=60, reason="An error occurred while generating link") + self.retry(wait_time=60, reason=_("An error occurred while generating link")) elif check == "empty": - self.retry(wait_time=60, reason="Downloaded File was empty") + self.retry(wait_time=60, reason=_("Downloaded File was empty")) diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index a07f741fa..f15d95ad5 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -58,7 +58,7 @@ class FastshareCz(SimpleHoster): if check == "paralell_dl": self.retry(6, 10 * 60, "Paralell download") elif check == "wrong_captcha": - self.retry(max_tries=5, reason="Wrong captcha") + self.retry(max_tries=5, reason=_("Wrong captcha")) def handlePremium(self): diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py index 8f314f059..4cb816724 100644 --- a/module/plugins/hoster/FileSharkPl.py +++ b/module/plugins/hoster/FileSharkPl.py @@ -92,13 +92,13 @@ class FileSharkPl(SimpleHoster): action, inputs = self.parseHtmlForm('action=""') m = re.search(self.CAPTCHA_TOKEN_PATTERN, self.html) if m is None: - self.retry(reason="Captcha form not found") + self.retry(reason=_("Captcha form not found")) inputs['form[_token]'] = m.group(1) m = re.search(self.CAPTCHA_IMG_PATTERN, self.html) if m is None: - self.retry(reason="Captcha image not found") + self.retry(reason=_("Captcha image not found")) tmp_load = self.load self.load = self.decode64 #: injects decode64 inside decryptCaptcha @@ -124,7 +124,7 @@ class FileSharkPl(SimpleHoster): elif check == "wrong_captcha": self.invalidCaptcha() - self.retry(10, 1, reason="Wrong captcha solution") + self.retry(10, 1, reason=_("Wrong captcha solution")) elif check == "wait_pattern": self.retry() diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index 068724488..c2d18160a 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -66,7 +66,7 @@ class FilefactoryCom(SimpleHoster): if check == "multiple": self.logDebug("Parallel downloads detected; waiting 15 minutes") - self.retry(wait_time=15 * 60, reason="Parallel downloads") + self.retry(wait_time=15 * 60, reason=_("Parallel downloads")) elif check == "error": self.error(_("Unknown error")) diff --git a/module/plugins/hoster/FilerNet.py b/module/plugins/hoster/FilerNet.py index 9a34f8872..30df70a82 100644 --- a/module/plugins/hoster/FilerNet.py +++ b/module/plugins/hoster/FilerNet.py @@ -35,7 +35,7 @@ class FilerNet(SimpleHoster): # Wait between downloads m = re.search(r'musst du <span id="time">(\d+)</span> Sekunden warten', self.html) if m: - self.retry(wait_time=int(m.group(1)), reason="Wait between free downloads") + self.retry(wait_time=int(m.group(1)), reason=_("Wait between free downloads")) self.html = self.load(self.pyfile.url, decode=True) diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 9fded2dd8..d11f631c2 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -92,7 +92,7 @@ class FileserveCom(Hoster): elif action['fail'] == "parallelDownload": self.logWarning(_("Parallel download error, now waiting 60s")) - self.retry(wait_time=60, reason="parallelDownload") + self.retry(wait_time=60, reason=_("parallelDownload")) else: self.fail(_("Download check returned: %s") % action['fail']) diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index 529b107d3..35c7aa253 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -172,9 +172,6 @@ class FreakshareCom(Hoster): to_sort = re.findall(r"<input\stype=\".*?\"\svalue=\"(\S*?)\".*?name=\"(\S*?)\"\s.*?\/>", herewego) request_options = dict((n, v) for (v, n) in to_sort) - # comment this in, when it doesnt work as well - #print "\n\n%s\n\n" % ";".join(["%s=%s" % x for x in to_sort]) - challenge = re.search(r"http://api\.recaptcha\.net/challenge\?k=(\w+)", herewego) if challenge: diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index 512f55686..b7d4632b6 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -67,7 +67,7 @@ class LinksnappyCom(Hoster): check = self.checkDownload({"html302": "<title>302 Found</title>"}) if check == "html302": - self.retry(wait_time=5, reason="Linksnappy returns only HTML data") + self.retry(wait_time=5, reason=_("Linksnappy returns only HTML data")) @staticmethod diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py index 8ae56458b..4917bebfb 100644 --- a/module/plugins/hoster/LuckyShareNet.py +++ b/module/plugins/hoster/LuckyShareNet.py @@ -35,7 +35,7 @@ class LuckyShareNet(SimpleHoster): else: self.error(_("Unable to detect wait time between free downloads")) elif 'Hash expired' in rep: - self.retry(reason="Hash expired") + self.retry(reason=_("Hash expired")) return json_loads(rep) diff --git a/module/plugins/hoster/MegaRapidCz.py b/module/plugins/hoster/MegaRapidCz.py index 61c3ab425..629d42109 100644 --- a/module/plugins/hoster/MegaRapidCz.py +++ b/module/plugins/hoster/MegaRapidCz.py @@ -64,7 +64,7 @@ class MegaRapidCz(SimpleHoster): else: if re.search(self.ERR_LOGIN_PATTERN, self.html): self.relogin(self.user) - self.retry(wait_time=60, reason="User login failed") + self.retry(wait_time=60, reason=_("User login failed")) elif re.search(self.ERR_CREDIT_PATTERN, self.html): self.fail(_("Not enough credit left")) else: diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 9f21ce868..3d575b588 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -78,7 +78,7 @@ class MegasharesCom(SimpleHoster): time = [int(x) for x in m.groups()] renew = time[0] + (time[1] * 60) + (time[2] * 60) self.logDebug("Waiting %d seconds for a new passport" % renew) - self.retry(wait_time=renew, reason="Passport renewal") + self.retry(wait_time=renew, reason=_("Passport renewal")) # Check traffic left on passport m = re.search(self.PASSPORT_LEFT_PATTERN, self.html, re.M | re.S) @@ -90,7 +90,7 @@ class MegasharesCom(SimpleHoster): self.logInfo(_("Data left: %s %s (%d MB needed)") % (m.group(2), m.group(3), self.pyfile.size / 1048576)) if not data_left: - self.retry(wait_time=600, reason="Passport renewal") + self.retry(wait_time=600, reason=_("Passport renewal")) self.handleDownload(False) diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 2d4773bac..2f0c6e2a8 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -26,10 +26,11 @@ def getInfo(urls): api = getURL(apiurl + ids, decode=True) if api is None or len(api) < 10: - print "Netload prefetch: failed " + self.logDebug("Prefetch failed") return if api.find("unknown_auth") >= 0: - print "Netload prefetch: Outdated auth code " + print + self.logDebug("Outdated auth code") return result = [] @@ -43,8 +44,7 @@ def getInfo(urls): size = 0 result.append((tmp[1], size, 2 if tmp[3] == "online" else 1, chunk[i])) except: - print "Netload prefetch: Error while processing response: " - print r + self.logDebug("Error while processing response: %s" % r) yield result diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index 57c35e1ac..345d130c1 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -140,6 +140,6 @@ class OboomCom(Hoster): self.downloadDomain = result[1] self.downloadTicket = result[2] elif result[0] == 421: - self.retry(wait_time=result[2] + 60, reason="Connection limit exceeded") + self.retry(wait_time=result[2] + 60, reason=_("Connection limit exceeded")) else: self.fail(_("Could not retrieve download ticket. Error code: %s") % result[0]) diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py index 6ebfbfdbe..436e3b65a 100644 --- a/module/plugins/hoster/OverLoadMe.py +++ b/module/plugins/hoster/OverLoadMe.py @@ -81,4 +81,4 @@ class OverLoadMe(Hoster): if check == "error": # usual this download can safely be retried - self.retry(reason="An error occured while generating link.", wait_time=60) + self.retry(reason=_("An error occured while generating link."), wait_time=60) diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index 8db84340b..591537ae4 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -67,7 +67,7 @@ class RapidgatorNet(SimpleHoster): status = json['response_status'] msg = json['response_details'] except BadHeader, e: - self.logError("API: %s" % cmd, repr(e), "SID: %s" % self.sid) + self.logError("API: %s" % cmd, str(e), "SID: %s" % self.sid) status = e.code msg = e diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py index dd4101402..161eb18df 100644 --- a/module/plugins/hoster/RealdebridCom.py +++ b/module/plugins/hoster/RealdebridCom.py @@ -90,4 +90,4 @@ class RealdebridCom(Hoster): if check == "error": #usual this download can safely be retried - self.retry(wait_time=60, reason="An error occured while generating link") + self.retry(wait_time=60, reason=_("An error occured while generating link")) diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index 43398772c..487a89d2c 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -147,7 +147,7 @@ class UlozTo(SimpleHoster): #self.delStorage("captcha_id") #self.delStorage("captcha_text") self.invalidCaptcha() - self.retry(reason="Wrong captcha code") + self.retry(reason=_("Wrong captcha code")) elif check == "offline": self.offline() elif check == "passwd": diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index e6ec0eb12..8a4af51b4 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -139,6 +139,7 @@ class UploadedTo(Hoster): pyfile.name, pyfile.size = name, size else: self.error(_("file info")) + elif api == 'Access denied': self.fail(_("API key invalid")) @@ -171,9 +172,9 @@ class UploadedTo(Hoster): self.fail(_("Traffic exceeded")) header = self.load("http://uploaded.net/file/%s" % self.fileID, just_header=True) - if "location" in header: + if 'location' in header: #Direct download - print "Direct Download: " + header['location'] + self.logDebug("Direct download link detected") self.download(header['location']) else: #Indirect download @@ -182,7 +183,6 @@ class UploadedTo(Hoster): if m is None: self.fail(_("Download URL not m. Try to enable direct downloads")) url = m.group(1) - print "Premium URL: " + url self.download(url, post={}) diff --git a/module/plugins/hoster/VeehdCom.py b/module/plugins/hoster/VeehdCom.py index ad99793e4..921a9c205 100644 --- a/module/plugins/hoster/VeehdCom.py +++ b/module/plugins/hoster/VeehdCom.py @@ -35,7 +35,7 @@ class VeehdCom(Hoster): def download_html(self): url = self.pyfile.url - self.logDebug("Requesting page: %s" % repr(url)) + self.logDebug("Requesting page: %s" % url) self.html = self.load(url) diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 31102b6fa..f6783cffb 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -91,8 +91,8 @@ class SimpleCrypter(Crypter): if isinstance(self.COOKIES, list): set_cookies(self.req.cj, self.COOKIES) - url = self.pyfile.url = replace_patterns(self.pyfile.url, self.URL_REPLACEMENTS) - self.html = getURL(url, decode=not self.TEXT_ENCODING, cookies=bool(self.COOKIES)) + self.pyfile.url = replace_patterns(self.pyfile.url, self.URL_REPLACEMENTS) + self.html = getURL(self.pyfile.url, decode=not self.TEXT_ENCODING, cookies=bool(self.COOKIES)) def decrypt(self, pyfile): diff --git a/module/plugins/internal/XFSPHoster.py b/module/plugins/internal/XFSPHoster.py index edbe8a0a2..44b2006ae 100644 --- a/module/plugins/internal/XFSPHoster.py +++ b/module/plugins/internal/XFSPHoster.py @@ -201,9 +201,9 @@ class XFSPHoster(SimpleHoster): header = self.load(self.pyfile.url, just_header=True) if 'location' in header: # Direct link - self.startDownload(self.pyfile.url) + self.startDownload(header['location']) else: - self.retry(reason="OVR link location not found") + self.retry(reason=_("OVR link location not found")) def startDownload(self, link): @@ -232,7 +232,7 @@ class XFSPHoster(SimpleHoster): self.wantReconnect = True self.retry(25, 1 * 60 * 60, "Download limit exceeded") elif 'countdown' in self.errmsg or 'Expired' in self.errmsg: - self.retry(reason="Link expired") + self.retry(reason=_("Link expired")) elif 'maintenance' in self.errmsg or 'maintainance' in self.errmsg: self.tempOffline() elif 'download files up to' in self.errmsg: |