diff options
Diffstat (limited to 'module/plugins/internal')
23 files changed, 59 insertions, 93 deletions
diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py index a1ecdd76f..410a02671 100644 --- a/module/plugins/internal/Account.py +++ b/module/plugins/internal/Account.py @@ -11,9 +11,9 @@ from module.utils import compare_time, lock class Account(Plugin): - __name__ = "Account" + __name = "Account" __type__ = "account" - __version__ = "0.60" + __version__ = "0.61" __status__ = "testing" __description__ = """Base account plugin""" @@ -335,7 +335,7 @@ class Account(Plugin): 'premium' : None, 'timestamp' : 0, 'trafficleft': None, - 'type' : self.__name__, + 'type' : self.__name, 'valid' : None, 'validuntil' : None} diff --git a/module/plugins/internal/Addon.py b/module/plugins/internal/Addon.py index bdde514c0..12a4aed95 100644 --- a/module/plugins/internal/Addon.py +++ b/module/plugins/internal/Addon.py @@ -21,9 +21,10 @@ def threaded(fn): class Addon(Plugin): - __name__ = "Addon" + __name = "Addon" + __type = "addon" __type__ = "hook" #@TODO: Change to `addon` in 0.4.10 - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" __threaded__ = [] #@TODO: Remove in 0.4.10 @@ -59,12 +60,6 @@ class Addon(Plugin): self.init_events() - #@TODO: Remove in 0.4.10 - def _log(self, level, plugintype, pluginname, messages): - plugintype = "addon" if plugintype is "hook" else plugintype - return super(Addon, self)._log(level, plugintype, pluginname, messages) - - def init_events(self): if self.event_map: for event, funcs in self.event_map.items(): diff --git a/module/plugins/internal/Base.py b/module/plugins/internal/Base.py index e3aaf202b..578b12f7f 100644 --- a/module/plugins/internal/Base.py +++ b/module/plugins/internal/Base.py @@ -45,7 +45,7 @@ def check_abort(fn): class Base(Plugin): - __name__ = "Base" + __name = "Base" __type__ = "base" __version__ = "0.11" __status__ = "testing" @@ -123,7 +123,7 @@ class Base(Plugin): 'url' : replace_patterns(url, cls.URL_REPLACEMENTS)} try: - info['pattern'] = re.match(cls.__pattern__, url).groupdict() + info['pattern'] = re.match(cls.__pattern, url).groupdict() except Exception: pass @@ -208,7 +208,8 @@ class Base(Plugin): self.pyfile.setStatus("starting") - self.log_debug("PROCESS URL " + self.pyfile.url, "PLUGIN VERSION %s" % self.__version__) + self.log_debug("PROCESS URL " + self.pyfile.url, + "PLUGIN VERSION %s" % self.__version) self.process(self.pyfile) diff --git a/module/plugins/internal/Captcha.py b/module/plugins/internal/Captcha.py index a8f48b5e4..070621249 100644 --- a/module/plugins/internal/Captcha.py +++ b/module/plugins/internal/Captcha.py @@ -9,7 +9,7 @@ from module.plugins.internal.Plugin import Plugin class Captcha(Plugin): - __name__ = "Captcha" + __name = "Captcha" __type__ = "captcha" __version__ = "0.46" __status__ = "testing" @@ -38,8 +38,8 @@ class Captcha(Plugin): def _log(self, level, plugintype, pluginname, messages): return self.plugin._log(level, plugintype, - self.plugin.__name__, - (self.__name__,) + messages) + self.plugin.__name, + (self.__name,) + messages) def recognize(self, image): diff --git a/module/plugins/internal/CaptchaService.py b/module/plugins/internal/CaptchaService.py index 20dc60427..6870e4d81 100644 --- a/module/plugins/internal/CaptchaService.py +++ b/module/plugins/internal/CaptchaService.py @@ -4,7 +4,7 @@ from module.plugins.internal.Captcha import Captcha class CaptchaService(Captcha): - __name__ = "CaptchaService" + __name = "CaptchaService" __type__ = "captcha" __version__ = "0.32" __status__ = "testing" @@ -23,7 +23,7 @@ class CaptchaService(Captcha): if self.detect_key(data): return self.key else: - self.fail(_("%s key not found") % self.__name__) + self.fail(_("%s key not found") % self.__name) #@TODO: Recheck in 0.4.10, html is now pyfile.data @@ -31,7 +31,7 @@ class CaptchaService(Captcha): if hasattr(self.plugin, "html") and self.plugin.html: return self.plugin.html else: - self.fail(_("%s data not found") % self.__name__) + self.fail(_("%s data not found") % self.__name) def detect_key(self, data=None): diff --git a/module/plugins/internal/Container.py b/module/plugins/internal/Container.py index 2300c4cab..ffae0a990 100644 --- a/module/plugins/internal/Container.py +++ b/module/plugins/internal/Container.py @@ -11,7 +11,7 @@ from module.utils import save_join as fs_join class Container(Crypter): - __name__ = "Container" + __name = "Container" __type__ = "container" __version__ = "0.07" __status__ = "testing" diff --git a/module/plugins/internal/Crypter.py b/module/plugins/internal/Crypter.py index 20322bb33..151d66860 100644 --- a/module/plugins/internal/Crypter.py +++ b/module/plugins/internal/Crypter.py @@ -6,7 +6,7 @@ from module.utils import save_path as safe_filename class Crypter(Base): - __name__ = "Crypter" + __name = "Crypter" __type__ = "crypter" __version__ = "0.13" __status__ = "testing" diff --git a/module/plugins/internal/DeadCrypter.py b/module/plugins/internal/DeadCrypter.py index e7cc6ff39..911a7373b 100644 --- a/module/plugins/internal/DeadCrypter.py +++ b/module/plugins/internal/DeadCrypter.py @@ -4,7 +4,7 @@ from module.plugins.internal.Crypter import Crypter, create_getInfo class DeadCrypter(Crypter): - __name__ = "DeadCrypter" + __name = "DeadCrypter" __type__ = "crypter" __version__ = "0.09" __status__ = "testing" diff --git a/module/plugins/internal/DeadHoster.py b/module/plugins/internal/DeadHoster.py index 250287d25..2aeceb52f 100644 --- a/module/plugins/internal/DeadHoster.py +++ b/module/plugins/internal/DeadHoster.py @@ -4,7 +4,7 @@ from module.plugins.internal.Hoster import Hoster, create_getInfo class DeadHoster(Hoster): - __name__ = "DeadHoster" + __name = "DeadHoster" __type__ = "hoster" __version__ = "0.19" __status__ = "testing" diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index 3ab5d6a0d..7933a33a6 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -21,7 +21,7 @@ class PasswordError(Exception): class Extractor(Plugin): - __name__ = "Extractor" + __name = "Extractor" __type__ = "extractor" __version__ = "0.35" __status__ = "testing" @@ -116,8 +116,8 @@ class Extractor(Plugin): def _log(self, level, plugintype, pluginname, messages): return self.plugin._log(level, plugintype, - self.plugin.__name__, - (self.__name__,) + messages) + self.plugin.__name, + (self.__name,) + messages) def verify(self, password=None): diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py deleted file mode 100644 index f1308c25b..000000000 --- a/module/plugins/internal/Hook.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.Addon import Addon, threaded - - -class Hook(Addon): - __name__ = "Hook" - __type__ = "hook" - __version__ = "0.16" - __status__ = "testing" - - __description__ = """Base hook plugin""" - __license__ = "GPLv3" - __authors__ = [("mkaay" , "mkaay@mkaay.de" ), - ("RaNaN" , "RaNaN@pyload.org" ), - ("Walter Purcaro", "vuolter@gmail.com")] - - - PERIODICAL_INTERVAL = 10 - - - def __init__(self, *args, **kwargs): - super(Hook, self).__init__(*args, **kwargs) - if self.PERIODICAL_INTERVAL: - self.start_periodical(self.PERIODICAL_INTERVAL) - - - #@TODO: Remove in 0.4.10 - def _log(self, level, plugintype, pluginname, messages): - return super(Addon, self)._log(level, plugintype, pluginname.replace("Hook", ""), messages) - - - def periodical(self): - pass diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py index d81154554..00bc3a4dd 100644 --- a/module/plugins/internal/Hoster.py +++ b/module/plugins/internal/Hoster.py @@ -11,7 +11,7 @@ from module.utils import fs_decode, fs_encode, save_join as fs_join, save_path a class Hoster(Base): - __name__ = "Hoster" + __name = "Hoster" __type__ = "hoster" __version__ = "0.37" __status__ = "testing" @@ -83,7 +83,7 @@ class Hoster(Base): try: self.log_debug("PROCESS URL " + self.pyfile.url, - "PLUGIN VERSION %s" % self.__version__) #@TODO: Remove in 0.4.10 + "PLUGIN VERSION %s" % self.__version) #@TODO: Remove in 0.4.10 self.process(self.pyfile) self.check_abort() diff --git a/module/plugins/internal/MultiCrypter.py b/module/plugins/internal/MultiCrypter.py index 9d4ac3ab9..8930fcb70 100644 --- a/module/plugins/internal/MultiCrypter.py +++ b/module/plugins/internal/MultiCrypter.py @@ -4,9 +4,9 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter class MultiCrypter(SimpleCrypter): - __name__ = "MultiCrypter" + __name = "MultiCrypter" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -27,4 +27,4 @@ class MultiCrypter(SimpleCrypter): return super(MultiCrypter, self)._log(level, plugintype, pluginname, - (self.CRYPTER_NAME,) + messages) + (self.PLUGIN_NAME,) + messages) diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py index 231615ae5..314bc6f92 100644 --- a/module/plugins/internal/MultiHoster.py +++ b/module/plugins/internal/MultiHoster.py @@ -7,7 +7,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, r class MultiHoster(SimpleHoster): - __name__ = "MultiHoster" + __name = "MultiHoster" __type__ = "hoster" __version__ = "0.53" __status__ = "testing" @@ -56,7 +56,7 @@ class MultiHoster(SimpleHoster): self.get_info = klass.get_info if self.DIRECT_LINK is None: - direct_dl = self.__pattern__ != r'^unmatchable$' and re.match(self.__pattern__, self.pyfile.url) + direct_dl = self.__pattern != r'^unmatchable$' and re.match(self.__pattern, self.pyfile.url) else: direct_dl = self.DIRECT_LINK diff --git a/module/plugins/internal/OCR.py b/module/plugins/internal/OCR.py index 333082425..ca87f91a6 100644 --- a/module/plugins/internal/OCR.py +++ b/module/plugins/internal/OCR.py @@ -18,7 +18,7 @@ from module.utils import save_join as fs_join class OCR(Plugin): - __name__ = "OCR" + __name = "OCR" __type__ = "ocr" __version__ = "0.20" __status__ = "testing" @@ -44,8 +44,8 @@ class OCR(Plugin): def _log(self, level, plugintype, pluginname, messages): return self.plugin._log(level, plugintype, - self.plugin.__name__, - (self.__name__,) + messages) + self.plugin.__name, + (self.__name,) + messages) def load_image(self, image): diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py index a2392fdcc..69dfc2412 100644 --- a/module/plugins/internal/Plugin.py +++ b/module/plugins/internal/Plugin.py @@ -260,9 +260,9 @@ def chunks(iterable, size): class Plugin(object): - __name__ = "Plugin" + __name = "Plugin" __type__ = "plugin" - __version__ = "0.53" + __version__ = "0.54" __status__ = "testing" __pattern__ = r'^unmatchable$' @@ -279,7 +279,7 @@ class Plugin(object): def __repr__(self): - return "<%(type)s %(name)s>" % {'type': self.__type__.capitalize(), + return "<%(type)s %(name)s>" % {'type': self.__type.capitalize(), 'name': self.__name__} @@ -289,6 +289,14 @@ class Plugin(object): self.req = None #: Browser instance, see `network.Browser` self.last_html = None + #@TODO: Remove in 0.4.10 + for attr in ("name", "type", "version", "status", "pattern", + "config", "description", "license", "authors"): + if hasattr(self, "__%s" % attr): + continue + value = getattr(self, "__%s__" % attr) + setattr(self, "__%s" % attr, value) + def init(self): """ @@ -307,35 +315,35 @@ class Plugin(object): def log_debug(self, *args, **kwargs): - self._log("debug", self.__type__, self.__name__, args) + self._log("debug", self.__type, self.__name, args) if self.pyload.debug and kwargs.get('trace'): print "Traceback (most recent call last):" traceback.print_stack() def log_info(self, *args, **kwargs): - self._log("info", self.__type__, self.__name__, args) + self._log("info", self.__type, self.__name, args) if self.pyload.debug and kwargs.get('trace'): print "Traceback (most recent call last):" traceback.print_stack() def log_warning(self, *args, **kwargs): - self._log("warning", self.__type__, self.__name__, args) + self._log("warning", self.__type, self.__name, args) if self.pyload.debug and kwargs.get('trace'): print "Traceback (most recent call last):" traceback.print_stack() def log_error(self, *args, **kwargs): - self._log("error", self.__type__, self.__name__, args) + self._log("error", self.__type, self.__name, args) if self.pyload.debug and kwargs.get('trace', True): print "Traceback (most recent call last):" traceback.print_stack() def log_critical(self, *args, **kwargs): - self._log("critical", self.__type__, self.__name__, args) + self._log("critical", self.__type, self.__name, args) if kwargs.get('trace', True): print "Traceback (most recent call last):" traceback.print_stack() diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py index f73e935e8..5093167ae 100644 --- a/module/plugins/internal/SevenZip.py +++ b/module/plugins/internal/SevenZip.py @@ -9,7 +9,7 @@ from module.utils import save_join as fs_join class SevenZip(UnRar): - __name__ = "SevenZip" + __name = "SevenZip" __version__ = "0.16" __status__ = "testing" diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index cf74c6646..b436998ec 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -14,7 +14,7 @@ from module.utils import fixup, fs_encode, parseFileSize as parse_size class SimpleHoster(Hoster): - __name__ = "SimpleHoster" + __name = "SimpleHoster" __type__ = "hoster" __version__ = "1.97" __status__ = "testing" @@ -224,7 +224,7 @@ class SimpleHoster(Hoster): if self.LEECH_HOSTER: pattern = self.pyload.pluginManager.hosterPlugins[self.__name__]['pattern'] - if self.__pattern__ is not pattern and re.match(self.__pattern__, self.pyfile.url) is None: + if self.__pattern is not pattern and re.match(self.__pattern, self.pyfile.url) is None: self.leech_dl = True if self.leech_dl: @@ -458,11 +458,9 @@ class SimpleHoster(Hoster): name = self.pyfile.name size = self.pyfile.size - folder = self.info['folder'] = name self.log_info(_("File name: ") + name) self.log_info(_("File size: %s bytes") % size if size > 0 else _("File size: Unknown")) - # self.log_info("File folder: " + folder) #@TODO: Rewrite in 0.4.10 diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 6f85c286a..e625dce11 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -21,7 +21,7 @@ def renice(pid, value): class UnRar(Extractor): - __name__ = "UnRar" + __name = "UnRar" __version__ = "1.27" __status__ = "testing" @@ -56,7 +56,7 @@ class UnRar(Extractor): p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() - # cls.__name__ = "RAR" + # cls.__name = "RAR" cls.REPAIR = True except OSError: diff --git a/module/plugins/internal/UnZip.py b/module/plugins/internal/UnZip.py index 87cbd568a..f71473ba2 100644 --- a/module/plugins/internal/UnZip.py +++ b/module/plugins/internal/UnZip.py @@ -10,7 +10,7 @@ from module.plugins.internal.Extractor import Extractor, ArchiveError, CRCError, class UnZip(Extractor): - __name__ = "UnZip" + __name = "UnZip" __version__ = "1.16" __status__ = "testing" diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index 4c3f35c2b..3b795257f 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -11,7 +11,7 @@ from module.plugins.internal.Plugin import parse_html_form, set_cookie class XFSAccount(Account): - __name__ = "XFSAccount" + __name = "XFSAccount" __type__ = "account" __version__ = "0.50" __status__ = "testing" diff --git a/module/plugins/internal/XFSCrypter.py b/module/plugins/internal/XFSCrypter.py index 7ec9f3895..88a435178 100644 --- a/module/plugins/internal/XFSCrypter.py +++ b/module/plugins/internal/XFSCrypter.py @@ -1,13 +1,11 @@ # -*- coding: utf-8 -*- -import re - from module.plugins.internal.Plugin import set_cookie from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo class XFSCrypter(SimpleCrypter): - __name__ = "XFSCrypter" + __name = "XFSCrypter" __type__ = "crypter" __version__ = "0.18" __status__ = "testing" @@ -51,7 +49,7 @@ class XFSCrypter(SimpleCrypter): if self.account: account = self.account else: - account_name = re.sub(r'Folder$', "", self.__name__) + account_name = self.__name__.rstrip("Folder") account = self.pyload.accountManager.getAccountPlugin(account_name) if account and hasattr(account, "PLUGIN_DOMAIN") and account.PLUGIN_DOMAIN: diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index 06715d2f1..0d6a61b33 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -11,7 +11,7 @@ from module.utils import html_unescape class XFSHoster(SimpleHoster): - __name__ = "XFSHoster" + __name = "XFSHoster" __type__ = "hoster" __version__ = "0.65" __status__ = "testing" |