From 3c85d66783b0f03a36d36356ecdebf17754f75ec Mon Sep 17 00:00:00 2001 From: RaNaN Date: Wed, 29 Dec 2010 22:22:50 +0100 Subject: MU free fixed --- module/ConfigParser.py | 11 +++++++++++ module/config/default.conf | 4 ++-- module/plugins/PluginManager.py | 18 ++++-------------- module/plugins/accounts/MegauploadCom.py | 2 +- 4 files changed, 18 insertions(+), 17 deletions(-) (limited to 'module') diff --git a/module/ConfigParser.py b/module/ConfigParser.py index da4e734e5..ccf6f08d1 100644 --- a/module/ConfigParser.py +++ b/module/ConfigParser.py @@ -8,6 +8,8 @@ from shutil import copy from traceback import print_exc +IGNORE = ("FreakshareNet", "SpeedManager") +#ignore this plugin configs CONF_VERSION = 1 @@ -47,6 +49,8 @@ class ConfigParser: self.checkVersion() self.readConfig() + + self.deleteOldPlugins() #---------------------------------------------------------------------- def checkVersion(self, n=0): @@ -341,6 +345,13 @@ class ConfigParser: "value" : self.cast(config[2], config[4]) } + def deleteOldPlugins(self): + """ remove old plugins from config """ + + for name in IGNORE: + if self.plugin.has_key(name): + del self.plugin[name] + ######################################################################## class Section: """provides dictionary like access for configparser""" diff --git a/module/config/default.conf b/module/config/default.conf index b6ecce755..1c0d935ab 100644 --- a/module/config/default.conf +++ b/module/config/default.conf @@ -32,7 +32,7 @@ general - "General": download - "Download": int chunks : "Max connections for one download" = 3 int max_downloads : "Max Parallel Downloads" = 3 - int max_speed : "Max Download Speed kb/s" = -1 + int max_speed : "Max Download Speed in kb/s" = -1 bool limit_speed : "Limit Download Speed" = False bool proxy : "Use Proxy" = False str interface : "Download interface to bind (ip or Name)" = None @@ -56,6 +56,6 @@ downloadTime - "Download Time": proxy - "Proxy": str address : "Address" = "localhost" int port : "Port" = 7070 - str type : "Protocol (http|socks4|socks5)" = http + http;socks4;socks5 type : "Protocol" = http str username : "Username" = None str password : "Password" = None diff --git a/module/plugins/PluginManager.py b/module/plugins/PluginManager.py index 52712f160..10604dc9b 100644 --- a/module/plugins/PluginManager.py +++ b/module/plugins/PluginManager.py @@ -36,9 +36,7 @@ try: except ImportError: # python 2.5 from module.SafeEval import safe_eval as literal_eval - -IGNORE = ["FreakshareNet", "SpeedManager"] -#ignore this plugins in homefolder, add deleted plugins here +from module.ConfigParser import IGNORE class PluginManager(): def __init__(self, core): @@ -53,17 +51,9 @@ class PluginManager(): self.captchaPlugins = {} self.accountPlugins = {} self.hookPlugins = {} - - self.createHomeDirs() - + self.createIndex() - - #@TODO plugin updater - #---------------------------------------------------------------------- - def createHomeDirs(self): - """create homedirectories containing plugins""" - #@TODO implement... - pass + def createIndex(self): """create information for all plugins available""" @@ -170,7 +160,7 @@ class PluginManager(): try: plugins[name]["re"] = re.compile(pattern) except: - self.log.error(_("%s has invalid pattern.") % name) + self.log.error(_("%s has a invalid pattern.") % name) config = self.reConfig.findall(content) diff --git a/module/plugins/accounts/MegauploadCom.py b/module/plugins/accounts/MegauploadCom.py index 3432c299a..2f33e791b 100644 --- a/module/plugins/accounts/MegauploadCom.py +++ b/module/plugins/accounts/MegauploadCom.py @@ -33,7 +33,7 @@ class MegauploadCom(Account): def loadAccountInfo(self, user, req): page = req.load("http://www.megaupload.com/?c=account") - free = re.findall(r"Account type:\s*Regular",page,re.IGNORECASE+re.MULTILINE) + free = re.findall(r"Account type:\s*\s*
\s*Regular",page,re.IGNORECASE+re.MULTILINE) if free: return {"validuntil": -1, "trafficleft":-1, "premium": False} -- cgit v1.2.3