summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/plugins/internal/Account.py9
-rw-r--r--module/plugins/internal/Crypter.py7
-rw-r--r--module/plugins/internal/Hook.py16
-rw-r--r--module/plugins/internal/Plugin.py4
4 files changed, 16 insertions, 20 deletions
diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py
index 654296f32..27a040e24 100644
--- a/module/plugins/internal/Account.py
+++ b/module/plugins/internal/Account.py
@@ -6,7 +6,7 @@ import time
import traceback
from module.plugins.internal.Plugin import Base
-from module.utils import compare_time, lock, parse_size
+from module.utils import compare_time, lock, parseFileSize
class WrongPassword(Exception):
@@ -14,11 +14,6 @@ class WrongPassword(Exception):
class Account(Base):
- """
- Base class for every Account plugin.
- Just overwrite `login` and cookies will be stored and account becomes accessible in\
- associated hoster plugin. Plugin should also provide `loadAccountInfo`
- """
__name__ = "Account"
__type__ = "account"
__version__ = "0.03"
@@ -29,6 +24,8 @@ class Account(Base):
def __init__(self, manager, accounts):
+ super(Account, self).__init__(manager.core)
+
self.manager = manager
self.accounts = {}
self.infos = {} #: cache for account information
diff --git a/module/plugins/internal/Crypter.py b/module/plugins/internal/Crypter.py
index 3db36ca8e..5fb9bc5c2 100644
--- a/module/plugins/internal/Crypter.py
+++ b/module/plugins/internal/Crypter.py
@@ -7,11 +7,6 @@ from module.utils import decode, save_path
class Crypter(Plugin):
- """
- Base plugin for crypter.
- Overwrite `decrypt` in your subclassed plugin.
- """
-
__name__ = "Crypter"
__type__ = "crypter"
__version__ = "0.03"
@@ -29,7 +24,7 @@ class Crypter(Plugin):
def __init__(self, pyfile):
- super(Crypter, self).__init__(self, pyfile)
+ super(Crypter, self).__init__(pyfile)
#: Provide information in dict here
self.info = {} #@TODO: Move to Plugin
diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py
index d34435349..6931a7dba 100644
--- a/module/plugins/internal/Hook.py
+++ b/module/plugins/internal/Hook.py
@@ -26,7 +26,8 @@ class Hook(Base):
__type__ = "hook"
__version__ = "0.03"
- __config__ = [] #: [("name", "type", "desc", "default")]
+ __config__ = [] #: [("name", "type", "desc", "default")]
+ __threaded__ = [] #@TODO: Remove in 0.4.10
__description__ = """Base hook plugin"""
__license__ = "GPLv3"
@@ -36,6 +37,8 @@ class Hook(Base):
def __init__(self, core, manager):
+ super(Hook, self).__init__(core)
+
#: Provide information in dict here, usable by API `getInfo`
self.info = {}
@@ -55,7 +58,12 @@ class Hook(Base):
#: List of events the plugin can handle, name the functions exactly like eventname.
self.event_list = [] #@NOTE: dont make duplicate entries in event_map
- # register events
+ self.initEvents()
+ # self.initPeriodical(10)
+
+
+ def initEvents(self):
+ # register events
if self.event_map:
for event, funcs in self.event_map.iteritems():
if type(funcs) in (list, tuple):
@@ -117,7 +125,6 @@ class Hook(Base):
#: Deprecated, use method `deactivate` instead
def unload(self):
- self.logWarning(_("Deprecated method `unload`, use `deactivate` instead"))
return self.deactivate()
@@ -128,7 +135,6 @@ class Hook(Base):
#: Deprecated, use method `activate` instead
def coreReady(self):
- self.logWarning(_("Deprecated method `coreReady`, use `activate` instead"))
return self.activate()
@@ -139,7 +145,6 @@ class Hook(Base):
#: Deprecated, use method `exit` instead
def coreExiting(self):
- self.logWarning(_("Deprecated method `coreExiting`, use `exit` instead"))
return self.exit()
@@ -178,7 +183,6 @@ class Hook(Base):
#: Deprecated, use method `captchaTask` instead
def newCaptchaTask(self, task):
- self.logWarning(_("Deprecated method `newCaptchaTask`, use `captchaTask` instead"))
return self.captchaTask()
diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py
index c13d94aac..950879c6e 100644
--- a/module/plugins/internal/Plugin.py
+++ b/module/plugins/internal/Plugin.py
@@ -60,8 +60,8 @@ class Base(object):
log = getattr(self.core.log, level)
msg = " | ".join((fs_encode(a) if isinstance(a, unicode) else #@NOTE: `fs_encode` -> `encode` in 0.4.10
str(a)).strip() for a in args if a)
- log("%(plugin)s[%(id)s]: %(msg)s" % {'plugin': self.__name__,
- 'id' : self.pyfile.id if hasattr(self, 'pyfile') else "",
+ log("%(plugin)s%(id)s: %(msg)s" % {'plugin': self.__name__,
+ 'id' : ("[%s]" % self.pyfile.id) if hasattr(self, 'pyfile') else "",
'msg' : msg or _(level.upper() + " MARK")})