diff options
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/internal/Captcha.py | 7 | ||||
-rw-r--r-- | module/plugins/internal/Container.py | 5 | ||||
-rw-r--r-- | module/plugins/internal/Crypter.py | 7 | ||||
-rw-r--r-- | module/plugins/internal/Hoster.py | 3 | ||||
-rw-r--r-- | module/plugins/internal/OCR.py | 4 | ||||
-rw-r--r-- | module/plugins/internal/XFSCrypter.py | 4 | ||||
-rw-r--r-- | module/plugins/internal/XFSHoster.py | 21 |
7 files changed, 24 insertions, 27 deletions
diff --git a/module/plugins/internal/Captcha.py b/module/plugins/internal/Captcha.py index a8f48b5e4..e5203c142 100644 --- a/module/plugins/internal/Captcha.py +++ b/module/plugins/internal/Captcha.py @@ -6,6 +6,7 @@ import os import time from module.plugins.internal.Plugin import Plugin +from module.plugins.internal.utils import encode class Captcha(Plugin): @@ -75,7 +76,7 @@ class Captcha(Plugin): time_ref = ("%.2f" % time.time())[-6:].replace(".", "") with open(os.path.join("tmp", "captcha_image_%s_%s.%s" % (self.plugin.__name__, time_ref, input_type)), "wb") as tmp_img: - tmp_img.write(data) + tmp_img.write(encode(data)) if ocr: if isinstance(ocr, basestring): @@ -94,7 +95,7 @@ class Captcha(Plugin): self.task.setWaiting(max(timeout, 50)) #@TODO: Move to `CaptchaManager` in 0.4.10 while self.task.isWaiting(): - self.plugin.check_abort() + self.plugin.check_status() time.sleep(1) finally: @@ -124,7 +125,7 @@ class Captcha(Plugin): if not self.task: return - self.log_error(_("Invalid captcha")) + self.log_warning(_("Invalid captcha")) self.task.invalid() diff --git a/module/plugins/internal/Container.py b/module/plugins/internal/Container.py index 96c7a450c..436f97132 100644 --- a/module/plugins/internal/Container.py +++ b/module/plugins/internal/Container.py @@ -6,8 +6,7 @@ import os import re from module.plugins.internal.Crypter import Crypter -from module.plugins.internal.Plugin import exists -from module.utils import save_join as fs_join +from module.plugins.internal.utils import encode, exists, fs_join class Container(Crypter): @@ -55,7 +54,7 @@ class Container(Crypter): self.pyfile.url = fs_join(self.pyload.config.get("general", "download_folder"), self.pyfile.name) try: with open(self.pyfile.url, "wb") as f: - f.write(content) + f.write(encode(content)) except IOError, e: self.fail(e) diff --git a/module/plugins/internal/Crypter.py b/module/plugins/internal/Crypter.py index 77b5d74e9..0a9b85743 100644 --- a/module/plugins/internal/Crypter.py +++ b/module/plugins/internal/Crypter.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.Base import Base, check_abort, create_getInfo, parse_fileInfo -from module.plugins.internal.Plugin import parse_name -from module.utils import save_path as safe_filename +from module.plugins.internal.Base import Base, create_getInfo, parse_fileInfo +from module.plugins.internal.utils import fixname, parse_name class Crypter(Base): @@ -88,7 +87,7 @@ class Crypter(Base): self.pyload.api.setPackageData(pid, {'password': package_password}) #: Workaround to do not break API addPackage method - set_folder = lambda x="": self.pyload.api.setPackageData(pid, {'folder': safe_filename(x)}) + set_folder = lambda x="": self.pyload.api.setPackageData(pid, {'folder': fixname(x)}) if use_subfolder: if not subfolder_per_package: diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py index 333b9699f..eadf4ad7c 100644 --- a/module/plugins/internal/Hoster.py +++ b/module/plugins/internal/Hoster.py @@ -71,9 +71,6 @@ class Hoster(Base): def _process(self, thread): - """ - Handles important things to do before starting - """ self.log_debug("Plugin version: " + self.__version__) self.log_debug("Plugin status: " + self.__status__) diff --git a/module/plugins/internal/OCR.py b/module/plugins/internal/OCR.py index ccadbbcbc..10fd493b7 100644 --- a/module/plugins/internal/OCR.py +++ b/module/plugins/internal/OCR.py @@ -14,7 +14,7 @@ import subprocess # import tempfile from module.plugins.internal.Plugin import Plugin -from module.utils import save_join as fs_join +from module.plugins.internal.utils import fs_join class OCR(Plugin): @@ -88,7 +88,7 @@ class OCR(Plugin): tmpTxt.close() except IOError, e: - self.log_error(e, trace=True) + self.log_error(e) return self.pyload.log_debug("Saving tiff...") diff --git a/module/plugins/internal/XFSCrypter.py b/module/plugins/internal/XFSCrypter.py index da9c9cff7..879109939 100644 --- a/module/plugins/internal/XFSCrypter.py +++ b/module/plugins/internal/XFSCrypter.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.Plugin import set_cookie from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.utils import set_cookie class XFSCrypter(SimpleCrypter): @@ -34,7 +34,7 @@ class XFSCrypter(SimpleCrypter): def set_xfs_cookie(self): if not self.PLUGIN_DOMAIN: - self.log_error(_("Unable to set xfs cookie due missing PLUGIN_DOMAIN")) + self.log_warning(_("Unable to set xfs cookie due missing PLUGIN_DOMAIN")) return cookie = (self.PLUGIN_DOMAIN, "lang", "english") diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index 63b53be41..68c799f69 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -6,8 +6,8 @@ import re from module.plugins.captcha.ReCaptcha import ReCaptcha from module.plugins.captcha.SolveMedia import SolveMedia from module.plugins.internal.Plugin import set_cookie -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, seconds_to_midnight -from module.utils import html_unescape +from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.utils import html_unescape, seconds_to_midnight class XFSHoster(SimpleHoster): @@ -17,10 +17,10 @@ class XFSHoster(SimpleHoster): __status__ = "testing" __pattern__ = r'^unmatchable$' - __config__ = [("activated" , "bool", "Activated" , True), - ("use_premium" , "bool", "Use premium account if available" , True), - ("fallback_premium", "bool", "Fallback to free download if premium fails", True), - ("chk_filesize" , "bool", "Check file size" , True)] + __config__ = [("activated" , "bool", "Activated" , True), + ("use_premium" , "bool", "Use premium account if available" , True), + ("fallback" , "bool", "Fallback to free download if premium fails", True), + ("chk_filesize", "bool", "Check file size" , True)] __description__ = """XFileSharing hoster plugin""" __license__ = "GPLv3" @@ -31,7 +31,7 @@ class XFSHoster(SimpleHoster): PLUGIN_DOMAIN = None - LEECH_HOSTER = True #@NOTE: Should be default to False for safe, but I'm lazy... + LEECH_HOSTER = True #@NOTE: hould be set to `False` by default for safe, but I am lazy... NAME_PATTERN = r'(Filename[ ]*:[ ]*</b>(</td><td nowrap>)?|name="fname"[ ]+value="|<[\w^_]+ class="(file)?name">)\s*(?P<N>.+?)(\s*<|")' SIZE_PATTERN = r'(Size[ ]*:[ ]*</b>(</td><td>)?|File:.*>|</font>\s*\(|<[\w^_]+ class="size">)\s*(?P<S>[\d.,]+)\s*(?P<U>[\w^_]+)' @@ -52,17 +52,18 @@ class XFSHoster(SimpleHoster): SOLVEMEDIA_PATTERN = None FORM_PATTERN = None - FORM_INPUTS_MAP = None #: Dict passed as input_names to parse_html_form + FORM_INPUTS_MAP = None #: Dict passed as `input_names` to `parse_html_form` def setup(self): self.chunk_limit = -1 if self.premium else 1 - self.resume_download = self.multiDL = self.premium + self.multiDL = self.premium + self.resume_download = self.premium def set_xfs_cookie(self): if not self.PLUGIN_DOMAIN: - self.log_error(_("Unable to set xfs cookie due missing PLUGIN_DOMAIN")) + self.log_warning(_("Unable to set xfs cookie due missing PLUGIN_DOMAIN")) return cookie = (self.PLUGIN_DOMAIN, "lang", "english") |