summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-07 01:23:55 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-07 01:23:55 +0200
commitb1759bc440cd6013837697eb8de540914f693ffd (patch)
treed170caf63d7f65e44d23ea2d91a65759a1665928 /module/plugins/internal
parent[Plugin] Fix decoding in load method (diff)
downloadpyload-b1759bc440cd6013837697eb8de540914f693ffd.tar.xz
No camelCase style anymore
Diffstat (limited to 'module/plugins/internal')
-rw-r--r--module/plugins/internal/Account.py108
-rw-r--r--module/plugins/internal/AdYouLike.py10
-rw-r--r--module/plugins/internal/AdsCaptcha.py10
-rw-r--r--module/plugins/internal/Captcha.py2
-rw-r--r--module/plugins/internal/Container.py2
-rw-r--r--module/plugins/internal/Crypter.py12
-rw-r--r--module/plugins/internal/DeadCrypter.py6
-rw-r--r--module/plugins/internal/DeadHoster.py6
-rw-r--r--module/plugins/internal/Extractor.py14
-rw-r--r--module/plugins/internal/Hook.py60
-rw-r--r--module/plugins/internal/Hoster.py138
-rw-r--r--module/plugins/internal/MultiHook.py68
-rw-r--r--module/plugins/internal/MultiHoster.py58
-rw-r--r--module/plugins/internal/OCR.py4
-rw-r--r--module/plugins/internal/Plugin.py58
-rw-r--r--module/plugins/internal/ReCaptcha.py40
-rw-r--r--module/plugins/internal/SevenZip.py8
-rw-r--r--module/plugins/internal/SimpleCrypter.py42
-rw-r--r--module/plugins/internal/SimpleHoster.py188
-rw-r--r--module/plugins/internal/SolveMedia.py18
-rw-r--r--module/plugins/internal/UnRar.py12
-rw-r--r--module/plugins/internal/UnZip.py4
-rw-r--r--module/plugins/internal/XFSAccount.py28
-rw-r--r--module/plugins/internal/XFSCrypter.py2
-rw-r--r--module/plugins/internal/XFSHoster.py70
25 files changed, 498 insertions, 470 deletions
diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py
index d2efe7996..9e0efaee6 100644
--- a/module/plugins/internal/Account.py
+++ b/module/plugins/internal/Account.py
@@ -16,7 +16,7 @@ class WrongPassword(Exception):
class Account(Plugin):
__name__ = "Account"
__type__ = "account"
- __version__ = "0.03"
+ __version__ = "0.04"
__description__ = """Base account plugin"""
__license__ = "GPLv3"
@@ -37,7 +37,7 @@ class Account(Plugin):
self.init()
- self.setAccounts(accounts)
+ self.set_accounts(accounts)
def init(self):
@@ -60,18 +60,18 @@ class Account(Plugin):
#: set timestamp for login
self.timestamps[user] = time.time()
- req = self.getAccountRequest(user)
+ req = self.get_account_request(user)
try:
self.login(user, data, req)
except WrongPassword:
- self.logWarning(
+ self.log_warning(
_("Could not login with account %(user)s | %(msg)s") % {"user": user,
"msg": _("Wrong Password")})
success = data['valid'] = False
except Exception, e:
- self.logWarning(
+ self.log_warning(
_("Could not login with account %(user)s | %(msg)s") % {"user": user,
"msg": e})
success = data['valid'] = False
@@ -88,7 +88,7 @@ class Account(Plugin):
def relogin(self, user):
- req = self.getAccountRequest(user)
+ req = self.get_account_request(user)
if req:
req.cj.clear()
req.close()
@@ -98,14 +98,14 @@ class Account(Plugin):
return self._login(user, self.accounts[user])
- def setAccounts(self, accounts):
+ def set_accounts(self, accounts):
self.accounts = accounts
for user, data in self.accounts.iteritems():
self._login(user, data)
self.infos[user] = {}
- def updateAccounts(self, user, password=None, options={}):
+ def update_accounts(self, user, password=None, options={}):
"""
Updates account and return true if anything changed
"""
@@ -125,7 +125,12 @@ class Account(Plugin):
return True
- def removeAccount(self, user):
+ #: Deprecated method, use `update_accounts` instead
+ def updateAccounts(self, *args, **kwargs):
+ return self.update_accounts(*args, **kwargs)
+
+
+ def remove_account(self, user):
if user in self.accounts:
del self.accounts[user]
if user in self.infos:
@@ -134,28 +139,33 @@ class Account(Plugin):
del self.timestamps[user]
+ #: Deprecated method, use `remove_account` instead
+ def removeAccount(self, *args, **kwargs):
+ return self.remove_account(*args, **kwargs)
+
+
@lock
- def getAccountInfo(self, name, force=False):
+ def get_account_info(self, name, force=False):
"""
Retrieve account infos for an user, do **not** overwrite this method!\\
- just use it to retrieve infos in hoster plugins. see `loadAccountInfo`
+ just use it to retrieve infos in hoster plugins. see `load_account_info`
:param name: username
:param force: reloads cached account information
:return: dictionary with information
"""
- data = Account.loadAccountInfo(self, name)
+ data = Account.load_account_info(self, name)
if force or name not in self.infos:
- self.logDebug("Get Account Info for %s" % name)
- req = self.getAccountRequest(name)
+ self.log_debug("Get Account Info for %s" % name)
+ req = self.get_account_request(name)
try:
- infos = self.loadAccountInfo(name, req)
+ infos = self.load_account_info(name, req)
if not type(infos) == dict:
raise Exception("Wrong return format")
except Exception, e:
- infos = super(self.__class__, self).loadAccountInfo(name, req)
+ infos = super(self.__class__, self).load_account_info(name, req)
infos['error'] = str(e)
if self.core.debug:
@@ -164,24 +174,24 @@ class Account(Plugin):
if req:
req.close()
- self.logDebug("Account Info: %s" % infos)
+ self.log_debug("Account Info: %s" % infos)
infos['timestamp'] = time.time()
self.infos[name] = infos
elif "timestamp" in self.infos[name] and self.infos[name]['timestamp'] + self.info_threshold * 60 < time.time():
- self.logDebug("Reached timeout for account data")
- self.scheduleRefresh(name)
+ self.log_debug("Reached timeout for account data")
+ self.schedule_refresh(name)
data.update(self.infos[name])
return data
- def isPremium(self, user):
- info = self.getAccountInfo(user)
+ def is_premium(self, user):
+ info = self.get_account_info(user)
return info['premium']
- def loadAccountInfo(self, name, req=None):
+ def load_account_info(self, name, req=None):
"""
This should be overwritten in account plugin,\
and retrieving account information for user
@@ -202,20 +212,25 @@ class Account(Plugin):
"type" : self.__name__}
- def getAllAccounts(self, force=False):
- return [self.getAccountInfo(user, force) for user, data in self.accounts.iteritems()]
+ def get_all_accounts(self, force=False):
+ return [self.get_account_info(user, force) for user, data in self.accounts.iteritems()]
- def getAccountRequest(self, user=None):
+ #: Deprecated method, use `get_all_accounts` instead
+ def getAllAccounts(self, *args, **kwargs):
+ return self.get_all_accounts(*args, **kwargs)
+
+
+ def get_account_request(self, user=None):
if not user:
- user, data = self.selectAccount()
+ user, data = self.select_account()
return self.core.requestFactory.getRequest(self.__name__, user)
- def getAccountCookies(self, user=None):
+ def get_account_cookies(self, user=None):
if not user:
- user, data = self.selectAccount()
+ user, data = self.select_account()
if not user:
return None
@@ -223,11 +238,11 @@ class Account(Plugin):
return cj
- def getAccountData(self, user):
+ def get_account_data(self, user):
return self.accounts[user]
- def selectAccount(self):
+ def select_account(self):
"""
Returns an valid account name and data
"""
@@ -244,7 +259,7 @@ class Account(Plugin):
if not compare_time(start.split(":"), end.split(":")):
continue
except Exception:
- self.logWarning(_("Your Time %s has wrong format, use: 1:22-3:44") % time_data)
+ self.log_warning(_("Your Time %s has wrong format, use: 1:22-3:44") % time_data)
if user in self.infos:
if "validuntil" in self.infos[user]:
@@ -262,52 +277,57 @@ class Account(Plugin):
return random.choice(usable)
- def canUse(self):
- return self.selectAccount() != (None, None)
+ def can_use(self):
+ return self.select_account() != (None, None)
- def parseTraffic(self, value, unit=None): #: return kilobytes
+ def parse_traffic(self, value, unit=None): #: return kilobytes
if not unit and not isinstance(value, basestring):
unit = "KB"
return parseFileSize(value, unit)
- def wrongPassword(self):
+ def wrong_password(self):
raise WrongPassword
def empty(self, user):
if user in self.infos:
- self.logWarning(_("Account %s has not enough traffic, checking again in 30min") % user)
+ self.log_warning(_("Account %s has not enough traffic, checking again in 30min") % user)
self.infos[user].update({"trafficleft": 0})
- self.scheduleRefresh(user, 30 * 60)
+ self.schedule_refresh(user, 30 * 60)
def expired(self, user):
if user in self.infos:
- self.logWarning(_("Account %s is expired, checking again in 1h") % user)
+ self.log_warning(_("Account %s is expired, checking again in 1h") % user)
self.infos[user].update({"validuntil": time.time() - 1})
- self.scheduleRefresh(user, 60 * 60)
+ self.schedule_refresh(user, 60 * 60)
- def scheduleRefresh(self, user, time=0, force=True):
+ def schedule_refresh(self, user, time=0, force=True):
"""
Add task to refresh account info to sheduler
"""
- self.logDebug("Scheduled Account refresh for %s in %s seconds." % (user, time))
- self.core.scheduler.addJob(time, self.getAccountInfo, [user, force])
+ self.log_debug("Scheduled Account refresh for %s in %s seconds." % (user, time))
+ self.core.scheduler.addJob(time, self.get_account_info, [user, force])
+
+
+ #: Deprecated method, use `schedule_refresh` instead
+ def scheduleRefresh(self, *args, **kwargs):
+ return self.schedule_refresh(*args, **kwargs)
@lock
- def checkLogin(self, user):
+ def check_login(self, user):
"""
Checks if user is still logged in
"""
if user in self.timestamps:
if self.login_timeout > 0 and self.timestamps[user] + self.login_timeout * 60 < time.time():
- self.logDebug("Reached login timeout for %s" % user)
+ self.log_debug("Reached login timeout for %s" % user)
return self.relogin(user)
else:
return True
diff --git a/module/plugins/internal/AdYouLike.py b/module/plugins/internal/AdYouLike.py
index f623ed268..07e7e4d17 100644
--- a/module/plugins/internal/AdYouLike.py
+++ b/module/plugins/internal/AdYouLike.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Captcha import Captcha
class AdYouLike(Captcha):
__name__ = "AdYouLike"
__type__ = "captcha"
- __version__ = "0.06"
+ __version__ = "0.07"
__description__ = """AdYouLike captcha service plugin"""
__license__ = "GPLv3"
@@ -27,10 +27,10 @@ class AdYouLike(Captcha):
n = re.search(self.CALLBACK_PATTERN, html)
if m and n:
self.key = (m.group(1).strip(), n.group(1).strip())
- self.logDebug("Ayl: %s | Callback: %s" % self.key)
+ self.log_debug("Ayl: %s | Callback: %s" % self.key)
return self.key #: key is the tuple(ayl, callback)
else:
- self.logWarning("Ayl or callback pattern not found")
+ self.log_warning("Ayl or callback pattern not found")
return None
@@ -51,7 +51,7 @@ class AdYouLike(Captcha):
except AttributeError:
self.fail(_("AdYouLike challenge pattern not found"))
- self.logDebug("Challenge: %s" % challenge)
+ self.log_debug("Challenge: %s" % challenge)
return self.result(ayl, challenge), challenge
@@ -86,6 +86,6 @@ class AdYouLike(Captcha):
'_ayl_token_challenge': challenge['token'],
'_ayl_response' : response}
- self.logDebug("Result: %s" % result)
+ self.log_debug("Result: %s" % result)
return result
diff --git a/module/plugins/internal/AdsCaptcha.py b/module/plugins/internal/AdsCaptcha.py
index e058352dd..b45a6dfda 100644
--- a/module/plugins/internal/AdsCaptcha.py
+++ b/module/plugins/internal/AdsCaptcha.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Captcha import Captcha
class AdsCaptcha(Captcha):
__name__ = "AdsCaptcha"
__type__ = "captcha"
- __version__ = "0.09"
+ __version__ = "0.10"
__description__ = """AdsCaptcha captcha service plugin"""
__license__ = "GPLv3"
@@ -27,10 +27,10 @@ class AdsCaptcha(Captcha):
n = re.search(self.CAPTCHAID_PATTERN, html)
if m and n:
self.key = (m.group(1).strip(), n.group(1).strip()) #: key is the tuple(PublicKey, CaptchaId)
- self.logDebug("Key: %s | ID: %s" % self.key)
+ self.log_debug("Key: %s | ID: %s" % self.key)
return self.key
else:
- self.logWarning("Key or id pattern not found")
+ self.log_warning("Key or id pattern not found")
return None
@@ -47,7 +47,7 @@ class AdsCaptcha(Captcha):
except AttributeError:
self.fail(_("AdsCaptcha challenge pattern not found"))
- self.logDebug("Challenge: %s" % challenge)
+ self.log_debug("Challenge: %s" % challenge)
return self.result(server, challenge), challenge
@@ -58,6 +58,6 @@ class AdsCaptcha(Captcha):
cookies=True,
imgtype="jpg")
- self.logDebug("Result: %s" % result)
+ self.log_debug("Result: %s" % result)
return result
diff --git a/module/plugins/internal/Captcha.py b/module/plugins/internal/Captcha.py
index 4629c9522..50ebea89c 100644
--- a/module/plugins/internal/Captcha.py
+++ b/module/plugins/internal/Captcha.py
@@ -6,7 +6,7 @@ from module.plugins.internal.Plugin import Plugin
class Captcha(Plugin):
__name__ = "Captcha"
__type__ = "captcha"
- __version__ = "0.30"
+ __version__ = "0.31"
__description__ = """Base captcha service plugin"""
__license__ = "GPLv3"
diff --git a/module/plugins/internal/Container.py b/module/plugins/internal/Container.py
index fc1a93606..91b5a6f76 100644
--- a/module/plugins/internal/Container.py
+++ b/module/plugins/internal/Container.py
@@ -12,7 +12,7 @@ from module.utils import save_join as fs_join
class Container(Crypter):
__name__ = "Container"
__type__ = "container"
- __version__ = "0.04"
+ __version__ = "0.05"
__pattern__ = r'^unmatchable$'
__config__ = [] #: [("name", "type", "desc", "default")]
diff --git a/module/plugins/internal/Crypter.py b/module/plugins/internal/Crypter.py
index d8cda17d4..f6d3528fd 100644
--- a/module/plugins/internal/Crypter.py
+++ b/module/plugins/internal/Crypter.py
@@ -9,7 +9,7 @@ from module.utils import save_path as safe_filename
class Crypter(Hoster):
__name__ = "Crypter"
__type__ = "crypter"
- __version__ = "0.04"
+ __version__ = "0.05"
__pattern__ = r'^unmatchable$'
__config__ = [("use_subfolder", "bool", "Save package to subfolder", True), #: Overrides core.config.get("general", "folder_per_package")
@@ -69,11 +69,11 @@ class Crypter(Hoster):
package_queue = self.pyfile.package().queue
folder_per_package = self.core.config.get("general", "folder_per_package")
- use_subfolder = self.getConfig('use_subfolder', folder_per_package)
- subfolder_per_package = self.getConfig('subfolder_per_package', True)
+ use_subfolder = self.get_config('use_subfolder', folder_per_package)
+ subfolder_per_package = self.get_config('subfolder_per_package', True)
for name, links, folder in self.packages:
- self.logDebug("Parsed package: %s" % name,
+ self.log_debug("Parsed package: %s" % name,
"%d links" % len(links),
"Saved to folder: %s" % folder if folder else "Saved to download folder")
@@ -88,14 +88,14 @@ class Crypter(Hoster):
if use_subfolder:
if not subfolder_per_package:
setFolder(package_folder)
- self.logDebug("Set package %(name)s folder to: %(folder)s" % {"name": name, "folder": folder})
+ self.log_debug("Set package %(name)s folder to: %(folder)s" % {"name": name, "folder": folder})
elif not folder_per_package or name != folder:
if not folder:
folder = urlparse.urlparse(name).path.split("/")[-1]
setFolder(safe_filename(folder))
- self.logDebug("Set package %(name)s folder to: %(folder)s" % {"name": name, "folder": folder})
+ self.log_debug("Set package %(name)s folder to: %(folder)s" % {"name": name, "folder": folder})
elif folder_per_package:
setFolder(None)
diff --git a/module/plugins/internal/DeadCrypter.py b/module/plugins/internal/DeadCrypter.py
index ef0d12b91..d79551b52 100644
--- a/module/plugins/internal/DeadCrypter.py
+++ b/module/plugins/internal/DeadCrypter.py
@@ -7,7 +7,7 @@ from module.plugins.internal.SimpleCrypter import create_getInfo
class DeadCrypter(Crypter):
__name__ = "DeadCrypter"
__type__ = "crypter"
- __version__ = "0.06"
+ __version__ = "0.07"
__pattern__ = r'^unmatchable$'
@@ -17,8 +17,8 @@ class DeadCrypter(Crypter):
@classmethod
- def apiInfo(cls, *args, **kwargs):
- api = super(DeadCrypter, cls).apiInfo(*args, **kwargs)
+ def api_info(cls, *args, **kwargs):
+ api = super(DeadCrypter, cls).api_info(*args, **kwargs)
api['status'] = 1
return api
diff --git a/module/plugins/internal/DeadHoster.py b/module/plugins/internal/DeadHoster.py
index accb15a78..86f4381a3 100644
--- a/module/plugins/internal/DeadHoster.py
+++ b/module/plugins/internal/DeadHoster.py
@@ -7,7 +7,7 @@ from module.plugins.internal.SimpleHoster import create_getInfo
class DeadHoster(Hoster):
__name__ = "DeadHoster"
__type__ = "hoster"
- __version__ = "0.16"
+ __version__ = "0.17"
__pattern__ = r'^unmatchable$'
@@ -17,8 +17,8 @@ class DeadHoster(Hoster):
@classmethod
- def apiInfo(cls, *args, **kwargs):
- api = super(DeadHoster, cls).apiInfo(*args, **kwargs)
+ def api_info(cls, *args, **kwargs):
+ api = super(DeadHoster, cls).api_info(*args, **kwargs)
api['status'] = 1
return api
diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py
index f73388d8c..60d8b3b3b 100644
--- a/module/plugins/internal/Extractor.py
+++ b/module/plugins/internal/Extractor.py
@@ -22,7 +22,7 @@ class PasswordError(Exception):
class Extractor(Plugin):
__name__ = "Extractor"
__type__ = "extractor"
- __version__ = "0.24"
+ __version__ = "0.25"
__description__ = """Base extractor plugin"""
__license__ = "GPLv3"
@@ -36,18 +36,18 @@ class Extractor(Plugin):
@classmethod
- def isArchive(cls, filename):
+ def is_archive(cls, filename):
name = os.path.basename(filename).lower()
return any(name.endswith(ext) for ext in cls.EXTENSIONS)
@classmethod
- def isMultipart(cls, filename):
+ def is_multipart(cls, filename):
return False
@classmethod
- def isUsable(cls):
+ def is_usable(cls):
"""
Check if system statisfy dependencies
:return: boolean
@@ -56,7 +56,7 @@ class Extractor(Plugin):
@classmethod
- def getTargets(cls, files_ids):
+ def get_targets(cls, files_ids):
"""
Filter suited targets from list of filename id tuple list
:param files_ids: List of filepathes
@@ -97,7 +97,7 @@ class Extractor(Plugin):
self.files = [] #: Store extracted files here
pyfile = self.manager.core.files.getFile(fid) if fid else None
- self.notifyProgress = lambda x: pyfile.setProgress(x) if pyfile else lambda x: None
+ self.notify_progress = lambda x: pyfile.setProgress(x) if pyfile else lambda x: None
def init(self):
@@ -149,7 +149,7 @@ class Extractor(Plugin):
raise NotImplementedError
- def getDeleteFiles(self):
+ def get_delete_files(self):
"""
Return list of files to delete, do *not* delete them here.
diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py
index 5959089b5..7ef8f0189 100644
--- a/module/plugins/internal/Hook.py
+++ b/module/plugins/internal/Hook.py
@@ -25,7 +25,7 @@ def threaded(fn):
class Hook(Plugin):
__name__ = "Hook"
__type__ = "hook"
- __version__ = "0.08"
+ __version__ = "0.09"
__config__ = [] #: [("name", "type", "desc", "default")]
__threaded__ = [] #@TODO: Remove in 0.4.10
@@ -72,7 +72,7 @@ class Hook(Plugin):
self.event_map = None
if self.event_list:
- self.logDebug("Deprecated method `event_list`, use `event_map` instead")
+ self.log_debug("Deprecated method `event_list`, use `event_map` instead")
for f in self.event_list:
self.manager.addEvent(f, getattr(self, f))
@@ -85,8 +85,8 @@ class Hook(Plugin):
#: Deprecated method, use `init_periodical` instead
- def initPeriodical(self):
- return self.init_periodical()
+ def initPeriodical(self, *args, **kwargs):
+ return self.init_periodical(*args, **kwargs)
def _periodical(self, threaded):
@@ -98,7 +98,7 @@ class Hook(Plugin):
self.periodical()
except Exception, e:
- self.logError(_("Error executing hook: %s") % e)
+ self.log_error(_("Error executing hook: %s") % e)
if self.core.debug:
traceback.print_exc()
@@ -124,12 +124,12 @@ class Hook(Plugin):
"""
Checks if hook is activated
"""
- return self.getConfig("activated")
+ return self.get_config("activated")
#: Deprecated method, use `is_activated` instead
- def isActivated(self):
- return self.is_activated()
+ def isActivated(self, *args, **kwargs):
+ return self.is_activated(*args, **kwargs)
def deactivate(self):
@@ -140,8 +140,8 @@ class Hook(Plugin):
#: Deprecated method, use `deactivate` instead
- def unload(self):
- return self.deactivate()
+ def unload(self, *args, **kwargs):
+ return self.deactivate(*args, **kwargs)
def activate(self):
@@ -152,8 +152,8 @@ class Hook(Plugin):
#: Deprecated method, use `activate` instead
- def coreReady(self):
- return self.activate()
+ def coreReady(self, *args, **kwargs):
+ return self.activate(*args, **kwargs)
def exit(self):
@@ -164,8 +164,8 @@ class Hook(Plugin):
#: Deprecated method, use `exit` instead
- def coreExiting(self):
- return self.exit()
+ def coreExiting(self, *args, **kwargs):
+ return self.exit(*args, **kwargs)
def download_preparing(self, pyfile):
@@ -173,8 +173,8 @@ class Hook(Plugin):
#: Deprecated method, use `download_preparing` instead
- def downloadPreparing(self, pyfile):
- return self.download_preparing(pyfile)
+ def downloadPreparing(self, *args, **kwargs):
+ return self.download_preparing(*args, **kwargs)
def download_finished(self, pyfile):
@@ -182,8 +182,8 @@ class Hook(Plugin):
#: Deprecated method, use `download_finished` instead
- def downloadFinished(self, pyfile):
- return self.download_finished(pyfile)
+ def downloadFinished(self, *args, **kwargs):
+ return self.download_finished(*args, **kwargs)
def download_failed(self, pyfile):
@@ -191,8 +191,8 @@ class Hook(Plugin):
#: Deprecated method, use `download_failed` instead
- def downloadFailed(self, pyfile):
- return self.download_failed(pyfile)
+ def downloadFailed(self, *args, **kwargs):
+ return self.download_failed(*args, **kwargs)
def package_finished(self, pypack):
@@ -200,8 +200,8 @@ class Hook(Plugin):
#: Deprecated method, use `package_finished` instead
- def packageFinished(self, pypack):
- return self.package_finished(pypack)
+ def packageFinished(self, *args, **kwargs):
+ return self.package_finished(*args, **kwargs)
def before_reconnect(self, ip):
@@ -209,8 +209,8 @@ class Hook(Plugin):
#: Deprecated method, use `before_reconnect` instead
- def beforeReconnecting(self, ip):
- return self.before_reconnect(ip)
+ def beforeReconnecting(self, *args, **kwargs):
+ return self.before_reconnect(*args, **kwargs)
def after_reconnect(self, ip, oldip):
@@ -230,8 +230,8 @@ class Hook(Plugin):
#: Deprecated method, use `captcha_task` instead
- def newCaptchaTask(self, task):
- return self.captcha_task(task)
+ def newCaptchaTask(self, *args, **kwargs):
+ return self.captcha_task(*args, **kwargs)
def captcha_correct(self, task):
@@ -239,8 +239,8 @@ class Hook(Plugin):
#: Deprecated method, use `captcha_correct` instead
- def captchaCorrect(self, task):
- return self.captcha_correct(task)
+ def captchaCorrect(self, *args, **kwargs):
+ return self.captcha_correct(*args, **kwargs)
def captcha_invalid(self, task):
@@ -248,5 +248,5 @@ class Hook(Plugin):
#: Deprecated method, use `captcha_invalid` instead
- def captchaInvalid(self, task):
- return self.captcha_invalid(task)
+ def captchaInvalid(self, *args, **kwargs):
+ return self.captcha_invalid(*args, **kwargs)
diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py
index 92cb476ea..09672f6f0 100644
--- a/module/plugins/internal/Hoster.py
+++ b/module/plugins/internal/Hoster.py
@@ -16,15 +16,15 @@ from module.plugins.internal.Plugin import Plugin, Abort, Fail, Reconnect, Retry
from module.utils import fs_decode, fs_encode, save_join as fs_join
-def getInfo(urls):
- #result = [ .. (name, size, status, url) .. ]
+def get_info(urls):
+ # result = [ .. (name, size, status, url) .. ]
pass
class Hoster(Plugin):
__name__ = "Hoster"
__type__ = "hoster"
- __version__ = "0.03"
+ __version__ = "0.04"
__pattern__ = r'^unmatchable$'
__config__ = [] #: [("name", "type", "desc", "default")]
@@ -41,18 +41,18 @@ class Hoster(Plugin):
super(Hoster, self).__init__(pyfile.m.core)
#: engage wan reconnection
- self.wantReconnect = False
+ self.want_reconnect = False
#: enable simultaneous processing of multiple downloads
- self.multiDL = True
- self.limitDL = 0
+ self.multi_dl = True
+ self.limit_dl = 0
#: chunk limit
- self.chunkLimit = 1
- self.resumeDownload = False
+ self.chunk_limit = 1
+ self.resume_download = False
#: time.time() + wait in seconds
- self.waitUntil = 0
+ self.wait_until = 0
self.waiting = False
#: captcha reader instance
@@ -75,10 +75,10 @@ class Hoster(Plugin):
#: Browser instance, see `network.Browser`
self.req = self.account.getAccountRequest(self.user)
- self.chunkLimit = -1 #: chunk limit, -1 for unlimited
+ self.chunk_limit = -1 #: chunk limit, -1 for unlimited
#: enables resume (will be ignored if server dont accept chunks)
- self.resumeDownload = True
+ self.resume_download = True
#: premium status
self.premium = self.account.isPremium(self.user)
@@ -91,16 +91,16 @@ class Hoster(Plugin):
self.thread = None #: holds thread in future
#: location where the last call to download was saved
- self.lastDownload = ""
+ self.last_download = ""
#: re match of the last call to `checkDownload`
- self.lastCheck = None
+ self.last_check = None
#: js engine, see `JsEngine`
self.js = self.core.js
#: captcha task
- self.cTask = None
+ self.c_task = None
#: some plugins store html code here
self.html = None
@@ -150,13 +150,13 @@ class Hoster(Plugin):
raise NotImplementedError
- def getChunkCount(self):
- if self.chunkLimit <= 0:
+ def get_chunk_count(self):
+ if self.chunk_limit <= 0:
return self.core.config.get("download", "chunks")
- return min(self.core.config.get("download", "chunks"), self.chunkLimit)
+ return min(self.core.config.get("download", "chunks"), self.chunk_limit)
- def resetAccount(self):
+ def reset_account(self):
"""
Don't use account and retry download
"""
@@ -165,13 +165,13 @@ class Hoster(Plugin):
self.retry()
- def setReconnect(self, reconnect):
+ def set_reconnect(self, reconnect):
reconnect = bool(reconnect)
- self.logDebug("Set wantReconnect to: %s (previous: %s)" % (reconnect, self.wantReconnect))
- self.wantReconnect = reconnect
+ self.log_debug("Set wantReconnect to: %s (previous: %s)" % (reconnect, self.want_reconnect))
+ self.want_reconnect = reconnect
- def setWait(self, seconds, reconnect=None):
+ def set_wait(self, seconds, reconnect=None):
"""
Set a specific wait time later used with `wait`
@@ -181,13 +181,13 @@ class Hoster(Plugin):
wait_time = max(int(seconds), 1)
wait_until = time.time() + wait_time + 1
- self.logDebug("Set waitUntil to: %f (previous: %f)" % (wait_until, self.pyfile.waitUntil),
+ self.log_debug("Set waitUntil to: %f (previous: %f)" % (wait_until, self.pyfile.waitUntil),
"Wait: %d+1 seconds" % wait_time)
self.pyfile.waitUntil = wait_until
if reconnect is not None:
- self.setReconnect(reconnect)
+ self.set_reconnect(reconnect)
def wait(self, seconds=0, reconnect=None):
@@ -197,21 +197,21 @@ class Hoster(Plugin):
pyfile = self.pyfile
if seconds > 0:
- self.setWait(seconds)
+ self.set_wait(seconds)
if reconnect is not None:
- self.setReconnect(reconnect)
+ self.set_reconnect(reconnect)
self.waiting = True
status = pyfile.status
pyfile.setStatus("waiting")
- self.logInfo(_("Wait: %d seconds") % (pyfile.waitUntil - time.time()),
- _("Reconnect: %s") % self.wantReconnect)
+ self.log_info(_("Wait: %d seconds") % (pyfile.waitUntil - time.time()),
+ _("Reconnect: %s") % self.want_reconnect)
if self.account:
- self.logDebug("Ignore reconnection due account logged")
+ self.log_debug("Ignore reconnection due account logged")
while pyfile.waitUntil > time.time():
if pyfile.abort:
@@ -227,7 +227,7 @@ class Hoster(Plugin):
if self.thread.m.reconnecting.isSet():
self.waiting = False
- self.wantReconnect = False
+ self.want_reconnect = False
raise Reconnect
time.sleep(1)
@@ -262,7 +262,7 @@ class Hoster(Plugin):
raise Fail("offline")
- def tempOffline(self, reason=""):
+ def temp_offline(self, reason=""):
"""
Fail and indicates file ist temporary offline, the core may take consequences
"""
@@ -292,19 +292,19 @@ class Hoster(Plugin):
raise Retry(reason)
- def invalidCaptcha(self):
- self.logError(_("Invalid captcha"))
- if self.cTask:
- self.cTask.invalid()
+ def invalid_captcha(self):
+ self.log_error(_("Invalid captcha"))
+ if self.c_task:
+ self.c_task.invalid()
- def correctCaptcha(self):
- self.logInfo(_("Correct captcha"))
- if self.cTask:
- self.cTask.correct()
+ def correct_captcha(self):
+ self.log_info(_("Correct captcha"))
+ if self.c_task:
+ self.c_task.correct()
- def decryptCaptcha(self, url, get={}, post={}, cookies=False, forceUser=False,
+ def decrypt_captcha(self, url, get={}, post={}, cookies=False, forceUser=False,
imgtype='jpg', result_type='textual'):
"""
Loads a captcha and decrypts it with ocr, plugin, user input
@@ -345,7 +345,7 @@ class Hoster(Plugin):
else:
captchaManager = self.core.captchaManager
task = captchaManager.newTask(img, imgtype, tmpCaptcha.name, result_type)
- self.cTask = task
+ self.c_task = task
captchaManager.handleCaptcha(task)
while task.isWaiting():
@@ -364,7 +364,7 @@ class Hoster(Plugin):
self.fail(_("No captcha result obtained in appropiate time by any of the plugins"))
result = task.result
- self.logDebug("Received captcha result: %s" % result)
+ self.log_debug("Received captcha result: %s" % result)
if not self.core.debug:
try:
@@ -409,10 +409,10 @@ class Hoster(Plugin):
self.fail(_("No url given"))
if self.core.debug:
- self.logDebug("Download url: " + url, *["%s=%s" % (key, val) for key, val in locals().iteritems() if key not in ("self", "url")])
+ self.log_debug("Download url: " + url, *["%s=%s" % (key, val) for key, val in locals().iteritems() if key not in ("self", "url")])
- self.correctCaptcha()
- self.checkForSameFiles()
+ self.correct_captcha()
+ self.check_for_same_files()
self.pyfile.setStatus("downloading")
@@ -445,7 +445,7 @@ class Hoster(Plugin):
try:
newname = self.req.httpDownload(url, filename, get=get, post=post, ref=ref, cookies=cookies,
- chunks=self.getChunkCount(), resume=self.resumeDownload,
+ chunks=self.get_chunk_count(), resume=self.resume_download,
progressNotify=self.pyfile.setProgress, disposition=disposition)
finally:
self.pyfile.size = self.req.size
@@ -454,7 +454,7 @@ class Hoster(Plugin):
newname = urlparse.urlparse(newname).path.split('/')[-1]
if disposition and newname != name:
- self.logInfo(_("%(name)s saved as %(newname)s") % {"name": name, "newname": newname})
+ self.log_info(_("%(name)s saved as %(newname)s") % {"name": name, "newname": newname})
self.pyfile.name = newname
filename = os.path.join(location, newname)
@@ -464,7 +464,7 @@ class Hoster(Plugin):
try:
os.chmod(fs_filename, int(self.core.config.get("permission", "file"), 8))
except Exception, e:
- self.logWarning(_("Setting file mode failed"), e)
+ self.log_warning(_("Setting file mode failed"), e)
if self.core.config.get("permission", "change_dl") and os.name != "nt":
try:
@@ -473,13 +473,13 @@ class Hoster(Plugin):
os.chown(fs_filename, uid, gid)
except Exception, e:
- self.logWarning(_("Setting User and Group failed"), e)
+ self.log_warning(_("Setting User and Group failed"), e)
- self.lastDownload = filename
- return self.lastDownload
+ self.last_download = filename
+ return self.last_download
- def checkDownload(self, rules, delete=True, file_size=0, size_tolerance=1000, read_size=100000):
+ def check_download(self, rules, delete=True, file_size=0, size_tolerance=1000, read_size=100000):
"""
Checks the content of the last downloaded file, re match is saved to `lastCheck`
@@ -491,10 +491,10 @@ class Hoster(Plugin):
:return: dictionary key of the first rule that matched
"""
do_delete = False
- lastDownload = fs_encode(self.lastDownload)
+ lastDownload = fs_encode(self.last_download)
- if not self.lastDownload or not os.path.exists(lastDownload):
- self.lastDownload = ""
+ if not self.last_download or not os.path.exists(lastDownload):
+ self.last_download = ""
self.fail(self.pyfile.error or _("No file downloaded"))
try:
@@ -512,15 +512,15 @@ class Hoster(Plugin):
self.fail(_("File size mismatch"))
elif diff != 0:
- self.logWarning(_("File size is not equal to expected size"))
+ self.log_warning(_("File size is not equal to expected size"))
- self.logDebug("Download Check triggered")
+ self.log_debug("Download Check triggered")
with open(lastDownload, "rb") as f:
content = f.read(read_size)
#: produces encoding errors, better log to other file in the future?
- #: self.logDebug("Content: %s" % content)
+ #: self.log_debug("Content: %s" % content)
for name, rule in rules.iteritems():
if isinstance(rule, basestring):
if rule in content:
@@ -531,14 +531,14 @@ class Hoster(Plugin):
m = rule.search(content)
if m:
do_delete = True
- self.lastCheck = m
+ self.last_check = m
return name
finally:
if delete and do_delete:
os.remove(lastDownload)
- def directLink(self, url, follow_location=None):
+ def direct_link(self, url, follow_location=None):
link = ""
if follow_location is None:
@@ -548,11 +548,11 @@ class Hoster(Plugin):
redirect = max(follow_location, 1)
else:
- redirect = self.getConfig("maxredirs", plugin="UserAgentSwitcher")
+ redirect = self.get_config("maxredirs", plugin="UserAgentSwitcher")
for i in xrange(redirect):
try:
- self.logDebug("Redirect #%d to: %s" % (i, url))
+ self.log_debug("Redirect #%d to: %s" % (i, url))
header = self.load(url, just_header=True)
except Exception: #: Bad bad bad... rewrite this part in 0.4.10
@@ -618,18 +618,18 @@ class Hoster(Plugin):
else:
try:
- self.logError(_("Too many redirects"))
+ self.log_error(_("Too many redirects"))
except Exception:
pass
return link
- def parseHtmlForm(self, attr_str="", input_names={}):
+ def parse_html_form(self, attr_str="", input_names={}):
return parseHtmlForm(attr_str, self.html, input_names)
- def checkTrafficLeft(self):
+ def check_traffic_left(self):
if not self.account:
return True
@@ -641,18 +641,18 @@ class Hoster(Plugin):
return True
else:
size = self.pyfile.size / 1024
- self.logInfo(_("Filesize: %s KiB, Traffic left for user %s: %s KiB") % (size, self.user, traffic))
+ self.log_info(_("Filesize: %s KiB, Traffic left for user %s: %s KiB") % (size, self.user, traffic))
return size <= traffic
- def getPassword(self):
+ def get_password(self):
"""
Get the password the user provided in the package
"""
return self.pyfile.package().password or ""
- def checkForSameFiles(self, starting=False):
+ def check_for_same_files(self, starting=False):
"""
Checks if same file was/is downloaded within same package
@@ -681,7 +681,7 @@ class Hoster(Plugin):
if os.path.exists(location):
self.skip(pyfile[0])
- self.logDebug("File %s not skipped, because it does not exists." % self.pyfile.name)
+ self.log_debug("File %s not skipped, because it does not exists." % self.pyfile.name)
def clean(self):
diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py
index 22b0fd7c6..623836cdc 100644
--- a/module/plugins/internal/MultiHook.py
+++ b/module/plugins/internal/MultiHook.py
@@ -11,7 +11,7 @@ from module.utils import decode, remove_chars
class MultiHook(Hook):
__name__ = "MultiHook"
__type__ = "hook"
- __version__ = "0.49"
+ __version__ = "0.50"
__config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
@@ -65,10 +65,10 @@ class MultiHook(Hook):
self.pluginname = None
self.plugintype = None
- self.initPlugin()
+ self.init_plugin()
- def initPlugin(self):
+ def init_plugin(self):
self.pluginname = self.__name__.rsplit("Hook", 1)[0]
plugin, self.plugintype = self.core.pluginManager.findPlugin(self.pluginname)
@@ -76,47 +76,47 @@ class MultiHook(Hook):
self.pluginmodule = self.core.pluginManager.loadModule(self.plugintype, self.pluginname)
self.pluginclass = getattr(self.pluginmodule, self.pluginname)
else:
- self.logWarning("Hook plugin will be deactivated due missing plugin reference")
- self.setConfig('activated', False)
+ self.log_warning("Hook plugin will be deactivated due missing plugin reference")
+ self.set_config('activated', False)
- def loadAccount(self):
+ def load_account(self):
self.account = self.core.accountManager.getAccountPlugin(self.pluginname)
if self.account and not self.account.canUse():
self.account = None
if not self.account and hasattr(self.pluginclass, "LOGIN_ACCOUNT") and self.pluginclass.LOGIN_ACCOUNT:
- self.logWarning("Hook plugin will be deactivated due missing account reference")
- self.setConfig('activated', False)
+ self.log_warning("Hook plugin will be deactivated due missing account reference")
+ self.set_config('activated', False)
def activate(self):
self.init_periodical(threaded=True)
- def pluginsCached(self):
+ def plugins_cached(self):
if self.plugins:
return self.plugins
for _i in xrange(2):
try:
- pluginset = self._pluginSet(self.getHosters())
+ pluginset = self._plugin_set(self.get_hosters())
break
except Exception, e:
- self.logDebug(e, "Waiting 1 minute and retry")
+ self.log_debug(e, "Waiting 1 minute and retry")
time.sleep(60)
else:
- self.logWarning(_("Fallback to default reload interval due plugin parse error"))
+ self.log_warning(_("Fallback to default reload interval due plugin parse error"))
self.interval = self.MIN_RELOAD_INTERVAL
return list()
try:
- configmode = self.getConfig('pluginmode', 'all')
+ configmode = self.get_config('pluginmode', 'all')
if configmode in ("listed", "unlisted"):
- pluginlist = self.getConfig('pluginlist', '').replace('|', ',').replace(';', ',').split(',')
- configset = self._pluginSet(pluginlist)
+ pluginlist = self.get_config('pluginlist', '').replace('|', ',').replace(';', ',').split(',')
+ configset = self._plugin_set(pluginlist)
if configmode == "listed":
pluginset &= configset
@@ -124,14 +124,14 @@ class MultiHook(Hook):
pluginset -= configset
except Exception, e:
- self.logError(e)
+ self.log_error(e)
self.plugins = list(pluginset)
return self.plugins
- def _pluginSet(self, plugins):
+ def _plugin_set(self, plugins):
regexp = re.compile(r'^[\w\-.^_]{3,63}\.[a-zA-Z]{2,}$', re.U)
plugins = [decode(p.strip()).lower() for p in plugins if regexp.match(p.strip())]
@@ -143,7 +143,7 @@ class MultiHook(Hook):
return set(plugins)
- def getHosters(self):
+ def get_hosters(self):
"""
Load list of supported hoster
@@ -156,15 +156,15 @@ class MultiHook(Hook):
"""
Reload plugin list periodically
"""
- self.loadAccount()
+ self.load_account()
- if self.getConfig('reload', True):
- self.interval = max(self.getConfig('reloadinterval', 12) * 60 * 60, self.MIN_RELOAD_INTERVAL)
+ if self.get_config('reload', True):
+ self.interval = max(self.get_config('reloadinterval', 12) * 60 * 60, self.MIN_RELOAD_INTERVAL)
else:
self.core.scheduler.removeJob(self.cb)
self.cb = None
- self.logInfo(_("Reloading supported %s list") % self.plugintype)
+ self.log_info(_("Reloading supported %s list") % self.plugintype)
old_supported = self.supported
@@ -172,17 +172,17 @@ class MultiHook(Hook):
self.new_supported = []
self.plugins = []
- self.overridePlugins()
+ self.override_plugins()
old_supported = [plugin for plugin in old_supported if plugin not in self.supported]
if old_supported:
- self.logDebug("Unload: %s" % ", ".join(old_supported))
+ self.log_debug("Unload: %s" % ", ".join(old_supported))
for plugin in old_supported:
- self.unloadPlugin(plugin)
+ self.unload_plugin(plugin)
- def overridePlugins(self):
+ def override_plugins(self):
excludedList = []
if self.plugintype == "hoster":
@@ -192,7 +192,7 @@ class MultiHook(Hook):
pluginMap = {}
accountList = [name[::-1].replace("Folder"[::-1], "", 1).lower()[::-1] for name in self.core.pluginManager.crypterPlugins.iterkeys()]
- for plugin in self.pluginsCached():
+ for plugin in self.plugins_cached():
name = remove_chars(plugin, "-.")
if name in accountList:
@@ -204,11 +204,11 @@ class MultiHook(Hook):
self.new_supported.append(plugin)
if not self.supported and not self.new_supported:
- self.logError(_("No %s loaded") % self.plugintype)
+ self.log_error(_("No %s loaded") % self.plugintype)
return
#: inject plugin plugin
- self.logDebug("Overwritten %ss: %s" % (self.plugintype, ", ".join(sorted(self.supported))))
+ self.log_debug("Overwritten %ss: %s" % (self.plugintype, ", ".join(sorted(self.supported))))
for plugin in self.supported:
hdict = self.core.pluginManager.plugins[self.plugintype][plugin]
@@ -216,26 +216,26 @@ class MultiHook(Hook):
hdict['new_name'] = self.pluginname
if excludedList:
- self.logInfo(_("%ss not overwritten: %s") % (self.plugintype.capitalize(), ", ".join(sorted(excludedList))))
+ self.log_info(_("%ss not overwritten: %s") % (self.plugintype.capitalize(), ", ".join(sorted(excludedList))))
if self.new_supported:
plugins = sorted(self.new_supported)
- self.logDebug("New %ss: %s" % (self.plugintype, ", ".join(plugins)))
+ self.log_debug("New %ss: %s" % (self.plugintype, ", ".join(plugins)))
#: create new regexp
regexp = r'.*(?P<DOMAIN>%s).*' % "|".join(x.replace('.', '\.') for x in plugins)
if hasattr(self.pluginclass, "__pattern__") and isinstance(self.pluginclass.__pattern__, basestring) and "://" in self.pluginclass.__pattern__:
regexp = r'%s|%s' % (self.pluginclass.__pattern__, regexp)
- self.logDebug("Regexp: %s" % regexp)
+ self.log_debug("Regexp: %s" % regexp)
hdict = self.core.pluginManager.plugins[self.plugintype][self.pluginname]
hdict['pattern'] = regexp
hdict['re'] = re.compile(regexp)
- def unloadPlugin(self, plugin):
+ def unload_plugin(self, plugin):
hdict = self.core.pluginManager.plugins[self.plugintype][plugin]
if "module" in hdict:
hdict.pop('module', None)
@@ -250,7 +250,7 @@ class MultiHook(Hook):
Remove override for all plugins. Scheduler job is removed by hookmanager
"""
for plugin in self.supported:
- self.unloadPlugin(plugin)
+ self.unload_plugin(plugin)
#: reset pattern
hdict = self.core.pluginManager.plugins[self.plugintype][self.pluginname]
diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py
index 2b3eb8941..8360d871e 100644
--- a/module/plugins/internal/MultiHoster.py
+++ b/module/plugins/internal/MultiHoster.py
@@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, r
class MultiHoster(SimpleHoster):
__name__ = "MultiHoster"
__type__ = "hoster"
- __version__ = "0.42"
+ __version__ = "0.43"
__pattern__ = r'^unmatchable$'
__config__ = [("use_premium" , "bool", "Use premium account if available" , True),
@@ -24,19 +24,19 @@ class MultiHoster(SimpleHoster):
def setup(self):
- self.chunkLimit = 1
- self.multiDL = bool(self.account)
- self.resumeDownload = self.premium
+ self.chunk_limit = 1
+ self.multi_dl = bool(self.account)
+ self.resume_download = self.premium
def prepare(self):
self.info = {}
self.html = ""
self.link = "" #@TODO: Move to Hoster in 0.4.10
- self.directDL = False #@TODO: Move to Hoster in 0.4.10
+ self.direct_d_l = False #@TODO: Move to Hoster in 0.4.10
- if not self.getConfig('use_premium', True):
- self.retryFree()
+ if not self.get_config('use_premium', True):
+ self.retry_free()
if self.LOGIN_ACCOUNT and not self.account:
self.fail(_("Required account not found"))
@@ -47,9 +47,9 @@ class MultiHoster(SimpleHoster):
set_cookies(self.req.cj, self.COOKIES)
if self.DIRECT_LINK is None:
- self.directDL = self.__pattern__ != r'^unmatchable$' and re.match(self.__pattern__, self.pyfile.url)
+ self.direct_d_l = self.__pattern__ != r'^unmatchable$' and re.match(self.__pattern__, self.pyfile.url)
else:
- self.directDL = self.DIRECT_LINK
+ self.direct_d_l = self.DIRECT_LINK
self.pyfile.url = replace_patterns(self.pyfile.url, self.URL_REPLACEMENTS)
@@ -58,36 +58,36 @@ class MultiHoster(SimpleHoster):
try:
self.prepare()
- if self.directDL:
- self.checkInfo()
- self.logDebug("Looking for direct download link...")
- self.handleDirect(pyfile)
+ if self.direct_d_l:
+ self.check_info()
+ self.log_debug("Looking for direct download link...")
+ self.handle_direct(pyfile)
- if not self.link and not self.lastDownload:
+ if not self.link and not self.last_download:
self.preload()
- self.checkErrors()
- self.checkStatus(getinfo=False)
+ self.check_errors()
+ self.check_status(getinfo=False)
- if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()):
- self.logDebug("Handled as premium download")
- self.handlePremium(pyfile)
+ if self.premium and (not self.CHECK_TRAFFIC or self.check_traffic_left()):
+ self.log_debug("Handled as premium download")
+ self.handle_premium(pyfile)
- elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.checkTrafficLeft()):
- self.logDebug("Handled as free download")
- self.handleFree(pyfile)
+ elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.check_traffic_left()):
+ self.log_debug("Handled as free download")
+ self.handle_free(pyfile)
self.download(self.link, ref=False, disposition=True)
- self.checkFile()
+ self.check_file()
except Fail, e: #@TODO: Move to PluginThread in 0.4.10
err = str(e) #@TODO: Recheck in 0.4.10
if self.premium:
- self.logWarning(_("Premium download failed"))
- self.retryFree()
+ self.log_warning(_("Premium download failed"))
+ self.retry_free()
- elif self.getConfig("revertfailed", True) \
+ elif self.get_config("revertfailed", True) \
and "new_module" in self.core.pluginManager.hosterPlugins[self.__name__]:
hdict = self.core.pluginManager.hosterPlugins[self.__name__]
@@ -107,11 +107,11 @@ class MultiHoster(SimpleHoster):
raise Fail(err)
- def handlePremium(self, pyfile):
- return self.handleFree(pyfile)
+ def handle_premium(self, pyfile):
+ return self.handle_free(pyfile)
- def handleFree(self, pyfile):
+ def handle_free(self, pyfile):
if self.premium:
raise NotImplementedError
else:
diff --git a/module/plugins/internal/OCR.py b/module/plugins/internal/OCR.py
index 0191a4938..880f8b570 100644
--- a/module/plugins/internal/OCR.py
+++ b/module/plugins/internal/OCR.py
@@ -20,7 +20,7 @@ from module.utils import save_join as fs_join
class OCR(Plugin):
__name__ = "OCR"
__type__ = "ocr"
- __version__ = "0.11"
+ __version__ = "0.12"
__description__ = """OCR base plugin"""
__license__ = "GPLv3"
@@ -71,7 +71,7 @@ class OCR(Plugin):
tmpTxt.close()
except IOError, e:
- self.logError(e)
+ self.log_error(e)
return
self.logger.debug("save tiff")
diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py
index 9b110280e..0b08858f3 100644
--- a/module/plugins/internal/Plugin.py
+++ b/module/plugins/internal/Plugin.py
@@ -25,12 +25,12 @@ def set_cookies(cj, cookies):
cj.setCookie(domain, name, value)
-def parseHtmlTagAttrValue(attr_name, tag):
+def parse_html_tag_attr_value(attr_name, tag):
m = re.search(r"%s\s*=\s*([\"']?)((?<=\")[^\"]+|(?<=')[^']+|[^>\s\"'][^>\s]*)\1" % attr_name, tag, re.I)
return m.group(2) if m else None
-def parseHtmlForm(attr_str, html, input_names={}):
+def parse_html_form(attr_str, html, input_names={}):
for form in re.finditer(r"(?P<TAG><form[^>]*%s[^>]*>)(?P<CONTENT>.*?)</?(form|body|html)[^>]*>" % attr_str,
html, re.S | re.I):
inputs = {}
@@ -78,7 +78,7 @@ def chunks(iterable, size):
class Plugin(object):
__name__ = "Plugin"
__type__ = "hoster"
- __version__ = "0.11"
+ __version__ = "0.12"
__pattern__ = r'^unmatchable$'
__config__ = [] #: [("name", "type", "desc", "default")]
@@ -106,28 +106,28 @@ class Plugin(object):
'msg' : msg or _(level.upper() + " MARK")})
- def logDebug(self, *args):
+ def log_debug(self, *args):
if self.core.debug:
return self._log("debug", args)
- def logInfo(self, *args):
+ def log_info(self, *args):
return self._log("info", args)
- def logWarning(self, *args):
+ def log_warning(self, *args):
return self._log("warning", args)
- def logError(self, *args):
+ def log_error(self, *args):
return self._log("error", args)
- def logCritical(self, *args):
+ def log_critical(self, *args):
return self._log("critical", args)
- def setConfig(self, option, value):
+ def set_config(self, option, value):
"""
Set config value for current plugin
@@ -138,15 +138,15 @@ class Plugin(object):
self.core.config.setPlugin(self.__name__, option, value)
- #: Deprecated method
+ #: Deprecated method, use `set_config` instead
def setConf(self, *args, **kwargs):
"""
- See `setConfig`
+ See `set_config`
"""
- return self.setConfig(*args, **kwargs)
+ return self.set_config(*args, **kwargs)
- def getConfig(self, option, default="", plugin=None):
+ def get_config(self, option, default="", plugin=None):
"""
Returns config value for current plugin
@@ -157,16 +157,16 @@ class Plugin(object):
return self.core.config.getPlugin(plugin or self.__name__, option)
except KeyError:
- self.logWarning(_("Config option or plugin not found"))
+ self.log_warning(_("Config option or plugin not found"))
return default
- #: Deprecated method
+ #: Deprecated method, use `get_config` instead
def getConf(self, *args, **kwargs):
"""
- See `getConfig`
+ See `get_config`
"""
- return self.getConfig(*args, **kwargs)
+ return self.get_config(*args, **kwargs)
def store(self, key, value):
@@ -176,10 +176,10 @@ class Plugin(object):
self.core.db.setStorage(self.__name__, key, value)
- #: Deprecated method
+ #: Deprecated method, use `store` instead
def setStorage(self, *args, **kwargs):
"""
- Same as `setStorage`
+ Same as `store`
"""
return self.store(*args, **kwargs)
@@ -191,21 +191,29 @@ class Plugin(object):
return self.core.db.getStorage(self.__name__, key) or default
- #: Deprecated method
+ #: Deprecated method, use `retrieve` instead
def getStorage(self, *args, **kwargs):
"""
- Same as `getStorage`
+ Same as `retrieve`
"""
return self.retrieve(*args, **kwargs)
- def delStorage(self, key):
+ def delete(self, key):
"""
Delete entry in db
"""
self.core.db.delStorage(self.__name__, key)
+ #: Deprecated method, use `delete` instead
+ def delStorage(self, *args, **kwargs):
+ """
+ Same as `delete`
+ """
+ return self.delete(*args, **kwargs)
+
+
def fail(self, reason):
"""
Fail and give reason
@@ -250,7 +258,7 @@ class Plugin(object):
self.fail(_("No url given"))
if self.core.debug:
- self.logDebug("Load url: " + url, *["%s=%s" % (key, val) for key, val in locals().iteritems() if key not in ("self", "url")])
+ self.log_debug("Load url: " + url, *["%s=%s" % (key, val) for key, val in locals().iteritems() if key not in ("self", "url")])
if req is None:
if hasattr(self, "req"):
@@ -274,7 +282,7 @@ class Plugin(object):
del frame #: delete the frame or it wont be cleaned
f.write(res.encode('utf8'))
except IOError, e:
- self.logError(e)
+ self.log_error(e)
if just_header:
#: parse header
@@ -297,4 +305,4 @@ class Plugin(object):
header[key] = value
res = header
- return res \ No newline at end of file
+ return res
diff --git a/module/plugins/internal/ReCaptcha.py b/module/plugins/internal/ReCaptcha.py
index 40faff5f0..79bda9051 100644
--- a/module/plugins/internal/ReCaptcha.py
+++ b/module/plugins/internal/ReCaptcha.py
@@ -13,7 +13,7 @@ from module.plugins.internal.Captcha import Captcha
class ReCaptcha(Captcha):
__name__ = "ReCaptcha"
__type__ = "captcha"
- __version__ = "0.17"
+ __version__ = "0.18"
__description__ = """ReCaptcha captcha service plugin"""
__license__ = "GPLv3"
@@ -32,10 +32,10 @@ class ReCaptcha(Captcha):
m = re.search(self.KEY_V2_PATTERN, html) or re.search(self.KEY_V1_PATTERN, html)
if m:
self.key = m.group(1).strip()
- self.logDebug("Key: %s" % self.key)
+ self.log_debug("Key: %s" % self.key)
return self.key
else:
- self.logWarning("Key pattern not found")
+ self.log_warning("Key pattern not found")
return None
@@ -60,7 +60,7 @@ class ReCaptcha(Captcha):
except AttributeError:
self.fail(_("ReCaptcha challenge pattern not found"))
- self.logDebug("Challenge: %s" % challenge)
+ self.log_debug("Challenge: %s" % challenge)
return self.result(server, challenge, key)
@@ -79,50 +79,50 @@ class ReCaptcha(Captcha):
except AttributeError:
self.fail(_("ReCaptcha second challenge pattern not found"))
- self.logDebug("Second challenge: %s" % challenge)
+ self.log_debug("Second challenge: %s" % challenge)
result = self.plugin.decryptCaptcha("%simage" % server,
get={'c': challenge},
cookies=True,
forceUser=True,
imgtype="jpg")
- self.logDebug("Result: %s" % result)
+ self.log_debug("Result: %s" % result)
return result, challenge
- def _collectApiInfo(self):
+ def _collect_api_info(self):
html = self.plugin.load("http://www.google.com/recaptcha/api.js")
a = re.search(r'po.src = \'(.*?)\';', html).group(1)
vers = a.split("/")[5]
- self.logDebug("API version: %s" % vers)
+ self.log_debug("API version: %s" % vers)
language = a.split("__")[1].split(".")[0]
- self.logDebug("API language: %s" % language)
+ self.log_debug("API language: %s" % language)
html = self.plugin.load("https://apis.google.com/js/api.js")
b = re.search(r'"h":"(.*?)","', html).group(1)
jsh = b.decode('unicode-escape')
- self.logDebug("API jsh-string: %s" % jsh)
+ self.log_debug("API jsh-string: %s" % jsh)
return vers, language, jsh
- def _prepareTimeAndRpc(self):
+ def _prepare_time_and_rpc(self):
self.plugin.load("http://www.google.com/recaptcha/api2/demo")
millis = int(round(time.time() * 1000))
- self.logDebug("Time: %s" % millis)
+ self.log_debug("Time: %s" % millis)
rand = random.randint(1, 99999999)
a = "0.%s" % str(rand * 2147483647)
rpc = int(100000000 * float(a))
- self.logDebug("Rpc-token: %s" % rpc)
+ self.log_debug("Rpc-token: %s" % rpc)
return millis, rpc
@@ -136,8 +136,8 @@ class ReCaptcha(Captcha):
parent = ""
botguardstring = "!A"
- vers, language, jsh = self._collectApiInfo()
- millis, rpc = self._prepareTimeAndRpc()
+ vers, language, jsh = self._collect_api_info()
+ millis, rpc = self._prepare_time_and_rpc()
html = self.plugin.load("https://www.google.com/recaptcha/api2/anchor",
get={'k' : key,
@@ -150,7 +150,7 @@ class ReCaptcha(Captcha):
'rpctoken': rpc})
token1 = re.search(r'id="recaptcha-token" value="(.*?)">', html)
- self.logDebug("Token #1: %s" % token1.group(1))
+ self.log_debug("Token #1: %s" % token1.group(1))
html = self.plugin.load("https://www.google.com/recaptcha/api2/frame",
get={'c' : token1.group(1),
@@ -163,10 +163,10 @@ class ReCaptcha(Captcha):
decode="unicode-escape")
token2 = re.search(r'"finput","(.*?)",', html)
- self.logDebug("Token #2: %s" % token2.group(1))
+ self.log_debug("Token #2: %s" % token2.group(1))
token3 = re.search(r'"rresp","(.*?)",', html)
- self.logDebug("Token #3: %s" % token3.group(1))
+ self.log_debug("Token #3: %s" % token3.group(1))
millis_captcha_loading = int(round(time.time() * 1000))
captcha_response = self.plugin.decryptCaptcha("https://www.google.com/recaptcha/api2/payload",
@@ -175,7 +175,7 @@ class ReCaptcha(Captcha):
forceUser=True)
response = b64encode('{"response":"%s"}' % captcha_response)
- self.logDebug("Result: %s" % response)
+ self.log_debug("Result: %s" % response)
timeToSolve = int(round(time.time() * 1000)) - millis_captcha_loading
timeToSolveMore = timeToSolve + int(float("0." + str(random.randint(1, 99999999))) * 500)
@@ -189,7 +189,7 @@ class ReCaptcha(Captcha):
'bg' : botguardstring})
token4 = re.search(r'"uvresp","(.*?)",', html)
- self.logDebug("Token #4: %s" % token4.group(1))
+ self.log_debug("Token #4: %s" % token4.group(1))
result = token4.group(1)
diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py
index 147ac6bd4..86ff5156e 100644
--- a/module/plugins/internal/SevenZip.py
+++ b/module/plugins/internal/SevenZip.py
@@ -10,7 +10,7 @@ from module.utils import fs_encode, save_join as fs_join
class SevenZip(UnRar):
__name__ = "SevenZip"
- __version__ = "0.11"
+ __version__ = "0.12"
__description__ = """7-Zip extractor plugin"""
__license__ = "GPLv3"
@@ -37,7 +37,7 @@ class SevenZip(UnRar):
@classmethod
- def isUsable(cls):
+ def is_usable(cls):
if os.name == "nt":
cls.CMD = os.path.join(pypath, "7z.exe")
p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -134,11 +134,11 @@ class SevenZip(UnRar):
def call_cmd(self, command, *xargs, **kwargs):
args = []
- #overwrite flag
+ # overwrite flag
if self.overwrite:
args.append("-y")
- #set a password
+ # set a password
if "password" in kwargs and kwargs['password']:
args.append("-p%s" % kwargs['password'])
else:
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py
index 7685be55a..fe47178e3 100644
--- a/module/plugins/internal/SimpleCrypter.py
+++ b/module/plugins/internal/SimpleCrypter.py
@@ -10,7 +10,7 @@ from module.utils import fixup, html_unescape
class SimpleCrypter(Crypter, SimpleHoster):
__name__ = "SimpleCrypter"
__type__ = "crypter"
- __version__ = "0.55"
+ __version__ = "0.56"
__pattern__ = r'^unmatchable$'
__config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides core.config['general']['folder_per_package']
@@ -47,7 +47,7 @@ class SimpleCrypter(Crypter, SimpleHoster):
and its loadPage method:
- def loadPage(self, page_n):
+ def load_page(self, page_n):
return the html of the page number page_n
"""
#@TODO: Remove in 0.4.10
@@ -85,10 +85,10 @@ class SimpleCrypter(Crypter, SimpleHoster):
self.pyfile.url = replace_patterns(self.pyfile.url, self.URL_REPLACEMENTS)
- def handleDirect(self, pyfile):
- for i in xrange(self.getConfig("maxredirs", plugin="UserAgentSwitcher")):
+ def handle_direct(self, pyfile):
+ for i in xrange(self.get_config("maxredirs", plugin="UserAgentSwitcher")):
redirect = self.link or pyfile.url
- self.logDebug("Redirect #%d to: %s" % (i, redirect))
+ self.log_debug("Redirect #%d to: %s" % (i, redirect))
header = self.load(redirect, just_header=True)
if 'location' in header and header['location']:
@@ -96,38 +96,38 @@ class SimpleCrypter(Crypter, SimpleHoster):
else:
break
else:
- self.logError(_("Too many redirects"))
+ self.log_error(_("Too many redirects"))
def decrypt(self, pyfile):
self.prepare()
- self.logDebug("Looking for link redirect...")
- self.handleDirect(pyfile)
+ self.log_debug("Looking for link redirect...")
+ self.handle_direct(pyfile)
if self.link:
self.urls = [self.link]
else:
self.preload()
- self.checkInfo()
+ self.check_info()
- self.links = self.getLinks() or list()
+ self.links = self.get_links() or list()
if hasattr(self, 'PAGES_PATTERN') and hasattr(self, 'loadPage'):
- self.handlePages(pyfile)
+ self.handle_pages(pyfile)
- self.logDebug("Package has %d links" % len(self.links))
+ self.log_debug("Package has %d links" % len(self.links))
if self.links:
self.packages = [(self.info['name'], self.links, self.info['folder'])]
- def checkNameSize(self, getinfo=True):
+ def check_name_size(self, getinfo=True):
if not self.info or getinfo:
- self.logDebug("File info (BEFORE): %s" % self.info)
- self.info.update(self.getInfo(self.pyfile.url, self.html))
- self.logDebug("File info (AFTER): %s" % self.info)
+ self.log_debug("File info (BEFORE): %s" % self.info)
+ self.info.update(self.get_info(self.pyfile.url, self.html))
+ self.log_debug("File info (AFTER): %s" % self.info)
try:
url = self.info['url'].strip()
@@ -144,11 +144,11 @@ class SimpleCrypter(Crypter, SimpleHoster):
except Exception:
pass
- self.logDebug("File name: %s" % self.pyfile.name,
+ self.log_debug("File name: %s" % self.pyfile.name,
"File folder: %s" % self.pyfile.name)
- def getLinks(self):
+ def get_links(self):
"""
Returns the links extracted from self.html
You should override this only if it's impossible to extract links using only the LINK_PATTERN.
@@ -156,12 +156,12 @@ class SimpleCrypter(Crypter, SimpleHoster):
return re.findall(self.LINK_PATTERN, self.html)
- def handlePages(self, pyfile):
+ def handle_pages(self, pyfile):
try:
pages = int(re.search(self.PAGES_PATTERN, self.html).group(1))
except Exception:
pages = 1
for p in xrange(2, pages + 1):
- self.html = self.loadPage(p)
- self.links += self.getLinks()
+ self.html = self.load_page(p)
+ self.links += self.get_links()
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index 067b97747..2e31c1176 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -25,7 +25,7 @@ statusMap = dict((v, k) for k, v in _statusMap.iteritems())
#@TODO: Remove in 0.4.10
def parseFileInfo(plugin, url="", html=""):
if hasattr(plugin, "getInfo"):
- info = plugin.getInfo(url, html)
+ info = plugin.get_info(url, html)
res = info['name'], info['size'], info['status'], info['url']
else:
url = urllib.unquote(url)
@@ -42,7 +42,7 @@ def parseFileInfo(plugin, url="", html=""):
#@TODO: Remove in 0.4.10
def create_getInfo(plugin):
- def getInfo(urls):
+ def get_info(urls):
for url in urls:
if hasattr(plugin, "URL_REPLACEMENTS"):
url = replace_patterns(url, plugin.URL_REPLACEMENTS)
@@ -55,7 +55,7 @@ def timestamp():
return int(time.time() * 1000)
-def secondsToMidnight(gmt=0):
+def seconds_to_midnight(gmt=0):
now = datetime.datetime.utcnow() + datetime.timedelta(hours=gmt)
if now.hour is 0 and now.minute < 10:
@@ -76,7 +76,7 @@ def secondsToMidnight(gmt=0):
class SimpleHoster(Hoster):
__name__ = "SimpleHoster"
__type__ = "hoster"
- __version__ = "1.69"
+ __version__ = "1.70"
__pattern__ = r'^unmatchable$'
__config__ = [("use_premium", "bool", "Use premium account if available" , True),
@@ -132,7 +132,7 @@ class SimpleHoster(Hoster):
example: ERROR_PATTERN = r''
- Instead overriding handleFree and handlePremium methods you may define the following patterns for basic link handling:
+ Instead overriding handle_free and handle_premium methods you may define the following patterns for basic link handling:
LINK_PATTERN: (optional) group(1) should be the direct link for free and premium download
example: LINK_PATTERN = r'<div class="link"><a href="(.+?)"'
@@ -154,18 +154,18 @@ class SimpleHoster(Hoster):
CHECK_FILE = True #: Set to False to not check the last downloaded file with declared error patterns
CHECK_TRAFFIC = False #: Set to True to force checking traffic left for premium account
COOKIES = True #: or False or list of tuples [(domain, name, value)]
- DIRECT_LINK = None #: Set to True to looking for direct link (as defined in handleDirect method), set to None to do it if self.account is True else False
+ DIRECT_LINK = None #: Set to True to looking for direct link (as defined in handle_direct method), set to None to do it if self.account is True else False
DISPOSITION = True #: Set to True to use any content-disposition value in http header as file name
LOGIN_ACCOUNT = False #: Set to True to require account login
LOGIN_PREMIUM = False #: Set to True to require premium account login
- MULTI_HOSTER = False #: Set to True to leech other hoster link (as defined in handleMulti method)
+ MULTI_HOSTER = False #: Set to True to leech other hoster link (as defined in handle_multi method)
TEXT_ENCODING = True #: Set to encoding name if encoding value in http header is not correct
LINK_PATTERN = None
@classmethod
- def apiInfo(cls, url):
+ def api_info(cls, url):
url = urllib.unquote(url)
url_p = urlparse.urlparse(url)
return {'name' : (url_p.path.split('/')[-1]
@@ -177,8 +177,8 @@ class SimpleHoster(Hoster):
@classmethod
- def getInfo(cls, url="", html=""):
- info = cls.apiInfo(url)
+ def get_info(cls, url="", html=""):
+ info = cls.api_info(url)
online = True if info['status'] is 2 else False
try:
@@ -257,7 +257,7 @@ class SimpleHoster(Hoster):
def setup(self):
- self.resumeDownload = self.multiDL = self.premium
+ self.resume_download = self.multi_dl = self.premium
def prepare(self):
@@ -266,11 +266,11 @@ class SimpleHoster(Hoster):
self.info = {}
self.html = "" #@TODO: Recheck in 0.4.10
self.link = "" #@TODO: Recheck in 0.4.10
- self.directDL = False
+ self.direct_d_l = False
self.multihost = False
- if not self.getConfig('use_premium', True):
- self.retryFree()
+ if not self.get_config('use_premium', True):
+ self.retry_free()
if self.LOGIN_PREMIUM and not self.premium:
self.fail(_("Required premium account not found"))
@@ -297,9 +297,9 @@ class SimpleHoster(Hoster):
return
if self.DIRECT_LINK is None:
- self.directDL = bool(self.account)
+ self.direct_d_l = bool(self.account)
else:
- self.directDL = self.DIRECT_LINK
+ self.direct_d_l = self.DIRECT_LINK
self.pyfile.url = replace_patterns(self.pyfile.url, self.URL_REPLACEMENTS)
@@ -314,87 +314,87 @@ class SimpleHoster(Hoster):
def process(self, pyfile):
try:
self.prepare()
- self.checkInfo()
+ self.check_info()
- if self.directDL:
- self.logDebug("Looking for direct download link...")
- self.handleDirect(pyfile)
+ if self.direct_d_l:
+ self.log_debug("Looking for direct download link...")
+ self.handle_direct(pyfile)
- if self.multihost and not self.link and not self.lastDownload:
- self.logDebug("Looking for leeched download link...")
- self.handleMulti(pyfile)
+ if self.multihost and not self.link and not self.last_download:
+ self.log_debug("Looking for leeched download link...")
+ self.handle_multi(pyfile)
- if not self.link and not self.lastDownload:
+ if not self.link and not self.last_download:
self.MULTI_HOSTER = False
self.retry(1, reason=_("Multi hoster fails"))
- if not self.link and not self.lastDownload:
+ if not self.link and not self.last_download:
self.preload()
- self.checkInfo()
+ self.check_info()
- if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()):
- self.logDebug("Handled as premium download")
- self.handlePremium(pyfile)
+ if self.premium and (not self.CHECK_TRAFFIC or self.check_traffic_left()):
+ self.log_debug("Handled as premium download")
+ self.handle_premium(pyfile)
- elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.checkTrafficLeft()):
- self.logDebug("Handled as free download")
- self.handleFree(pyfile)
+ elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.check_traffic_left()):
+ self.log_debug("Handled as free download")
+ self.handle_free(pyfile)
self.download(self.link, ref=False, disposition=self.DISPOSITION)
- self.checkFile()
+ self.check_file()
except Fail, e: #@TODO: Move to PluginThread in 0.4.10
err = str(e) #@TODO: Recheck in 0.4.10
if err == _("No captcha result obtained in appropiate time by any of the plugins."): #@TODO: Fix in 0.4.10
- self.checkFile()
+ self.check_file()
- elif self.getConfig('fallback', True) and self.premium:
- self.logWarning(_("Premium download failed"), e)
- self.retryFree()
+ elif self.get_config('fallback', True) and self.premium:
+ self.log_warning(_("Premium download failed"), e)
+ self.retry_free()
else:
raise Fail(err)
- def checkFile(self):
- lastDownload = fs_encode(self.lastDownload)
+ def check_file(self):
+ lastDownload = fs_encode(self.last_download)
- if self.cTask and not self.lastDownload:
- self.invalidCaptcha()
+ if self.c_task and not self.last_download:
+ self.invalid_captcha()
self.retry(10, reason=_("Wrong captcha"))
- elif self.checkDownload({'Empty file': re.compile(r'\A((.|)(\2|\s)*)\Z')}, file_size=self.info['size']):
+ elif self.check_download({'Empty file': re.compile(r'\A((.|)(\2|\s)*)\Z')}, file_size=self.info['size']):
self.error(_("Empty file"))
else:
- self.logDebug("Checking last downloaded file with built-in rules")
+ self.log_debug("Checking last downloaded file with built-in rules")
for r, p in self.FILE_ERRORS:
- errmsg = self.checkDownload({r: re.compile(p)})
+ errmsg = self.check_download({r: re.compile(p)})
if errmsg is not None:
errmsg = errmsg.strip().capitalize()
try:
- errmsg += " | " + self.lastCheck.group(1).strip()
+ errmsg += " | " + self.last_check.group(1).strip()
except Exception:
pass
- self.logWarning("Check result: " + errmsg, "Waiting 1 minute and retry")
- self.wantReconnect = True
+ self.log_warning("Check result: " + errmsg, "Waiting 1 minute and retry")
+ self.want_reconnect = True
self.retry(wait_time=60, reason=errmsg)
else:
if self.CHECK_FILE:
- self.logDebug("Checking last downloaded file with custom rules")
+ self.log_debug("Checking last downloaded file with custom rules")
with open(lastDownload, "rb") as f:
self.html = f.read(50000) #@TODO: Recheck in 0.4.10
- self.checkErrors()
+ self.check_errors()
- self.logDebug("No file errors found")
+ self.log_debug("No file errors found")
- def checkErrors(self):
+ def check_errors(self):
if not self.html:
- self.logWarning(_("No html code to check"))
+ self.log_warning(_("No html code to check"))
return
if hasattr(self, 'IP_BLOCKED_PATTERN') and re.search(self.IP_BLOCKED_PATTERN, self.html):
@@ -415,19 +415,19 @@ class SimpleHoster(Hoster):
errmsg = m.group(0).strip()
self.info['error'] = re.sub(r'<.*?>', " ", errmsg)
- self.logWarning(self.info['error'])
+ self.log_warning(self.info['error'])
if re.search('da(il)?y|today', errmsg, re.I):
- wait_time = secondsToMidnight(gmt=2)
+ wait_time = seconds_to_midnight(gmt=2)
else:
wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1, "": 1}[u.lower()] for v, u in
re.findall(r'(\d+)\s*(hr|hour|min|sec|)', errmsg, re.I))
- self.wantReconnect = wait_time > 300
+ self.want_reconnect = wait_time > 300
self.retry(1, wait_time, _("Download limit exceeded"))
if hasattr(self, 'HAPPY_HOUR_PATTERN') and re.search(self.HAPPY_HOUR_PATTERN, self.html):
- self.multiDL = True
+ self.multi_dl = True
if hasattr(self, 'ERROR_PATTERN'):
m = re.search(self.ERROR_PATTERN, self.html)
@@ -438,30 +438,30 @@ class SimpleHoster(Hoster):
errmsg = m.group(0).strip()
self.info['error'] = re.sub(r'<.*?>', " ", errmsg)
- self.logWarning(self.info['error'])
+ self.log_warning(self.info['error'])
if re.search('limit|wait|slot', errmsg, re.I):
if re.search("da(il)?y|today", errmsg):
- wait_time = secondsToMidnight(gmt=2)
+ wait_time = seconds_to_midnight(gmt=2)
else:
wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1, "": 1}[u.lower()] for v, u in
re.findall(r'(\d+)\s*(hr|hour|min|sec|)', errmsg, re.I))
- self.wantReconnect = wait_time > 300
+ self.want_reconnect = wait_time > 300
self.retry(1, wait_time, _("Download limit exceeded"))
elif re.search('country|ip|region|nation', errmsg, re.I):
self.fail(_("Connection from your current IP address is not allowed"))
elif re.search('captcha|code', errmsg, re.I):
- self.invalidCaptcha()
+ self.invalid_captcha()
self.retry(10, reason=_("Wrong captcha"))
elif re.search('countdown|expired', errmsg, re.I):
self.retry(10, 60, _("Link expired"))
elif re.search('maintenance|maintainance|temp', errmsg, re.I):
- self.tempOffline()
+ self.temp_offline()
elif re.search('up to|size', errmsg, re.I):
self.fail(_("File too large for free download"))
@@ -478,7 +478,7 @@ class SimpleHoster(Hoster):
self.fail(_("File can be downloaded by premium users only"))
else:
- self.wantReconnect = True
+ self.want_reconnect = True
self.retry(wait_time=60, reason=errmsg)
elif hasattr(self, 'WAIT_PATTERN'):
@@ -496,12 +496,12 @@ class SimpleHoster(Hoster):
self.info.pop('error', None)
- def checkStatus(self, getinfo=True):
+ def check_status(self, getinfo=True):
if not self.info or getinfo:
- self.logDebug("Update file info...")
- self.logDebug("Previous file info: %s" % self.info)
- self.info.update(self.getInfo(self.pyfile.url, self.html))
- self.logDebug("Current file info: %s" % self.info)
+ self.log_debug("Update file info...")
+ self.log_debug("Previous file info: %s" % self.info)
+ self.info.update(self.get_info(self.pyfile.url, self.html))
+ self.log_debug("Current file info: %s" % self.info)
try:
status = self.info['status']
@@ -510,21 +510,21 @@ class SimpleHoster(Hoster):
self.offline()
elif status is 6:
- self.tempOffline()
+ self.temp_offline()
elif status is 8:
self.fail(self.info['error'] if 'error' in self.info else _("Failed"))
finally:
- self.logDebug("File status: %s" % statusMap[status])
+ self.log_debug("File status: %s" % statusMap[status])
- def checkNameSize(self, getinfo=True):
+ def check_name_size(self, getinfo=True):
if not self.info or getinfo:
- self.logDebug("Update file info...")
- self.logDebug("Previous file info: %s" % self.info)
- self.info.update(self.getInfo(self.pyfile.url, self.html))
- self.logDebug("Current file info: %s" % self.info)
+ self.log_debug("Update file info...")
+ self.log_debug("Previous file info: %s" % self.info)
+ self.info.update(self.get_info(self.pyfile.url, self.html))
+ self.log_debug("Current file info: %s" % self.info)
try:
url = self.info['url'].strip()
@@ -543,44 +543,44 @@ class SimpleHoster(Hoster):
except Exception:
pass
- self.logDebug("File name: %s" % self.pyfile.name,
+ self.log_debug("File name: %s" % self.pyfile.name,
"File size: %s byte" % self.pyfile.size if self.pyfile.size > 0 else "File size: Unknown")
- def checkInfo(self):
- self.checkNameSize()
+ def check_info(self):
+ self.check_name_size()
if self.html:
- self.checkErrors()
- self.checkNameSize()
+ self.check_errors()
+ self.check_name_size()
- self.checkStatus(getinfo=False)
+ self.check_status(getinfo=False)
- #: Deprecated
+ #: Deprecated method
def getFileInfo(self):
self.info = {}
- self.checkInfo()
+ self.check_info()
return self.info
- def handleDirect(self, pyfile):
- link = self.directLink(pyfile.url, self.resumeDownload)
+ def handle_direct(self, pyfile):
+ link = self.direct_link(pyfile.url, self.resume_download)
if link:
- self.logInfo(_("Direct download link detected"))
+ self.log_info(_("Direct download link detected"))
self.link = link
else:
- self.logDebug("Direct download link not found")
+ self.log_debug("Direct download link not found")
- def handleMulti(self, pyfile): #: Multi-hoster handler
+ def handle_multi(self, pyfile): #: Multi-hoster handler
pass
- def handleFree(self, pyfile):
+ def handle_free(self, pyfile):
if not hasattr(self, 'LINK_FREE_PATTERN'):
- self.logError(_("Free download not implemented"))
+ self.log_error(_("Free download not implemented"))
m = re.search(self.LINK_FREE_PATTERN, self.html)
if m is None:
@@ -589,11 +589,11 @@ class SimpleHoster(Hoster):
self.link = m.group(1)
- def handlePremium(self, pyfile):
+ def handle_premium(self, pyfile):
if not hasattr(self, 'LINK_PREMIUM_PATTERN'):
- self.logError(_("Premium download not implemented"))
- self.logDebug("Handled as free download")
- self.handleFree(pyfile)
+ self.log_error(_("Premium download not implemented"))
+ self.log_debug("Handled as free download")
+ self.handle_free(pyfile)
m = re.search(self.LINK_PREMIUM_PATTERN, self.html)
if m is None:
@@ -602,7 +602,7 @@ class SimpleHoster(Hoster):
self.link = m.group(1)
- def retryFree(self):
+ def retry_free(self):
if not self.premium:
return
self.premium = False
diff --git a/module/plugins/internal/SolveMedia.py b/module/plugins/internal/SolveMedia.py
index dde6223ed..927d4e536 100644
--- a/module/plugins/internal/SolveMedia.py
+++ b/module/plugins/internal/SolveMedia.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Captcha import Captcha
class SolveMedia(Captcha):
__name__ = "SolveMedia"
__type__ = "captcha"
- __version__ = "0.14"
+ __version__ = "0.15"
__description__ = """SolveMedia captcha service plugin"""
__license__ = "GPLv3"
@@ -25,10 +25,10 @@ class SolveMedia(Captcha):
m = re.search(self.KEY_PATTERN, html)
if m:
self.key = m.group(1).strip()
- self.logDebug("Key: %s" % self.key)
+ self.log_debug("Key: %s" % self.key)
return self.key
else:
- self.logWarning("Key pattern not found")
+ self.log_warning("Key pattern not found")
return None
@@ -43,7 +43,7 @@ class SolveMedia(Captcha):
magic = re.search(r'name="magic" value="(.+?)"', html).group(1)
except AttributeError:
- self.logWarning("Magic pattern not found")
+ self.log_warning("Magic pattern not found")
magic = None
try:
@@ -54,13 +54,13 @@ class SolveMedia(Captcha):
self.fail(_("SolveMedia challenge pattern not found"))
else:
- self.logDebug("Challenge: %s" % challenge)
+ self.log_debug("Challenge: %s" % challenge)
try:
result = self.result("http://api.solvemedia.com/papi/media", challenge)
except Fail, e:
- self.logWarning(e)
+ self.log_warning(e)
self.plugin.invalidCaptcha()
result = None
@@ -81,8 +81,8 @@ class SolveMedia(Captcha):
else:
if "error" in html:
- self.logWarning("Captcha code was invalid")
- self.logDebug("Retry #%d" % i)
+ self.log_warning("Captcha code was invalid")
+ self.log_debug("Retry #%d" % i)
html = self.plugin.load(redirect)
else:
break
@@ -99,6 +99,6 @@ class SolveMedia(Captcha):
cookies=True,
imgtype="gif")
- self.logDebug("Result: %s" % result)
+ self.log_debug("Result: %s" % result)
return result
diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py
index 25a8a52de..4494b98c6 100644
--- a/module/plugins/internal/UnRar.py
+++ b/module/plugins/internal/UnRar.py
@@ -22,7 +22,7 @@ def renice(pid, value):
class UnRar(Extractor):
__name__ = "UnRar"
- __version__ = "1.20"
+ __version__ = "1.21"
__description__ = """Rar extractor plugin"""
__license__ = "GPLv3"
@@ -48,7 +48,7 @@ class UnRar(Extractor):
@classmethod
- def isUsable(cls):
+ def is_usable(cls):
if os.name == "nt":
try:
cls.CMD = os.path.join(pypath, "RAR.exe")
@@ -79,7 +79,7 @@ class UnRar(Extractor):
@classmethod
- def isMultipart(cls, filename):
+ def is_multipart(cls, filename):
return True if cls.re_multipart.search(filename) else False
@@ -131,7 +131,7 @@ class UnRar(Extractor):
break
#: reading a percentage sign -> set progress and restart
if c == '%':
- self.notifyProgress(int(s))
+ self.notify_progress(int(s))
s = ""
#: not reading a digit -> therefore restart
elif c not in digits:
@@ -168,14 +168,14 @@ class UnRar(Extractor):
self.files = self.list(password)
- def getDeleteFiles(self):
+ def get_delete_files(self):
dir, name = os.path.split(self.filename)
#: actually extracted file
files = [self.filename]
#: eventually Multipart Files
- files.extend(fs_join(dir, os.path.basename(file)) for file in filter(self.isMultipart, os.listdir(dir))
+ files.extend(fs_join(dir, os.path.basename(file)) for file in filter(self.is_multipart, os.listdir(dir))
if re.sub(self.re_multipart,".rar",name) == re.sub(self.re_multipart,".rar",file))
return files
diff --git a/module/plugins/internal/UnZip.py b/module/plugins/internal/UnZip.py
index 4c18a0e35..c2eb522a8 100644
--- a/module/plugins/internal/UnZip.py
+++ b/module/plugins/internal/UnZip.py
@@ -12,7 +12,7 @@ from module.utils import fs_encode
class UnZip(Extractor):
__name__ = "UnZip"
- __version__ = "1.12"
+ __version__ = "1.13"
__description__ = """Zip extractor plugin"""
__license__ = "GPLv3"
@@ -24,7 +24,7 @@ class UnZip(Extractor):
@classmethod
- def isUsable(cls):
+ def is_usable(cls):
return sys.version_info[:2] >= (2, 6)
diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py
index c26a91775..fb2302f4c 100644
--- a/module/plugins/internal/XFSAccount.py
+++ b/module/plugins/internal/XFSAccount.py
@@ -11,7 +11,7 @@ from module.plugins.internal.Plugin import parseHtmlForm, set_cookies
class XFSAccount(Account):
__name__ = "XFSAccount"
__type__ = "account"
- __version__ = "0.38"
+ __version__ = "0.39"
__description__ = """XFileSharing account plugin"""
__license__ = "GPLv3"
@@ -40,7 +40,7 @@ class XFSAccount(Account):
def init(self):
if not self.HOSTER_DOMAIN:
- self.logError(_("Missing HOSTER_DOMAIN"))
+ self.log_error(_("Missing HOSTER_DOMAIN"))
self.COOKIES = False
else:
@@ -52,7 +52,7 @@ class XFSAccount(Account):
set_cookies(req.cj, self.COOKIES)
- def loadAccountInfo(self, user, req):
+ def load_account_info(self, user, req):
validuntil = None
trafficleft = None
leechtraffic = None
@@ -71,16 +71,16 @@ class XFSAccount(Account):
m = re.search(self.VALID_UNTIL_PATTERN, html)
if m:
expiredate = m.group(1).strip()
- self.logDebug("Expire date: " + expiredate)
+ self.log_debug("Expire date: " + expiredate)
try:
validuntil = time.mktime(time.strptime(expiredate, "%d %B %Y"))
except Exception, e:
- self.logError(e)
+ self.log_error(e)
else:
- self.logDebug("Valid until: %s" % validuntil)
+ self.log_debug("Valid until: %s" % validuntil)
if validuntil > time.mktime(time.gmtime()):
premium = True
@@ -89,7 +89,7 @@ class XFSAccount(Account):
premium = False
validuntil = None #: registered account type (not premium)
else:
- self.logDebug("VALID_UNTIL_PATTERN not found")
+ self.log_debug("VALID_UNTIL_PATTERN not found")
m = re.search(self.TRAFFIC_LEFT_PATTERN, html)
if m:
@@ -109,12 +109,12 @@ class XFSAccount(Account):
else:
unit = ""
- trafficleft = self.parseTraffic(size + unit)
+ trafficleft = self.parse_traffic(size + unit)
except Exception, e:
- self.logError(e)
+ self.log_error(e)
else:
- self.logDebug("TRAFFIC_LEFT_PATTERN not found")
+ self.log_debug("TRAFFIC_LEFT_PATTERN not found")
leech = [m.groupdict() for m in re.finditer(self.LEECH_TRAFFIC_PATTERN, html)]
if leech:
@@ -136,12 +136,12 @@ class XFSAccount(Account):
else:
unit = ""
- leechtraffic += self.parseTraffic(size + unit)
+ leechtraffic += self.parse_traffic(size + unit)
except Exception, e:
- self.logError(e)
+ self.log_error(e)
else:
- self.logDebug("LEECH_TRAFFIC_PATTERN not found")
+ self.log_debug("LEECH_TRAFFIC_PATTERN not found")
return {'validuntil' : validuntil,
'trafficleft' : trafficleft,
@@ -173,4 +173,4 @@ class XFSAccount(Account):
html = self.load(url, post=inputs, req=req)
if re.search(self.LOGIN_FAIL_PATTERN, html):
- self.wrongPassword()
+ self.wrong_password()
diff --git a/module/plugins/internal/XFSCrypter.py b/module/plugins/internal/XFSCrypter.py
index 0f5bfd5d7..c371e97f5 100644
--- a/module/plugins/internal/XFSCrypter.py
+++ b/module/plugins/internal/XFSCrypter.py
@@ -6,7 +6,7 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo
class XFSCrypter(SimpleCrypter):
__name__ = "XFSCrypter"
__type__ = "crypter"
- __version__ = "0.10"
+ __version__ = "0.11"
__pattern__ = r'^unmatchable$'
diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py
index 0f4f90128..68cf25f14 100644
--- a/module/plugins/internal/XFSHoster.py
+++ b/module/plugins/internal/XFSHoster.py
@@ -6,14 +6,14 @@ import re
from module.plugins.internal.ReCaptcha import ReCaptcha
from module.plugins.internal.SolveMedia import SolveMedia
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, secondsToMidnight
+from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, seconds_to_midnight
from module.utils import html_unescape
class XFSHoster(SimpleHoster):
__name__ = "XFSHoster"
__type__ = "hoster"
- __version__ = "0.53"
+ __version__ = "0.54"
__pattern__ = r'^unmatchable$'
@@ -51,8 +51,8 @@ class XFSHoster(SimpleHoster):
def setup(self):
- self.chunkLimit = -1 if self.premium else 1
- self.resumeDownload = self.multiDL = self.premium
+ self.chunk_limit = -1 if self.premium else 1
+ self.resume_download = self.multi_dl = self.premium
def prepare(self):
@@ -80,20 +80,20 @@ class XFSHoster(SimpleHoster):
super(XFSHoster, self).prepare()
if self.DIRECT_LINK is None:
- self.directDL = self.premium
+ self.direct_d_l = self.premium
- def handleFree(self, pyfile):
+ def handle_free(self, pyfile):
for i in xrange(1, 6):
- self.logDebug("Getting download link #%d" % i)
+ self.log_debug("Getting download link #%d" % i)
- self.checkErrors()
+ self.check_errors()
m = re.search(self.LINK_PATTERN, self.html, re.S)
if m:
break
- data = self.getPostParameters()
+ data = self.get_post_parameters()
self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0)
@@ -109,24 +109,24 @@ class XFSHoster(SimpleHoster):
if m:
break
else:
- self.logError(data['op'] if 'op' in data else _("UNKNOWN"))
+ self.log_error(data['op'] if 'op' in data else _("UNKNOWN"))
return ""
self.link = m.group(1)
- def handlePremium(self, pyfile):
- return self.handleFree(pyfile)
+ def handle_premium(self, pyfile):
+ return self.handle_free(pyfile)
- def handleMulti(self, pyfile):
+ def handle_multi(self, pyfile):
if not self.account:
self.fail(_("Only registered or premium users can use url leech feature"))
- #only tested with easybytez.com
+ # only tested with easybytez.com
self.html = self.load("http://www.%s/" % self.HOSTER_DOMAIN)
- action, inputs = self.parseHtmlForm()
+ action, inputs = self.parse_html_form()
upload_id = "%012d" % int(random.random() * 10 ** 12)
action += upload_id + "&js_on=1&utype=prem&upload_type=url"
@@ -135,19 +135,19 @@ class XFSHoster(SimpleHoster):
inputs['url_mass'] = pyfile.url
inputs['up1oad_type'] = 'url'
- self.logDebug(action, inputs)
+ self.log_debug(action, inputs)
self.req.setOption("timeout", 600) #: wait for file to upload to easybytez.com
self.html = self.load(action, post=inputs)
- self.checkErrors()
+ self.check_errors()
- action, inputs = self.parseHtmlForm('F1')
+ action, inputs = self.parse_html_form('F1')
if not inputs:
self.retry(reason=self.info['error'] if 'error' in self.info else _("TEXTAREA F1 not found"))
- self.logDebug(inputs)
+ self.log_debug(inputs)
stmsg = inputs['st']
@@ -158,12 +158,12 @@ class XFSHoster(SimpleHoster):
self.retry(20, 3 * 60, _("Can not leech file"))
elif 'today' in stmsg:
- self.retry(wait_time=secondsToMidnight(gmt=2), reason=_("You've used all Leech traffic today"))
+ self.retry(wait_time=seconds_to_midnight(gmt=2), reason=_("You've used all Leech traffic today"))
else:
self.fail(stmsg)
- #get easybytez.com link for uploaded file
+ # get easybytez.com link for uploaded file
m = re.search(self.LINK_LEECH_PATTERN, self.html)
if m is None:
self.error(_("LINK_LEECH_PATTERN not found"))
@@ -174,22 +174,22 @@ class XFSHoster(SimpleHoster):
self.link = header['location']
- def getPostParameters(self):
+ def get_post_parameters(self):
if self.FORM_PATTERN or self.FORM_INPUTS_MAP:
- action, inputs = self.parseHtmlForm(self.FORM_PATTERN or "", self.FORM_INPUTS_MAP or {})
+ action, inputs = self.parse_html_form(self.FORM_PATTERN or "", self.FORM_INPUTS_MAP or {})
else:
- action, inputs = self.parseHtmlForm(input_names={'op': re.compile(r'^download')})
+ action, inputs = self.parse_html_form(input_names={'op': re.compile(r'^download')})
if not inputs:
- action, inputs = self.parseHtmlForm('F1')
+ action, inputs = self.parse_html_form('F1')
if not inputs:
self.retry(reason=self.info['error'] if 'error' in self.info else _("TEXTAREA F1 not found"))
- self.logDebug(inputs)
+ self.log_debug(inputs)
if 'op' in inputs:
if "password" in inputs:
- password = self.getPassword()
+ password = self.get_password()
if password:
inputs['password'] = password
else:
@@ -199,9 +199,9 @@ class XFSHoster(SimpleHoster):
m = re.search(self.WAIT_PATTERN, self.html)
if m:
wait_time = int(m.group(1))
- self.setWait(wait_time, False)
+ self.set_wait(wait_time, False)
- self.handleCaptcha(inputs)
+ self.handle_captcha(inputs)
self.wait()
else:
inputs['referer'] = self.pyfile.url
@@ -216,11 +216,11 @@ class XFSHoster(SimpleHoster):
return inputs
- def handleCaptcha(self, inputs):
+ def handle_captcha(self, inputs):
m = re.search(self.CAPTCHA_PATTERN, self.html)
if m:
captcha_url = m.group(1)
- inputs['code'] = self.decryptCaptcha(captcha_url)
+ inputs['code'] = self.decrypt_captcha(captcha_url)
return
m = re.search(self.CAPTCHA_BLOCK_PATTERN, self.html, re.S)
@@ -228,11 +228,11 @@ class XFSHoster(SimpleHoster):
captcha_div = m.group(1)
numerals = re.findall(r'<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div))
- self.logDebug(captcha_div)
+ self.log_debug(captcha_div)
inputs['code'] = "".join(a[1] for a in sorted(numerals, key=lambda num: int(num[0])))
- self.logDebug("Captcha code: %s" % inputs['code'], numerals)
+ self.log_debug("Captcha code: %s" % inputs['code'], numerals)
return
recaptcha = ReCaptcha(self)
@@ -243,7 +243,7 @@ class XFSHoster(SimpleHoster):
captcha_key = recaptcha.detect_key()
else:
- self.logDebug("ReCaptcha key: %s" % captcha_key)
+ self.log_debug("ReCaptcha key: %s" % captcha_key)
if captcha_key:
inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge(captcha_key)
@@ -257,7 +257,7 @@ class XFSHoster(SimpleHoster):
captcha_key = solvemedia.detect_key()
else:
- self.logDebug("SolveMedia key: %s" % captcha_key)
+ self.log_debug("SolveMedia key: %s" % captcha_key)
if captcha_key:
inputs['adcopy_response'], inputs['adcopy_challenge'] = solvemedia.challenge(captcha_key)