summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-26 02:31:54 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-26 02:31:54 +0200
commit9f2ebe486a3e155fb6a60e07cccb77ab6a772eb2 (patch)
tree3b7b96651b12a2fb4765a3961a19bf3c67d4b64f /module/plugins/internal
parentAvoid gettext conflict due variable `_` (diff)
downloadpyload-9f2ebe486a3e155fb6a60e07cccb77ab6a772eb2.tar.xz
Extend translation support in plugins + a lot of code cosmetics and typo fixes
Diffstat (limited to 'module/plugins/internal')
-rw-r--r--module/plugins/internal/CaptchaService.py12
-rw-r--r--module/plugins/internal/SimpleCrypter.py6
-rw-r--r--module/plugins/internal/SimpleHoster.py12
-rw-r--r--module/plugins/internal/XFSPHoster.py26
4 files changed, 28 insertions, 28 deletions
diff --git a/module/plugins/internal/CaptchaService.py b/module/plugins/internal/CaptchaService.py
index a1ec633e8..aa8758344 100644
--- a/module/plugins/internal/CaptchaService.py
+++ b/module/plugins/internal/CaptchaService.py
@@ -28,7 +28,7 @@ class CaptchaService:
if hasattr(self.plugin, "html") and self.plugin.html:
html = self.plugin.html
else:
- errmsg = "%s html not found" % self.__name__
+ errmsg = _("%s html not found") % self.__name__
self.plugin.fail(errmsg) #@TODO: replace all plugin.fail(errmsg) with plugin.error(errmsg) in 0.4.10
raise TypeError(errmsg)
@@ -68,7 +68,7 @@ class ReCaptcha(CaptchaService):
if hasattr(self.plugin, "html") and self.plugin.html:
html = self.plugin.html
else:
- errmsg = "ReCaptcha not found"
+ errmsg = _("ReCaptcha html not found")
self.plugin.fail(errmsg)
raise TypeError(errmsg)
@@ -87,7 +87,7 @@ class ReCaptcha(CaptchaService):
if self.detect_key():
key = self.key
else:
- errmsg = "ReCaptcha key not found"
+ errmsg = _("ReCaptcha key not found")
self.plugin.fail(errmsg)
raise TypeError(errmsg)
@@ -127,7 +127,7 @@ class AdsCaptcha(CaptchaService):
if hasattr(self.plugin, "html") and self.plugin.html:
html = self.plugin.html
else:
- errmsg = "AdsCaptcha html not found"
+ errmsg = _("AdsCaptcha html not found")
self.plugin.fail(errmsg)
raise TypeError(errmsg)
@@ -147,7 +147,7 @@ class AdsCaptcha(CaptchaService):
if self.detect_key():
key = self.key
else:
- errmsg = "AdsCaptcha key not found"
+ errmsg = _("AdsCaptcha key not found")
self.plugin.fail(errmsg)
raise TypeError(errmsg)
@@ -188,7 +188,7 @@ class SolveMedia(CaptchaService):
if self.detect_key():
key = self.key
else:
- errmsg = "SolveMedia key not found"
+ errmsg = _("SolveMedia key not found")
self.plugin.fail(errmsg)
raise TypeError(errmsg)
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py
index 3cbb0f70a..61286449d 100644
--- a/module/plugins/internal/SimpleCrypter.py
+++ b/module/plugins/internal/SimpleCrypter.py
@@ -83,10 +83,10 @@ class SimpleCrypter(Crypter):
def prepare(self):
if self.LOGIN_ACCOUNT and not self.account:
- self.fail("Required account not found!")
+ self.fail(_("Required account not found!"))
if self.LOGIN_PREMIUM and not self.premium:
- self.fail("Required premium account not found!")
+ self.fail(_("Required premium account not found!"))
if isinstance(self.COOKIES, list):
set_cookies(self.req.cj, self.COOKIES)
@@ -112,7 +112,7 @@ class SimpleCrypter(Crypter):
if self.package_links:
self.packages = [(package_name, self.package_links, folder_name)]
else:
- self.fail("Could not extract any links")
+ self.fail(_("Could not extract any links"))
def getLinks(self):
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index 951a05783..135d3c9d9 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -224,7 +224,7 @@ class SimpleHoster(Hoster):
self.logDebug("Handle as premium download")
self.handlePremium()
elif premium_only:
- self.fail("This link require a premium account")
+ self.fail(_("This link require a premium account"))
else:
self.logDebug("Handle as free download")
self.handleFree()
@@ -241,7 +241,7 @@ class SimpleHoster(Hoster):
self.tempOffline()
elif status != 2:
self.logDebug(self.file_info)
- self.error("File info")
+ self.error(_("File info"))
if name:
self.pyfile.name = name
@@ -259,12 +259,12 @@ class SimpleHoster(Hoster):
def handleFree(self):
if not hasattr(self, 'LINK_FREE_PATTERN'):
- self.fail("Free download not implemented")
+ self.fail(_("Free download not implemented"))
try:
m = re.search(self.LINK_FREE_PATTERN, self.html)
if m is None:
- self.error("Free download link not found")
+ self.error(_("Free download link not found"))
link = m.group(1)
except Exception, e:
@@ -275,12 +275,12 @@ class SimpleHoster(Hoster):
def handlePremium(self):
if not hasattr(self, 'LINK_PREMIUM_PATTERN'):
- self.fail("Premium download not implemented")
+ self.fail(_("Premium download not implemented"))
try:
m = re.search(self.LINK_PREMIUM_PATTERN, self.html)
if m is None:
- self.error("Premium download link not found")
+ self.error(_("Premium download link not found"))
link = m.group(1)
except Exception, e:
diff --git a/module/plugins/internal/XFSPHoster.py b/module/plugins/internal/XFSPHoster.py
index 19cddba64..0ea5a95c5 100644
--- a/module/plugins/internal/XFSPHoster.py
+++ b/module/plugins/internal/XFSPHoster.py
@@ -62,7 +62,7 @@ class XFSPHoster(SimpleHoster):
def prepare(self):
""" Initialize important variables """
if not self.HOSTER_NAME:
- self.fail("Missing HOSTER_NAME")
+ self.fail(_("Missing HOSTER_NAME"))
if not self.LINK_PATTERN:
pattern = r'(https?://(www\.)?([^/]*?%s|\d+\.\d+\.\d+\.\d+)(\:\d+)?(/d/|(/files)?/\d+/\w+/).+?)["\'<]'
@@ -86,7 +86,7 @@ class XFSPHoster(SimpleHoster):
if self.premium:
self.handleOverriden()
else:
- self.fail("Only premium users can download from other hosters with %s" % self.HOSTER_NAME)
+ self.fail(_("Only premium users can download from other hosters with %s") % self.HOSTER_NAME)
else:
try:
self.file_info = self.getFileInfo()
@@ -151,9 +151,9 @@ class XFSPHoster(SimpleHoster):
else:
if self.errmsg and 'captcha' in self.errmsg:
- self.fail("No valid captcha code entered")
+ self.fail(_("No valid captcha code entered"))
else:
- self.fail("Download link not found")
+ self.fail(_("Download link not found"))
return m.group(1)
@@ -162,7 +162,7 @@ class XFSPHoster(SimpleHoster):
self.html = self.load(self.pyfile.url, post=self.getPostParameters())
m = re.search(self.LINK_PATTERN, self.html)
if m is None:
- self.error("LINK_PATTERN not found")
+ self.error(_("LINK_PATTERN not found"))
self.startDownload(m.group(1))
@@ -183,19 +183,19 @@ class XFSPHoster(SimpleHoster):
action, inputs = self.parseHtmlForm('F1')
if not inputs:
- self.error("TEXTAREA not found")
+ self.error(_("TEXTAREA not found"))
self.logDebug(self.HOSTER_NAME, inputs)
if inputs['st'] == 'OK':
self.html = self.load(action, post=inputs)
elif inputs['st'] == 'Can not leech file':
self.retry(max_tries=20, wait_time=3 * 60, reason=inputs['st'])
else:
- self.fail(inputs['st'])
+ self.fail(_(inputs['st']))
#get easybytez.com link for uploaded file
m = re.search(self.OVR_LINK_PATTERN, self.html)
if m is None:
- self.error("OVR_LINK_PATTERN not found")
+ self.error(_("OVR_LINK_PATTERN not found"))
self.pyfile.url = m.group(1)
header = self.load(self.pyfile.url, just_header=True)
if 'location' in header: # Direct link
@@ -225,7 +225,7 @@ class XFSPHoster(SimpleHoster):
elif 'captcha' in self.errmsg:
self.invalidCaptcha()
elif 'premium' in self.errmsg and 'require' in self.errmsg:
- self.fail("File can be downloaded by premium users only")
+ self.fail(_("File can be downloaded by premium users only"))
elif 'limit' in self.errmsg:
self.wait(1 * 60 * 60, True)
self.retry(25)
@@ -234,7 +234,7 @@ class XFSPHoster(SimpleHoster):
elif 'maintenance' in self.errmsg or 'maintainance' in self.errmsg:
self.tempOffline()
elif 'download files up to' in self.errmsg:
- self.fail("File too large for free download")
+ self.fail(_("File too large for free download"))
else:
self.fail(self.errmsg)
@@ -260,7 +260,7 @@ class XFSPHoster(SimpleHoster):
if self.errmsg:
self.retry()
else:
- self.error("Form not found")
+ self.error(_("Form not found"))
self.logDebug(self.HOSTER_NAME, inputs)
@@ -269,7 +269,7 @@ class XFSPHoster(SimpleHoster):
if self.passwords:
inputs['password'] = self.passwords.pop(0)
else:
- self.fail("No or invalid passport")
+ self.fail(_("No or invalid passport"))
if not self.premium:
m = re.search(self.WAIT_PATTERN, self.html)
@@ -303,7 +303,7 @@ class XFSPHoster(SimpleHoster):
self.errmsg = None
else:
- self.error("FORM: %s" % (inputs['op'] if 'op' in inputs else 'UNKNOWN'))
+ self.error(_("FORM: %s") % (inputs['op'] if 'op' in inputs else _("UNKNOWN")))
def handleCaptcha(self, inputs):