diff options
Diffstat (limited to 'pyload/manager')
-rw-r--r-- | pyload/manager/AddonManager.py | 2 | ||||
-rw-r--r-- | pyload/manager/PluginManager.py | 25 | ||||
-rw-r--r-- | pyload/manager/ThreadManager.py | 4 |
3 files changed, 17 insertions, 14 deletions
diff --git a/pyload/manager/AddonManager.py b/pyload/manager/AddonManager.py index 0fc3efb7b..2fd744776 100644 --- a/pyload/manager/AddonManager.py +++ b/pyload/manager/AddonManager.py @@ -46,6 +46,8 @@ class AddonManager(object): """ def __init__(self, core): + self.core = core + __builtin__.addonManager = self #: needed to let addons register themself self.plugins = [] diff --git a/pyload/manager/PluginManager.py b/pyload/manager/PluginManager.py index 92b5e2c7d..c327c991a 100644 --- a/pyload/manager/PluginManager.py +++ b/pyload/manager/PluginManager.py @@ -16,9 +16,9 @@ from SafeEval import const_eval as literal_eval class PluginManager(object): - ROOT = "pyload.plugins." + ROOT = "pyload.plugins." USERROOT = "userplugins." - TYPES = [] + TYPES = ["account", "addon", "container", "crypter", "hook", "hoster", "internal", "ocr"] PATTERN = re.compile(r'__pattern\s*=\s*u?r("|\')([^"\']+)') VERSION = re.compile(r'__version\s*=\s*("|\')([\d.]+)') @@ -36,15 +36,17 @@ class PluginManager(object): sys.meta_path.append(self) - def initTYPES(self): + def loadTypes(self): rootdir = join(pypath, "pyload", "plugins") userdir = "userplugins" - tmpset = set() - for p in (rootdir, userdir): - tmpset += set([d for d in listdir(p) if isdir(join(p, d))]) + types = set().union(*[[d for d in listdir(p) if isdir(join(p, d))] + for p in (rootdir, userdir) if exists(p)]) - self.TYPES = list(tmpset) + if not types: + self.log.critical(_("No plugins found!")) + + self.TYPES = list(set(self.TYPES) | types) def createIndex(self): @@ -52,16 +54,13 @@ class PluginManager(object): sys.path.append(abspath("")) - self.initTYPES() - - if not self.TYPES: - self.log.critical(_("No TYPES, no fun!")) + self.loadTypes() - for type in set(self.TYPES): + for type in self.TYPES: self.plugins[type] = self.parse(type) setattr(self, "%sPlugins" % type, self.plugins[type]) - self.plugins['addon'] = self.addonPlugins.extend(self.hookPlugins) + self.plugins['addon'] = self.addonPlugins.update(self.hookPlugins) self.core.log.debug("Created index of plugins") diff --git a/pyload/manager/ThreadManager.py b/pyload/manager/ThreadManager.py index 7e7854b75..d6f3c0005 100644 --- a/pyload/manager/ThreadManager.py +++ b/pyload/manager/ThreadManager.py @@ -11,7 +11,9 @@ from random import choice import pycurl -from pyload.manager.thread import DecrypterThread, DownloadThread, InfoThread +from pyload.manager.thread.DecrypterThread import DecrypterThread +from pyload.manager.thread.DownloadThread import DownloadThread +from pyload.manager.thread.InfoThread import InfoThread from pyload.datatype.PyFile import PyFile from pyload.network.RequestFactory import getURL from pyload.utils import freeSpace, lock |