summaryrefslogtreecommitdiffstats
path: root/module/plugins/Plugin.py
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2010-05-05 23:03:43 +0200
committerGravatar mkaay <mkaay@mkaay.de> 2010-05-05 23:03:43 +0200
commit81508f295cffc40c479fe72f24bdf1dbbedf5d92 (patch)
tree0cb68f0a525d0ead0cd8130c3adad150c49b81a7 /module/plugins/Plugin.py
parentmegavideo.com plugin (diff)
downloadpyload-81508f295cffc40c479fe72f24bdf1dbbedf5d92.tar.xz
refactored plugins, new plugin manager
Diffstat (limited to 'module/plugins/Plugin.py')
-rw-r--r--module/plugins/Plugin.py29
1 files changed, 13 insertions, 16 deletions
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py
index c4ac8ee12..107c4f0ca 100644
--- a/module/plugins/Plugin.py
+++ b/module/plugins/Plugin.py
@@ -32,19 +32,17 @@ from os import makedirs
from module.DownloadThread import CaptchaError
class Plugin():
-
+ __name__ = "Plugin"
+ __version__ = "0.4"
+ __pattern__ = None
+ __type__ = "hoster"
+ __description__ = """Base Plugin"""
+ __author_name__ = ("RaNaN", "spoob", "mkaay")
+ __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org", "mkaay@mkaay.de")
+
def __init__(self, parent):
self.configparser = parent.core.parser_plugins
self.config = {}
- props = {}
- props['name'] = "BasePlugin"
- props['version'] = "0.3"
- props['pattern'] = None
- props['type'] = "hoster"
- props['description'] = """Base Plugin"""
- props['author_name'] = ("RaNaN", "spoob", "mkaay")
- props['author_mail'] = ("RaNaN@pyload.org", "spoob@pyload.org", "mkaay@mkaay.de")
- self.props = props
self.parent = parent
self.req = Request()
self.html = 0
@@ -115,20 +113,20 @@ class Plugin():
def set_config(self):
for k, v in self.config.items():
- self.configparser.set(self.props['name'], {"option": k}, v)
+ self.configparser.set(self.__name__, {"option": k}, v)
def remove_config(self, option):
- self.configparser.remove(self.props['name'], option)
+ self.configparser.remove(self.__name__, option)
def get_config(self, value, default=None):
self.configparser.loadData()
- return self.configparser.get(self.props['name'], value, default=default)
+ return self.configparser.get(self.__name__, value, default=default)
def read_config(self):
self.configparser.loadData()
try:
self.verify_config()
- self.config = self.configparser.getConfig()[self.props['name']]
+ self.config = self.configparser.getConfig()[self.__name__]
except:
pass
@@ -136,8 +134,7 @@ class Plugin():
pass
def init_ocr(self):
- modul = __import__("module.plugins.captcha." + self.props['name'], fromlist=['captcha'])
- captchaClass = getattr(modul, self.props['name'])
+ captchaClass = self.core.pluginManager.getCaptchaPlugin(self.__name__)
self.ocr = captchaClass()
def __call__(self):