From 9f2ebe486a3e155fb6a60e07cccb77ab6a772eb2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 26 Oct 2014 02:31:54 +0200 Subject: Extend translation support in plugins + a lot of code cosmetics and typo fixes --- module/plugins/hoster/AlldebridCom.py | 6 +++--- module/plugins/hoster/BasePlugin.py | 2 +- module/plugins/hoster/BayfilesCom.py | 8 +++---- module/plugins/hoster/BezvadataCz.py | 10 ++++----- module/plugins/hoster/BitshareCom.py | 2 +- module/plugins/hoster/CatShareNet.py | 2 +- module/plugins/hoster/CrockoCom.py | 6 +++--- module/plugins/hoster/CzshareCom.py | 20 +++++++++--------- module/plugins/hoster/DailymotionCom.py | 2 +- module/plugins/hoster/DataHu.py | 2 +- module/plugins/hoster/DataportCz.py | 6 +++--- module/plugins/hoster/DateiTo.py | 4 ++-- module/plugins/hoster/DebridItaliaCom.py | 4 ++-- module/plugins/hoster/DepositfilesCom.py | 16 +++++++------- module/plugins/hoster/DevhostSt.py | 4 ++-- module/plugins/hoster/DlFreeFr.py | 6 +++--- module/plugins/hoster/DropboxCom.py | 2 +- module/plugins/hoster/EdiskCz.py | 4 ++-- module/plugins/hoster/EuroshareEu.py | 2 +- module/plugins/hoster/ExtabitCom.py | 12 +++++------ module/plugins/hoster/FastixRu.py | 6 +++--- module/plugins/hoster/FastshareCz.py | 6 +++--- module/plugins/hoster/File4safeCom.py | 2 +- module/plugins/hoster/FileSharkPl.py | 6 +++--- module/plugins/hoster/FilecloudIo.py | 12 +++++------ module/plugins/hoster/FilefactoryCom.py | 8 +++---- module/plugins/hoster/FilepostCom.py | 15 ++++++------- module/plugins/hoster/FilepupNet.py | 4 ++-- module/plugins/hoster/FilerNet.py | 8 +++---- module/plugins/hoster/FileserveCom.py | 18 ++++++++-------- module/plugins/hoster/FlyFilesNet.py | 2 +- module/plugins/hoster/FourSharedCom.py | 4 ++-- module/plugins/hoster/FreakshareCom.py | 4 ++-- module/plugins/hoster/FreeWayMe.py | 2 +- module/plugins/hoster/FshareVn.py | 12 +++++------ module/plugins/hoster/Ftp.py | 4 ++-- module/plugins/hoster/GamefrontCom.py | 2 +- module/plugins/hoster/GigapetaCom.py | 2 +- module/plugins/hoster/HellshareCz.py | 6 +++--- module/plugins/hoster/IfileIt.py | 4 ++-- module/plugins/hoster/IfolderRu.py | 2 +- module/plugins/hoster/Keep2shareCC.py | 4 ++-- module/plugins/hoster/KingfilesNet.py | 6 +++--- module/plugins/hoster/LetitbitNet.py | 10 ++++----- module/plugins/hoster/LinksnappyCom.py | 9 ++++---- module/plugins/hoster/LoadTo.py | 4 ++-- module/plugins/hoster/LuckyShareNet.py | 6 +++--- module/plugins/hoster/MediafireCom.py | 6 +++--- module/plugins/hoster/MegaDebridEu.py | 8 +++---- module/plugins/hoster/MegaRapidCz.py | 4 ++-- module/plugins/hoster/MegasharesCom.py | 14 ++++++------ module/plugins/hoster/MultishareCz.py | 8 +++---- module/plugins/hoster/MyfastfileCom.py | 4 ++-- module/plugins/hoster/NarodRu.py | 6 +++--- module/plugins/hoster/NetloadIn.py | 34 +++++++++++++++--------------- module/plugins/hoster/NowDownloadEu.py | 2 +- module/plugins/hoster/NowVideoAt.py | 2 +- module/plugins/hoster/OboomCom.py | 10 ++++----- module/plugins/hoster/OneFichierCom.py | 6 +++--- module/plugins/hoster/OverLoadMe.py | 4 ++-- module/plugins/hoster/PremiumTo.py | 6 +++--- module/plugins/hoster/PremiumizeMe.py | 4 ++-- module/plugins/hoster/PromptfileCom.py | 4 ++-- module/plugins/hoster/QuickshareCz.py | 10 ++++----- module/plugins/hoster/RPNetBiz.py | 6 +++--- module/plugins/hoster/RapidfileshareNet.py | 2 +- module/plugins/hoster/RapidgatorNet.py | 10 ++++----- module/plugins/hoster/RapidshareCom.py | 4 ++-- module/plugins/hoster/RealdebridCom.py | 6 +++--- module/plugins/hoster/RehostTo.py | 2 +- module/plugins/hoster/RemixshareCom.py | 4 ++-- module/plugins/hoster/RgHostNet.py | 2 +- module/plugins/hoster/RyushareCom.py | 2 +- module/plugins/hoster/SendspaceCom.py | 2 +- module/plugins/hoster/ShareonlineBiz.py | 10 ++++----- module/plugins/hoster/ShareplaceCom.py | 4 ++-- module/plugins/hoster/SimplyPremiumCom.py | 10 ++++----- module/plugins/hoster/SimplydebridCom.py | 4 ++-- module/plugins/hoster/SoundcloudCom.py | 2 +- module/plugins/hoster/SpeedyshareCom.py | 4 ++-- module/plugins/hoster/StreamCz.py | 8 +++---- module/plugins/hoster/StreamcloudEu.py | 10 ++++----- module/plugins/hoster/TurbobitNet.py | 10 ++++----- module/plugins/hoster/TwoSharedCom.py | 2 +- module/plugins/hoster/UlozTo.py | 20 +++++++++--------- module/plugins/hoster/UloziskoSk.py | 6 +++--- module/plugins/hoster/UnibytesCom.py | 2 +- module/plugins/hoster/UnrestrictLi.py | 12 +++++------ module/plugins/hoster/UploadedTo.py | 20 +++++++++--------- module/plugins/hoster/UploadheroCom.py | 4 ++-- module/plugins/hoster/UploadingCom.py | 12 +++++------ module/plugins/hoster/UpstoreNet.py | 6 +++--- module/plugins/hoster/VeehdCom.py | 10 +++------ module/plugins/hoster/VeohCom.py | 4 ++-- module/plugins/hoster/VimeoCom.py | 6 +++--- module/plugins/hoster/WebshareCz.py | 2 +- module/plugins/hoster/WrzucTo.py | 4 ++-- module/plugins/hoster/XHamsterCom.py | 10 ++++----- module/plugins/hoster/Xdcc.py | 24 ++++++++++----------- module/plugins/hoster/YibaishiwuCom.py | 4 ++-- module/plugins/hoster/YourfilesTo.py | 4 ++-- module/plugins/hoster/YoutubeCom.py | 4 ++-- module/plugins/hoster/ZDF.py | 2 +- module/plugins/hoster/ZeveraCom.py | 8 +++---- module/plugins/hoster/ZippyshareCom.py | 2 +- 105 files changed, 343 insertions(+), 347 deletions(-) (limited to 'module/plugins/hoster') diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py index 1b65237a0..c5dd9b707 100644 --- a/module/plugins/hoster/AlldebridCom.py +++ b/module/plugins/hoster/AlldebridCom.py @@ -42,7 +42,7 @@ class AlldebridCom(Hoster): new_url = pyfile.url elif not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "AllDebrid") - self.fail("No AllDebrid account provided") + self.fail(_("No AllDebrid account provided")) else: self.logDebug("Old URL: %s" % pyfile.url) password = self.getPassword().splitlines() @@ -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/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 573134cb9..af8718817 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -74,7 +74,7 @@ class BasePlugin(Hoster): raise else: - self.fail("No Plugin matched and not a downloadable url.") + self.fail(_("No Plugin matched and not a downloadable url")) def downloadFile(self, pyfile): diff --git a/module/plugins/hoster/BayfilesCom.py b/module/plugins/hoster/BayfilesCom.py index 69aab78ef..48758ed88 100644 --- a/module/plugins/hoster/BayfilesCom.py +++ b/module/plugins/hoster/BayfilesCom.py @@ -39,7 +39,7 @@ class BayfilesCom(SimpleHoster): # Get download token m = re.search(self.VARS_PATTERN, self.html) if m is None: - self.error("VARS") + self.error(_("VARS_PATTERN not found")) vfid, delay = m.groups() response = json_loads(self.load('http://bayfiles.com/ajax_download', get={ @@ -48,7 +48,7 @@ class BayfilesCom(SimpleHoster): "vfid": vfid}, decode=True)) if not "token" in response or not response['token']: - self.fail("No token") + self.fail(_("No token")) self.wait(int(delay)) @@ -60,14 +60,14 @@ class BayfilesCom(SimpleHoster): # Get final link and download m = re.search(self.FREE_LINK_PATTERN, self.html) if m is None: - self.error("Free link") + self.error(_("Free link")) self.startDownload(m.group(1)) def handlePremium(self): m = re.search(self.PREMIUM_LINK_PATTERN, self.html) if m is None: - self.error("Premium link") + self.error(_("Premium link")) self.startDownload(m.group(1)) diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py index aa5e1faee..2b1959674 100644 --- a/module/plugins/hoster/BezvadataCz.py +++ b/module/plugins/hoster/BezvadataCz.py @@ -30,7 +30,7 @@ class BezvadataCz(SimpleHoster): #download button m = re.search(r'', self.html) if m is None: - self.error("Page 2 URL") + self.error(_("Page 2 URL not found")) url = "http://bezvadata.cz%s" % m.group(1) self.logDebug("DL URL %s" % url) diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index a7edf60f3..4cbc04755 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -55,7 +55,7 @@ class BitshareCom(SimpleHoster): # Check Traffic used up if re.search(self.TRAFFIC_USED_UP, self.html): - self.logInfo("Your Traffic is used up for today") + self.logInfo(_("Your Traffic is used up for today")) self.wait(30 * 60, True) self.retry() diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index 315ec712b..e5cf69914 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -38,7 +38,7 @@ class CatShareNet(SimpleHoster): def getFileInfo(self): m = re.search(self.IP_BLOCKED_PATTERN, self.html) if m: - self.fail("Only connections from Polish IP address are allowed") + self.fail(_("Only connections from Polish IP address are allowed")) return super(CatShareNet, self).getFileInfo() diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py index 95e00f679..87dd99c84 100644 --- a/module/plugins/hoster/CrockoCom.py +++ b/module/plugins/hoster/CrockoCom.py @@ -32,7 +32,7 @@ class CrockoCom(SimpleHoster): def handleFree(self): if "You need Premium membership to download this file." in self.html: - self.fail("You need Premium membership to download this file.") + self.fail(_("You need Premium membership to download this file")) for _i in xrange(5): m = re.search(self.CAPTCHA_PATTERN, self.html) @@ -45,7 +45,7 @@ class CrockoCom(SimpleHoster): m = re.search(self.FORM_PATTERN, self.html, re.S) if m is None: - self.error("ACTION") + self.error(_("FORM_PATTERN not found")) action, form = m.groups() inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) @@ -64,7 +64,7 @@ class CrockoCom(SimpleHoster): else: break else: - self.fail("No valid captcha solution received") + self.fail(_("No valid captcha solution received")) getInfo = create_getInfo(CrockoCom) diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index cb450425b..5396a7826 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -51,14 +51,14 @@ class CzshareCom(SimpleHoster): # check user credit try: credit = parseFileSize(m.group(1).replace(' ', ''), m.group(2)) - self.logInfo("Premium download for %i KiB of Credit" % (self.pyfile.size / 1024)) - self.logInfo("User %s has %i KiB left" % (self.user, credit / 1024)) + self.logInfo(_("Premium download for %i KiB of Credit") % (self.pyfile.size / 1024)) + self.logInfo(_("User %s has %i KiB left") % (self.user, credit / 1024)) if credit < self.pyfile.size: - self.logInfo("Not enough credit to download file %s" % self.pyfile.name) + self.logInfo(_("Not enough credit to download file: %s") % self.pyfile.name) return False except Exception, e: # let's continue and see what happens... - self.logError("Parse error (CREDIT): %s" % e) + self.logError(repr(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("Parse error (FORM): %s" % e) + self.logError(repr(e)) self.resetAccount() # download the file, destination is determined by pyLoad @@ -81,7 +81,7 @@ class CzshareCom(SimpleHoster): # get free url m = re.search(self.FREE_URL_PATTERN, self.html) if m is None: - self.error("Free URL") + self.error(_("FREE_URL_PATTERN not found")) parsed_url = "http://sdilej.cz" + m.group(1) self.logDebug("PARSED_URL:" + parsed_url) @@ -96,7 +96,7 @@ class CzshareCom(SimpleHoster): self.pyfile.size = int(inputs['size']) except Exception, e: self.logError(e) - self.error("Form") + self.error(_("Form")) # get and decrypt captcha captcha_url = 'http://sdilej.cz/captcha.php' @@ -111,7 +111,7 @@ class CzshareCom(SimpleHoster): self.correctCaptcha() break else: - self.fail("No valid captcha code entered") + self.fail(_("No valid captcha code entered")) m = re.search("countdown_number = (\d+);", self.html) self.setWait(int(m.group(1)) if m else 50) @@ -120,7 +120,7 @@ class CzshareCom(SimpleHoster): self.logDebug("WAIT URL", self.req.lastEffectiveURL) m = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL) if m is None: - self.error("Download URL") + self.error(_("Download URL not found")) url = "http://%s/download.php?%s" % (m.group(1), m.group(2)) @@ -139,7 +139,7 @@ class CzshareCom(SimpleHoster): }) if check == "temp_offline": - self.fail("File not available - try later") + self.fail(_("File not available - try later")) if check == "credit": self.resetAccount() elif check == "multi_dl": diff --git a/module/plugins/hoster/DailymotionCom.py b/module/plugins/hoster/DailymotionCom.py index b4ef6fa92..91028156b 100644 --- a/module/plugins/hoster/DailymotionCom.py +++ b/module/plugins/hoster/DailymotionCom.py @@ -91,7 +91,7 @@ class DailymotionCom(Hoster): idx = quality s = streams[idx] - self.logInfo("Download video quality %sx%s" % s[0]) + self.logInfo(_("Download video quality %sx%s") % s[0]) return s[1] diff --git a/module/plugins/hoster/DataHu.py b/module/plugins/hoster/DataHu.py index a15e1df39..8cb50b336 100644 --- a/module/plugins/hoster/DataHu.py +++ b/module/plugins/hoster/DataHu.py @@ -37,7 +37,7 @@ class DataHu(SimpleHoster): url = m.group(1) self.logDebug("Direct link: " + url) else: - self.error("Unable to get direct link") + self.error(_("LINK_PATTERN not found")) self.download(url, disposition=True) diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index d57d86e2f..643f5054e 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -32,19 +32,19 @@ class DataportCz(SimpleHoster): action, inputs = self.parseHtmlForm('free_download_form') self.logDebug(action, inputs) if not action or not inputs: - self.error("free_download_form") + self.error(_("free_download_form")) if "captchaId" in inputs and inputs['captchaId'] in captchas: inputs['captchaCode'] = captchas[inputs['captchaId']] else: - self.error("captcha") + self.error(_("captcha")) self.html = self.download("http://www.dataport.cz%s" % action, post=inputs) check = self.checkDownload({"captcha": 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");', "slot": 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'}) if check == "captcha": - self.error("invalid captcha") + self.error(_("invalid captcha")) elif check == "slot": self.logDebug("No free slots - wait 60s and retry") self.wait(60, False) diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py index 73e48d129..4eed41496 100644 --- a/module/plugins/hoster/DateiTo.py +++ b/module/plugins/hoster/DateiTo.py @@ -46,14 +46,14 @@ class DateiTo(SimpleHoster): m = re.search(self.DATA_PATTERN, self.html) if m is None: - self.error("data") + self.error(_("data")) url = 'http://datei.to/' + m.group(1) data = dict(x.split('=') for x in m.group(2).split('&')) if url.endswith('recaptcha.php'): data['recaptcha_challenge_field'], data['recaptcha_response_field'] = recaptcha.challenge() else: - self.fail("Too bad...") + self.fail(_("Too bad...")) download_url = self.html self.download(download_url) diff --git a/module/plugins/hoster/DebridItaliaCom.py b/module/plugins/hoster/DebridItaliaCom.py index 84f9fbb72..c82d13363 100644 --- a/module/plugins/hoster/DebridItaliaCom.py +++ b/module/plugins/hoster/DebridItaliaCom.py @@ -27,7 +27,7 @@ class DebridItaliaCom(Hoster): new_url = pyfile.url elif not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "DebridItalia") - self.fail("No DebridItalia account provided") + self.fail(_("No DebridItalia account provided")) else: self.logDebug("Old URL: %s" % pyfile.url) url = "http://debriditalia.com/linkgen2.php?xjxfun=convertiLink&xjxargs[]=S" % pyfile.url @@ -35,7 +35,7 @@ class DebridItaliaCom(Hoster): self.logDebug("XML data: %s" % page) if 'File not available' in page: - self.fail("File not available") + self.fail(_("File not available")) else: new_url = re.search(r'(?P[^<]+)', page).group('direct') diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 66c81de29..de1cb7000 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -41,21 +41,21 @@ class DepositfilesCom(SimpleHoster): self.html = self.load(self.pyfile.url, post={"gateway_result": "1"}, cookies=True) if re.search(r'File is checked, please try again in a minute.', self.html) is not None: - self.logInfo("DepositFiles.com: The file is being checked. Waiting 1 minute.") + self.logInfo(_("The file is being checked. Waiting 1 minute")) self.wait(61) self.retry() wait = re.search(r'html_download_api-limit_interval\">(\d+)', self.html) if wait: wait_time = int(wait.group(1)) - self.logInfo("%s: Traffic used up. Waiting %d seconds." % (self.__name__, wait_time)) + self.logInfo(_("Traffic used up. Waiting %d seconds") % wait_time) self.wait(wait_time, True) self.retry() wait = re.search(r'>Try in (\d+) minutes or use GOLD account', self.html) if wait: wait_time = int(wait.group(1)) - self.logInfo("%s: All free slots occupied. Waiting %d minutes." % (self.__name__, wait_time)) + self.logInfo(_("All free slots occupied. Waiting %d minutes") % wait_time) self.setWait(wait_time * 60, False) wait = re.search(r'Please wait (\d+) sec', self.html) @@ -72,7 +72,7 @@ class DepositfilesCom(SimpleHoster): recaptcha = ReCaptcha(self) captcha_key = recaptcha.detect_key() if captcha_key is None: - self.error("ReCaptcha key not found") + self.error(_("ReCaptcha key not found")) for _i in xrange(5): self.html = self.load("https://dfiles.eu/get_file.php", get=params) @@ -92,9 +92,9 @@ class DepositfilesCom(SimpleHoster): self.logDebug("LINK: %s" % link) break else: - self.error("Download link") + self.error(_("Download link")) else: - self.fail("No valid captcha response received") + self.fail(_("No valid captcha response received")) try: self.download(link, disposition=True) @@ -104,7 +104,7 @@ class DepositfilesCom(SimpleHoster): def handlePremium(self): if '' in self.html: - self.logWarning("Download limit reached") + self.logWarning(_("Download limit reached")) self.retry(25, 60 * 60, "Download limit reached") elif 'onClick="show_gold_offer' in self.html: self.account.relogin(self.user) @@ -117,7 +117,7 @@ class DepositfilesCom(SimpleHoster): elif mirror: dlink = mirror.group(1) else: - self.error("No direct download link or mirror found") + self.error(_("No direct download link or mirror found")) self.download(dlink, disposition=True) diff --git a/module/plugins/hoster/DevhostSt.py b/module/plugins/hoster/DevhostSt.py index fce9e6387..d96209b3f 100644 --- a/module/plugins/hoster/DevhostSt.py +++ b/module/plugins/hoster/DevhostSt.py @@ -35,14 +35,14 @@ class DevhostSt(SimpleHoster): def handleFree(self): m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.error("Download link not found") + self.error(_("Download link not found")) dl_url = m.group(1) self.download(dl_url, disposition=True) check = self.checkDownload({'html': re.compile("html")}) if check == "html": - self.error("Downloaded file is an html page") + self.error(_("Downloaded file is an html page")) getInfo = create_getInfo(DevhostSt) diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index 8932e749c..8b91c03f3 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -161,7 +161,7 @@ class DlFreeFr(SimpleHoster): elif headers.get('code') == 404: self.offline() else: - self.fail("Invalid return code: " + str(headers.get('code'))) + self.fail(_("Invalid return code: ") + str(headers.get('code'))) def handleFree(self): @@ -180,12 +180,12 @@ class DlFreeFr(SimpleHoster): if m: cj.setCookie(m.group(4), m.group(1), m.group(2), m.group(3)) else: - self.fail("Cookie error") + self.fail(_("Cookie error")) location = headers.get("location") self.req.setCookieJar(cj) self.download(location, disposition=True) else: - self.fail("Invalid response") + self.fail(_("Invalid response")) def getLastHeaders(self): diff --git a/module/plugins/hoster/DropboxCom.py b/module/plugins/hoster/DropboxCom.py index efc711bd4..b4152d7ab 100644 --- a/module/plugins/hoster/DropboxCom.py +++ b/module/plugins/hoster/DropboxCom.py @@ -36,7 +36,7 @@ class DropboxCom(SimpleHoster): check = self.checkDownload({'html': re.compile("html")}) if check == "html": - self.error("Downloaded file is an html page") + self.error(_("Downloaded file is an html page")) getInfo = create_getInfo(DropboxCom) diff --git a/module/plugins/hoster/EdiskCz.py b/module/plugins/hoster/EdiskCz.py index a2e1937fb..a2c78269a 100644 --- a/module/plugins/hoster/EdiskCz.py +++ b/module/plugins/hoster/EdiskCz.py @@ -35,7 +35,7 @@ class EdiskCz(SimpleHoster): m = re.search(self.ACTION_PATTERN, url) if m is None: - self.error("ACTION") + self.error(_("ACTION_PATTERN not found")) action = m.group(1) self.html = self.load(url, decode=True) @@ -48,7 +48,7 @@ class EdiskCz(SimpleHoster): }) if not re.match(self.LINK_PATTERN, url): - self.fail("Unexpected server response") + self.fail(_("Unexpected server response")) self.download(url) diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index d7c4b2eeb..3fad62693 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -54,7 +54,7 @@ class EuroshareEu(SimpleHoster): m = re.search(self.FREE_URL_PATTERN, self.html) if m is None: - self.error("Parse error (URL)") + self.error(_("FREE_URL_PATTERN not found")) parsed_url = "http://euroshare.eu%s" % m.group(1) self.logDebug("URL", parsed_url) self.download(parsed_url, disposition=True) diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index 493644721..b2a2fea65 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -31,13 +31,13 @@ class ExtabitCom(SimpleHoster): def handleFree(self): if r">Only premium users can download this file" in self.html: - self.fail("Only premium users can download this file") + self.fail(_("Only premium users can download this file")) m = re.search(r"Next free download from your ip will be available in (\d+)\s*minutes", self.html) if m: self.wait(int(m.group(1)) * 60, True) elif "The daily downloads limit from your IP is exceeded" in self.html: - self.logWarning("You have reached your daily downloads limit for today") + self.logWarning(_("You have reached your daily downloads limit for today")) self.wait(secondsToMidnight(gmt=2), True) self.logDebug("URL: " + self.req.http.lastEffectiveURL) @@ -59,18 +59,18 @@ class ExtabitCom(SimpleHoster): else: self.invalidCaptcha() else: - self.fail("Invalid captcha") + self.fail(_("Invalid captcha")) else: - self.error("Captcha") + self.error(_("Captcha")) if not "href" in response: - self.error("JSON") + self.error(_("Bad JSON response")) self.html = self.load("http://extabit.com/file/%s%s" % (fileID, response['href'])) m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.error("Download URL") + self.error(_("LINK_PATTERN not found")) url = m.group(1) self.download(url) diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index b1e834c61..cb6c44eb7 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -41,7 +41,7 @@ class FastixRu(Hoster): new_url = pyfile.url elif not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "Fastix") - self.fail("No Fastix account provided") + self.fail(_("No Fastix account provided")) else: self.logDebug("Old URL: %s" % pyfile.url) api_key = self.account.getAccountData(self.user) @@ -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 0019a5708..a07f741fa 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -44,7 +44,7 @@ class FastshareCz(SimpleHoster): if m: action, captcha_src = m.groups() else: - self.error("Free URL") + self.error(_("FREE_URL_PATTERN not found")) baseurl = "http://www.fastshare.cz" captcha = self.decryptCaptcha(urljoin(baseurl, captcha_src)) @@ -66,14 +66,14 @@ class FastshareCz(SimpleHoster): if "location" in header: url = header['location'] elif self.CREDIT_PATTERN in self.html: - self.logWarning("Not enough traffic left") + self.logWarning(_("Not enough traffic left")) self.resetAccount() else: m = re.search(self.PREMIUM_URL_PATTERN, self.html) if m: url = m.group(1) else: - self.error("Premium URL") + self.error(_("PREMIUM_URL_PATTERN not found")) self.logDebug("PREMIUM URL: " + url) self.download(url, disposition=True) diff --git a/module/plugins/hoster/File4safeCom.py b/module/plugins/hoster/File4safeCom.py index 211e668a1..d7e951010 100644 --- a/module/plugins/hoster/File4safeCom.py +++ b/module/plugins/hoster/File4safeCom.py @@ -35,7 +35,7 @@ class File4safeCom(XFSPHoster): location = m.group(1).strip() self.startDownload(location) else: - self.error("Unable to detect premium download link") + self.error(_("LINK_PATTERN not found")) getInfo = create_getInfo(File4safeCom) diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py index 427ae9dcc..8f314f059 100644 --- a/module/plugins/hoster/FileSharkPl.py +++ b/module/plugins/hoster/FileSharkPl.py @@ -57,9 +57,9 @@ class FileSharkPl(SimpleHoster): alert = m.group(1) if re.match(self.IP_BLOCKED_PATTERN, alert): - self.fail("Only connections from Polish IP are allowed") + self.fail(_("Only connections from Polish IP are allowed")) elif re.match(self.DOWNLOAD_SLOTS_ERROR_PATTERN, alert): - self.logInfo("No free download slots available") + self.logInfo(_("No free download slots available")) self.retry(10, 30 * 60, "Still no free download slots available") else: self.logInfo(alert) @@ -79,7 +79,7 @@ class FileSharkPl(SimpleHoster): def handleFree(self): m = re.search(self.DOWNLOAD_URL_FREE, self.html) if m is None: - self.error("Download url not found") + self.error(_("Download url not found")) file_url = urljoin("http://fileshark.pl", m.group(1)) diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 60b4838ec..6f8f3f775 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -43,7 +43,7 @@ class FilecloudIo(SimpleHoster): m = re.search(self.AB1_PATTERN, self.html) if m is None: - self.error("__AB1") + self.error(_("__AB1")) data['__ab1'] = m.group(1) recaptcha = ReCaptcha(self) @@ -52,10 +52,10 @@ class FilecloudIo(SimpleHoster): captcha_key = m.group(1) if m else recaptcha.detect_key() if captcha_key is None: - self.error("ReCaptcha key not found") + self.error(_("ReCaptcha key not found")) if not self.account: - self.fail("User not logged in") + self.fail(_("User not logged in")) elif not self.account.logged_in: captcha_challenge, captcha_response = recaptcha.challenge(captcha_key) self.account.form_data = {"recaptcha_challenge_field": captcha_challenge, @@ -89,14 +89,14 @@ class FilecloudIo(SimpleHoster): self.correctCaptcha() break else: - self.fail("Incorrect captcha") + self.fail(_("Incorrect captcha")) if response['dl']: self.html = self.load('http://filecloud.io/download.html') m = re.search(self.LINK_PATTERN % self.file_info['ID'], self.html) if m is None: - self.error("Download URL") + self.error(_("LINK_PATTERN not found")) if "size" in self.file_info and self.file_info['size']: self.check_data = {"size": int(self.file_info['size'])} @@ -104,7 +104,7 @@ class FilecloudIo(SimpleHoster): download_url = m.group(1) self.download(download_url) else: - self.fail("Unexpected server response") + self.fail(_("Unexpected server response")) def handlePremium(self): diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index f4729cf2f..068724488 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -45,13 +45,13 @@ class FilefactoryCom(SimpleHoster): def handleFree(self): if "Currently only Premium Members can download files larger than" in self.html: - self.fail("File too large for free download") + self.fail(_("File too large for free download")) elif "All free download slots on this server are currently in use" in self.html: self.retry(50, 15 * 60, "All free slots are busy") m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.error("Free download link not found") + self.error(_("Free download link not found")) dl_link = m.group(1) @@ -68,7 +68,7 @@ class FilefactoryCom(SimpleHoster): self.logDebug("Parallel downloads detected; waiting 15 minutes") self.retry(wait_time=15 * 60, reason="Parallel downloads") elif check == "error": - self.error("Unknown error") + self.error(_("Unknown error")) def handlePremium(self): @@ -86,6 +86,6 @@ class FilefactoryCom(SimpleHoster): if m: url = m.group(1) else: - self.error("Premium download link not found") + self.error(_("Premium download link not found")) self.download(url, disposition=True) diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 4090ce92b..338c89cae 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -35,12 +35,12 @@ class FilepostCom(SimpleHoster): m = re.search(self.FLP_TOKEN_PATTERN, self.html) if m is None: - self.error("Token") + self.error(_("Token")) flp_token = m.group(1) m = re.search(self.RECAPTCHA_PATTERN, self.html) if m is None: - self.error("Captcha key") + self.error(_("Captcha key")) captcha_key = m.group(1) # Get wait time @@ -58,14 +58,14 @@ class FilepostCom(SimpleHoster): for file_pass in self.getPassword().splitlines(): get_dict['JsHttpRequest'] = str(int(time() * 10000)) + '-xml' post_dict['file_pass'] = file_pass - self.logInfo("Password protected link, trying " + file_pass) + self.logInfo(_("Password protected link, trying ") + file_pass) download_url = self.getJsonResponse(get_dict, post_dict, 'link') if download_url: break else: - self.fail("No or incorrect password") + self.fail(_("No or incorrect password")) else: # Solve recaptcha @@ -88,7 +88,7 @@ class FilepostCom(SimpleHoster): self.invalidCaptcha() else: - self.fail("Invalid captcha") + self.fail(_("Invalid captcha")) # Download self.download(download_url) @@ -99,7 +99,7 @@ class FilepostCom(SimpleHoster): self.logDebug(json_response) if not 'js' in json_response: - self.error("JSON %s 1" % field) + self.error(_("JSON %s 1") % field) # i changed js_answer to json_response['js'] since js_answer is nowhere set. # i don't know the JSON-HTTP specs in detail, but the previous author @@ -120,10 +120,9 @@ class FilepostCom(SimpleHoster): return None else: self.fail(json_response['js']['error']) - # ~? self.fail(js_answer['error']) if not 'answer' in json_response['js'] or not field in json_response['js']['answer']: - self.error("JSON %s 2" % field) + self.error(_("JSON %s 2") % field) return json_response['js']['answer'][field] diff --git a/module/plugins/hoster/FilepupNet.py b/module/plugins/hoster/FilepupNet.py index 2a1c43913..81d171685 100644 --- a/module/plugins/hoster/FilepupNet.py +++ b/module/plugins/hoster/FilepupNet.py @@ -38,14 +38,14 @@ class FilepupNet(SimpleHoster): def handleFree(self): m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.error("Download link not found") + self.error(_("Download link not found")) dl_link = m.group(1) self.download(dl_link, post={'task': "download"}) check = self.checkDownload({'html': re.compile("html")}) if check == "html": - self.error("Downloaded file is an html page") + self.error(_("Downloaded file is an html page")) getInfo = create_getInfo(FilepupNet) diff --git a/module/plugins/hoster/FilerNet.py b/module/plugins/hoster/FilerNet.py index d45289fc0..9a34f8872 100644 --- a/module/plugins/hoster/FilerNet.py +++ b/module/plugins/hoster/FilerNet.py @@ -41,7 +41,7 @@ class FilerNet(SimpleHoster): inputs = self.parseHtmlForm(input_names='token')[1] if 'token' not in inputs: - self.error("Unable to detect token") + self.error(_("Unable to detect token")) token = inputs['token'] self.logDebug("Token: " + token) @@ -49,7 +49,7 @@ class FilerNet(SimpleHoster): inputs = self.parseHtmlForm(input_names='hash')[1] if 'hash' not in inputs: - self.error("Unable to detect hash") + self.error(_("Unable to detect hash")) hash_data = inputs['hash'] self.logDebug("Hash: " + hash_data) @@ -76,7 +76,7 @@ class FilerNet(SimpleHoster): self.invalidCaptcha() if not downloadURL: - self.fail("No Download url retrieved/all captcha attempts failed") + self.fail(_("No Download url retrieved/all captcha attempts failed")) self.download(downloadURL, disposition=True) @@ -89,7 +89,7 @@ class FilerNet(SimpleHoster): html = self.load(self.pyfile.url) m = re.search(self.LINK_PATTERN, html) if m is None: - self.error("Unable to detect direct link, try to enable 'Direct download' in your user settings") + self.error(_("LINK_PATTERN not found")) dl = 'http://filer.net' + m.group(1) self.logDebug("Direct link: " + dl) diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 8aafb5c0c..9fded2dd8 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -91,11 +91,11 @@ class FileserveCom(Hoster): self.doLongWait(re.search(self.LONG_WAIT_PATTERN, self.html)) elif action['fail'] == "parallelDownload": - self.logWarning(_("Parallel download error, now waiting 60s.")) + self.logWarning(_("Parallel download error, now waiting 60s")) self.retry(wait_time=60, reason="parallelDownload") else: - self.fail("Download check returned %s" % action['fail']) + self.fail(_("Download check returned: %s") % action['fail']) elif "success" in action: if action['success'] == "showCaptcha": @@ -105,13 +105,13 @@ class FileserveCom(Hoster): self.doTimmer() else: - self.error("Unknown server response") + self.error(_("Unknown server response")) # show download link response = self.load(self.url, post={"downloadLink": "show"}, decode=True) self.logDebug("Show downloadLink response : %s" % response) if "fail" in response: - self.error("Couldn't retrieve download url") + self.error(_("Couldn't retrieve download url")) # this may either download our file or forward us to an error page self.download(self.url, post={"download": "normal"}) @@ -127,7 +127,7 @@ class FileserveCom(Hoster): elif check == "wait": self.doLongWait(self.lastCheck) elif check == "limit": - self.logWarning("Download limited reached for today") + self.logWarning(_("Download limited reached for today")) self.setWait(secondsToMidnight(gmt=2), True) self.wait() self.retry() @@ -140,12 +140,12 @@ class FileserveCom(Hoster): self.logDebug("Wait response : %s" % response[:80]) if "fail" in response: - self.fail("Failed getting wait time") + self.fail(_("Failed getting wait time")) if self.__name__ == "FilejungleCom": m = re.search(r'"waitTime":(\d+)', response) if m is None: - self.fail("Cannot get wait time") + self.fail(_("Cannot get wait time")) wait_time = int(m.group(1)) else: wait_time = int(response) + 3 @@ -170,7 +170,7 @@ class FileserveCom(Hoster): self.correctCaptcha() break else: - self.fail("Invalid captcha") + self.fail(_("Invalid captcha")) def doLongWait(self, m): @@ -209,7 +209,7 @@ class FileserveCom(Hoster): if check == "login": self.account.relogin(self.user) - self.retry(reason=_("Not logged in.")) + self.retry(reason=_("Not logged in")) def getInfo(urls): diff --git a/module/plugins/hoster/FlyFilesNet.py b/module/plugins/hoster/FlyFilesNet.py index 8c5c95839..9aa2a3e11 100644 --- a/module/plugins/hoster/FlyFilesNet.py +++ b/module/plugins/hoster/FlyFilesNet.py @@ -36,7 +36,7 @@ class FlyFilesNet(SimpleHoster): self.logDebug("Parsed URL: %s" % parsed_url) if parsed_url == '#downlink|' or parsed_url == "#downlink|#": - self.logWarning("Could not get the download URL. Please wait 10 minutes.") + self.logWarning(_("Could not get the download URL. Please wait 10 minutes")) self.wait(10 * 60, True) self.retry() diff --git a/module/plugins/hoster/FourSharedCom.py b/module/plugins/hoster/FourSharedCom.py index 2ea061544..f3f97e875 100644 --- a/module/plugins/hoster/FourSharedCom.py +++ b/module/plugins/hoster/FourSharedCom.py @@ -32,7 +32,7 @@ class FourSharedCom(SimpleHoster): def handleFree(self): if not self.account: - self.fail("User not logged in") + self.fail(_("User not logged in")) m = re.search(self.DOWNLOAD_BUTTON_PATTERN, self.html) if m: @@ -44,7 +44,7 @@ class FourSharedCom(SimpleHoster): m = re.search(self.DOWNLOAD_URL_PATTERN, self.html) if m is None: - self.error("Download link") + self.error(_("Download link")) link = m.group(1) try: diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index 6287545cb..529b107d3 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -50,13 +50,13 @@ class FreakshareCom(Hoster): "downloadserver": "No Downloadserver. Please try again later!"}) if check == "bad": - self.fail("Bad Try.") + self.fail(_("Bad Try")) elif check == "paralell": self.setWait(300, True) self.wait() self.retry() elif check == "empty": - self.fail("File not downloadable") + self.fail(_("File not downloadable")) elif check == "wrong_captcha": self.invalidCaptcha() self.retry() diff --git a/module/plugins/hoster/FreeWayMe.py b/module/plugins/hoster/FreeWayMe.py index 88ba982f6..e9ca59e3f 100644 --- a/module/plugins/hoster/FreeWayMe.py +++ b/module/plugins/hoster/FreeWayMe.py @@ -24,7 +24,7 @@ class FreeWayMe(Hoster): def process(self, pyfile): if not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "FreeWayMe") - self.fail("No FreeWay account provided") + self.fail(_("No FreeWay account provided")) self.logDebug("Old URL: %s" % pyfile.url) diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 217e2d754..fd9980117 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -68,16 +68,16 @@ class FshareVn(SimpleHoster): self.url = self.pyfile.url + action if not inputs: - self.error("FORM") + self.error(_("No FORM")) elif 'link_file_pwd_dl' in inputs: for password in self.getPassword().splitlines(): - self.logInfo("Password protected link, trying", password) + self.logInfo(_("Password protected link, trying ") + password) inputs['link_file_pwd_dl'] = password self.html = self.load(self.url, post=inputs, decode=True) if not 'name="link_file_pwd_dl"' in self.html: break else: - self.fail("No or incorrect password") + self.fail(_("No or incorrect password")) else: self.html = self.load(self.url, post=inputs, decode=True) @@ -88,7 +88,7 @@ class FshareVn(SimpleHoster): m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.error("FREE DL URL") + self.error(_("LINK_PATTERN not found")) self.url = m.group(1) self.logDebug("FREE DL URL: %s" % self.url) @@ -106,7 +106,7 @@ class FshareVn(SimpleHoster): m = re.search(self.WAIT_PATTERN, self.html) if m: - self.logInfo("Wait until %s ICT" % m.group(1)) + self.logInfo(_("Wait until %s ICT") % m.group(1)) wait_until = mktime(strptime(m.group(1), "%d/%m/%Y %H:%M")) self.wait(wait_until - mktime(gmtime()) - 7 * 60 * 60, True) self.retry() @@ -123,4 +123,4 @@ class FshareVn(SimpleHoster): }) if check == "not_found": - self.fail("File not m on server") + self.fail(_("File not m on server")) diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index bdf75b10f..68104aeec 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -55,7 +55,7 @@ class Ftp(Hoster): try: response = self.load(pyfile.url) except pycurl.error, e: - self.fail("Error %d: %s" % e.args) + self.fail(_("Error %d: %s") % e.args) self.req.http.c.setopt(pycurl.NOBODY, 0) self.logDebug(self.req.http.header) @@ -76,4 +76,4 @@ class Ftp(Hoster): self.logDebug("LINKS", links) self.core.api.addPackage(pkgname, links) else: - self.fail("Unexpected server response") + self.fail(_("Unexpected server response")) diff --git a/module/plugins/hoster/GamefrontCom.py b/module/plugins/hoster/GamefrontCom.py index 2009d06ab..e36e5a570 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -56,7 +56,7 @@ class GamefrontCom(Hoster): def _getName(self): name = re.search(self.PATTERN_FILENAME, self.html) if name is None: - self.fail("%s: Plugin broken." % self.__name__) + self.fail(_("Plugin broken") return name.group(1) diff --git a/module/plugins/hoster/GigapetaCom.py b/module/plugins/hoster/GigapetaCom.py index 5b322187b..20e453ce6 100644 --- a/module/plugins/hoster/GigapetaCom.py +++ b/module/plugins/hoster/GigapetaCom.py @@ -49,7 +49,7 @@ class GigapetaCom(SimpleHoster): elif "Entered figures don`t coincide with the picture" in self.html: self.invalidCaptcha() else: - self.fail("No valid captcha code entered") + self.fail(_("No valid captcha code entered")) self.req.http.c.setopt(FOLLOWLOCATION, 1) self.download(download_url) diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py index a5cea6b9f..44ca53c8a 100644 --- a/module/plugins/hoster/HellshareCz.py +++ b/module/plugins/hoster/HellshareCz.py @@ -30,16 +30,16 @@ class HellshareCz(SimpleHoster): def process(self, pyfile): if not self.account: - self.fail("User not logged in") + self.fail(_("User not logged in")) pyfile.url = re.match(self.__pattern__, pyfile.url).group(1) self.html = self.load(pyfile.url, decode=True) self.getFileInfo() if not self.checkTrafficLeft(): - self.fail("Not enough traffic left for user %s." % self.user) + self.fail(_("Not enough traffic left for user ") + self.user) m = re.search(self.SHOW_WINDOW_PATTERN, self.html) if m is None: - self.error("SHOW WINDOW") + self.error(_("SHOW_WINDOW_PATTERN not found")) self.url = "http://www.hellshare.com" + m.group(1) self.download(self.url) diff --git a/module/plugins/hoster/IfileIt.py b/module/plugins/hoster/IfileIt.py index 6f92b4b42..f06fa2788 100644 --- a/module/plugins/hoster/IfileIt.py +++ b/module/plugins/hoster/IfileIt.py @@ -53,10 +53,10 @@ class IfileIt(SimpleHoster): self.correctCaptcha() break else: - self.fail("Incorrect captcha") + self.fail(_("Incorrect captcha")) if not "ticket_url" in json_response: - self.error("Download URL") + self.error(_("No download URL")) self.download(json_response['ticket_url']) diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py index 94a7d0c5f..396cc62d2 100644 --- a/module/plugins/hoster/IfolderRu.py +++ b/module/plugins/hoster/IfolderRu.py @@ -66,7 +66,7 @@ class IfolderRu(SimpleHoster): else: break else: - self.fail("Invalid captcha") + self.fail(_("Invalid captcha")) download_url = re.search(self.LINK_PATTERN, self.html).group(1) self.correctCaptcha() diff --git a/module/plugins/hoster/Keep2shareCC.py b/module/plugins/hoster/Keep2shareCC.py index aea80d29f..bd7825d08 100644 --- a/module/plugins/hoster/Keep2shareCC.py +++ b/module/plugins/hoster/Keep2shareCC.py @@ -66,7 +66,7 @@ class Keep2shareCC(SimpleHoster): m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.error("Unable to detect direct link") + self.error(_("LINK_PATTERN not found")) self.startDownload(m.group(1)) @@ -96,7 +96,7 @@ class Keep2shareCC(SimpleHoster): else: self.invalidCaptcha() else: - self.fail("All captcha attempts failed") + self.fail(_("All captcha attempts failed")) def startDownload(self, url): diff --git a/module/plugins/hoster/KingfilesNet.py b/module/plugins/hoster/KingfilesNet.py index b4e393c37..4bf477663 100644 --- a/module/plugins/hoster/KingfilesNet.py +++ b/module/plugins/hoster/KingfilesNet.py @@ -50,7 +50,7 @@ class KingfilesNet(SimpleHoster): # Make the downloadlink appear and load the file m = re.search(self.RAND_ID_PATTERN, b) if m is None: - self.error("Random key not found") + self.error(_("Random key not found")) rand = m.group(1) self.logDebug("rand = ", rand) @@ -68,14 +68,14 @@ class KingfilesNet(SimpleHoster): m = re.search(self.LINK_PATTERN, c) if m is None: - self.error("Download url not found") + self.error(_("Download url not found")) dl_url = m.group(1) self.download(dl_url, cookies=True, disposition=True) check = self.checkDownload({'html': re.compile("")}) if check == "html": - self.error("Downloaded file is an html page") + self.error(_("Downloaded file is an html page")) getInfo = create_getInfo(KingfilesNet) diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 983a50c6c..94702e4ab 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -71,7 +71,7 @@ class LetitbitNet(SimpleHoster): def handleFree(self): action, inputs = self.parseHtmlForm('id="ifree_form"') if not action: - self.error("ifree_form") + self.error(_("ifree_form")) domain = "http://www." + self.HOSTER_NAME self.pyfile.size = float(inputs['sssize']) @@ -90,7 +90,7 @@ class LetitbitNet(SimpleHoster): response = self.load("%s/ajax/download3.php" % domain, post=" ", cookies=True) if response != '1': - self.error("Unknown response - ajax_check_url") + self.error(_("Unknown response - ajax_check_url")) self.logDebug(response) recaptcha = ReCaptcha(self) @@ -104,7 +104,7 @@ class LetitbitNet(SimpleHoster): if not response: self.invalidCaptcha() if response == "error_free_download_blocked": - self.logWarning("Daily limit reached") + self.logWarning(_("Daily limit reached")) self.wait(secondsToMidnight(gmt=2), True) if response == "error_wrong_captcha": self.invalidCaptcha() @@ -114,7 +114,7 @@ class LetitbitNet(SimpleHoster): elif response.startswith('http://'): urls = [response] else: - self.error("Unknown response - captcha check") + self.error(_("Unknown response - captcha check")) self.correctCaptcha() @@ -125,7 +125,7 @@ class LetitbitNet(SimpleHoster): except Exception, e: self.logError(e) else: - self.fail("Download did not finish correctly") + self.fail(_("Download did not finish correctly")) def handlePremium(self): diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index 3c417a9d3..512f55686 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -33,7 +33,7 @@ class LinksnappyCom(Hoster): new_url = pyfile.url elif not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "Linksnappy.com") - self.fail("No Linksnappy.com account provided") + self.fail(_("No Linksnappy.com account provided")) else: self.logDebug("Old URL: %s" % pyfile.url) host = self._get_host(pyfile.url) @@ -48,8 +48,9 @@ class LinksnappyCom(Hoster): j = json_loads(r)['links'][0] if j['error']: - self.logError("Error converting the link: %s" % j['error']) - self.fail("Error converting the link") + msg = _("Error converting the link") + self.logError(msg, j['error']) + self.fail(msg) pyfile.name = j['filename'] new_url = j['generated'] @@ -66,7 +67,7 @@ class LinksnappyCom(Hoster): check = self.checkDownload({"html302": "302 Found"}) 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/LoadTo.py b/module/plugins/hoster/LoadTo.py index 53227baf1..c289ddf3c 100644 --- a/module/plugins/hoster/LoadTo.py +++ b/module/plugins/hoster/LoadTo.py @@ -42,7 +42,7 @@ class LoadTo(SimpleHoster): # Search for Download URL m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.error("Unable to detect download URL") + self.error(_("LINK_PATTERN not found")) download_url = m.group(1) @@ -65,7 +65,7 @@ class LoadTo(SimpleHoster): self.invalidCaptcha() self.retry() elif check == "html": - self.logWarning("Downloaded file is an html page, will retry") + self.logWarning(_("Downloaded file is an html page, will retry")) self.retry() diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py index b7f3d7099..8ae56458b 100644 --- a/module/plugins/hoster/LuckyShareNet.py +++ b/module/plugins/hoster/LuckyShareNet.py @@ -33,7 +33,7 @@ class LuckyShareNet(SimpleHoster): self.logDebug("You have to wait %d seconds between free downloads" % waittime) self.retry(wait_time=waittime) else: - self.error("Unable to detect wait time between free downloads") + self.error(_("Unable to detect wait time between free downloads")) elif 'Hash expired' in rep: self.retry(reason="Hash expired") return json_loads(rep) @@ -64,10 +64,10 @@ class LuckyShareNet(SimpleHoster): elif 'Verification failed' in rep: self.invalidCaptcha() else: - self.error("Unable to get downlaod link") + self.error(_("Unable to get downlaod link")) if not json['link']: - self.fail("No Download url retrieved/all captcha attempts failed") + self.fail(_("No Download url retrieved/all captcha attempts failed")) self.logDebug("Direct URL: " + json['link']) self.download(json['link']) diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py index 571589de8..969203248 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -100,14 +100,14 @@ class MediafireCom(SimpleHoster): while self.PASSWORD_PATTERN in self.html: if len(passwords): password = passwords.pop(0) - self.logInfo("Password protected link, trying " + password) + self.logInfo(_("Password protected link, trying ") + password) self.html = self.load(self.url, post={"downloadp": password}) else: - self.fail("No or incorrect password") + self.fail(_("No or incorrect password")) m = re.search(r'kNO = r"(http://.*?)";', self.html) if m is None: - self.error("Download URL") + self.error(_("No download URL")) download_url = m.group(1) self.download(download_url) diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index 68b7e0c1e..ea245b9d0 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -34,10 +34,10 @@ class MegaDebridEu(Hoster): if re.match(self.__pattern__, pyfile.url): new_url = pyfile.url elif not self.account: - self.exitOnFail(_("Please enter your %s account or deactivate this plugin") % "Mega-debrid.eu") + self.exitOnFail("Please enter your %s account or deactivate this plugin" % "Mega-debrid.eu") else: if not self.connectToApi(): - self.exitOnFail(_("Unable to connect to %s") % "Mega-debrid.eu") + self.exitOnFail("Unable to connect to Mega-debrid.eu") self.logDebug("Old URL: %s" % pyfile.url) new_url = self.debridLink(pyfile.url) @@ -88,7 +88,7 @@ class MegaDebridEu(Hoster): And display the reason of this failure """ if self.getConfig("unloadFailing"): - self.logError(msg) + self.logError(_(msg)) self.resetAccount() else: - self.fail(msg) + self.fail(_(msg)) diff --git a/module/plugins/hoster/MegaRapidCz.py b/module/plugins/hoster/MegaRapidCz.py index 01b2aaf70..61c3ab425 100644 --- a/module/plugins/hoster/MegaRapidCz.py +++ b/module/plugins/hoster/MegaRapidCz.py @@ -66,6 +66,6 @@ class MegaRapidCz(SimpleHoster): self.relogin(self.user) self.retry(wait_time=60, reason="User login failed") elif re.search(self.ERR_CREDIT_PATTERN, self.html): - self.fail("Not enough credit left") + self.fail(_("Not enough credit left")) else: - self.fail("Download link not found") + self.fail(_("Download link not found")) diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 29ae47509..9f21ce868 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -57,7 +57,7 @@ class MegasharesCom(SimpleHoster): verifyinput = self.decryptCaptcha( "http://d01.megashares.com/index.php?secgfx=gfx&random_num=%s" % random_num) - self.logInfo("Reactivating passport %s: %s %s" % (passport_num, random_num, verifyinput)) + self.logInfo(_("Reactivating passport %s: %s %s") % (passport_num, random_num, verifyinput)) url = ("http://d01.megashares.com%s&rs=check_passport_renewal" % request_uri + "&rsargs[]=%s&rsargs[]=%s&rsargs[]=%s" % (verifyinput, random_num, passport_num) + @@ -71,23 +71,23 @@ class MegasharesCom(SimpleHoster): else: self.invalidCaptcha() else: - self.fail("Failed to reactivate passport") + self.fail(_("Failed to reactivate passport")) m = re.search(self.PASSPORT_RENEW_PATTERN, self.html) if m: 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.logDebug("Waiting %d seconds for a new passport" % renew) 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) if m is None: - self.fail("Passport not found") + self.fail(_("Passport not found")) - self.logInfo("Download passport: %s" % m.group(1)) + self.logInfo(_("Download passport: %s") % m.group(1)) data_left = float(m.group(2)) * 1024 ** {'B': 0, 'KB': 1, 'MB': 2, 'GB': 3}[m.group(3)] - self.logInfo("Data left: %s %s (%d MB needed)" % (m.group(2), m.group(3), self.pyfile.size / 1048576)) + 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") @@ -98,7 +98,7 @@ class MegasharesCom(SimpleHoster): def handleDownload(self, premium=False): # Find download link; m = re.search(self.LINK_PATTERN % (1 if premium else 2), self.html) - msg = '%s download URL' % ('Premium' if premium else 'Free') + msg = _('%s download URL' % ('Premium' if premium else 'Free')) if m is None: self.error(msg) diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index f7c8b47fd..24aabfb24 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -45,7 +45,7 @@ class MultishareCz(SimpleHoster): def handlePremium(self): if not self.checkCredit(): - self.logWarning("Not enough credit left to download file") + self.logWarning(_("Not enough credit left to download file")) self.resetAccount() self.download("http://www.multishare.cz/html/download_premium.php?ID=%s" % self.fileID) @@ -53,13 +53,13 @@ class MultishareCz(SimpleHoster): def handleOverriden(self): if not self.premium: - self.fail("Only premium users can download from other hosters") + self.fail(_("Only premium users can download from other hosters")) self.html = self.load('http://www.multishare.cz/html/mms_ajax.php', post={"link": self.pyfile.url}, decode=True) self.getFileInfo() if not self.checkCredit(): - self.fail("Not enough credit left to download file") + self.fail(_("Not enough credit left to download file")) url = "http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random() * 10000 * random()) params = {"u_ID": self.acc_info['u_ID'], "u_hash": self.acc_info['u_hash'], "link": self.pyfile.url} @@ -69,7 +69,7 @@ class MultishareCz(SimpleHoster): def checkCredit(self): self.acc_info = self.account.getAccountInfo(self.user, True) - self.logInfo("User %s has %i MB left" % (self.user, self.acc_info['trafficleft'] / 1024)) + self.logInfo(_("User %s has %i MB left") % (self.user, self.acc_info['trafficleft'] / 1024)) return self.pyfile.size / 1024 <= self.acc_info['trafficleft'] diff --git a/module/plugins/hoster/MyfastfileCom.py b/module/plugins/hoster/MyfastfileCom.py index a9e84a2f2..64161affa 100644 --- a/module/plugins/hoster/MyfastfileCom.py +++ b/module/plugins/hoster/MyfastfileCom.py @@ -28,7 +28,7 @@ class MyfastfileCom(Hoster): new_url = pyfile.url elif not self.account: self.logError(_("Please enter your %s account or deactivate this plugin") % "Myfastfile.com") - self.fail("No Myfastfile.com account provided") + self.fail(_("No Myfastfile.com account provided")) else: self.logDebug("Original URL: %s" % pyfile.url) page = self.load('http://myfastfile.com/api.php', @@ -37,7 +37,7 @@ class MyfastfileCom(Hoster): self.logDebug("JSON data: " + page) page = json_loads(page) if page['status'] != 'ok': - self.fail("Unable to unrestrict link") + self.fail(_("Unable to unrestrict link")) new_url = page['link'] if new_url != pyfile.url: diff --git a/module/plugins/hoster/NarodRu.py b/module/plugins/hoster/NarodRu.py index 4ba43a850..d99d997f5 100644 --- a/module/plugins/hoster/NarodRu.py +++ b/module/plugins/hoster/NarodRu.py @@ -36,7 +36,7 @@ class NarodRu(SimpleHoster): self.html = self.load('http://narod.ru/disk/getcapchaxml/?rnd=%d' % int(random() * 777)) m = re.search(self.CAPTCHA_PATTERN, self.html) if m is None: - self.error("Captcha") + self.error(_("Captcha")) post_data = {"action": "sendcapcha"} captcha_url, post_data['key'] = m.groups() post_data['rep'] = self.decryptCaptcha(captcha_url) @@ -50,9 +50,9 @@ class NarodRu(SimpleHoster): elif u'Ошиблись?' in self.html: self.invalidCaptcha() else: - self.error("Download link") + self.error(_("Download link")) else: - self.fail("No valid captcha code entered") + self.fail(_("No valid captcha code entered")) self.download(url) diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index ffacc9c66..2d4773bac 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -81,7 +81,7 @@ class NetloadIn(Hoster): self.pyfile.name = self.api_data['filename'] if self.premium: - self.logDebug("Netload: Use Premium Account") + self.logDebug("Use Premium Account") settings = self.load("http://www.netload.in/index.php?id=2&lang=en") if '