diff options
Diffstat (limited to 'pyload/manager/Plugin.py')
-rw-r--r-- | pyload/manager/Plugin.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/pyload/manager/Plugin.py b/pyload/manager/Plugin.py index 918f6de8a..10abbc2ea 100644 --- a/pyload/manager/Plugin.py +++ b/pyload/manager/Plugin.py @@ -25,6 +25,7 @@ class PluginManager(object): CONFIG = re.compile(r'__config\s*=\s*\[([^\]]+)', re.M) DESC = re.compile(r'__description\s*=\s*("|"""|\')([^"\']+)') + def __init__(self, core): self.core = core @@ -34,6 +35,7 @@ class PluginManager(object): # register for import addon sys.meta_path.append(self) + def loadTypes(self): rootdir = join(pypath, "pyload", "plugin") userdir = "userplugins" @@ -46,6 +48,7 @@ class PluginManager(object): self.TYPES = list(set(self.TYPES) | types) + def createIndex(self): """create information for all plugins available""" @@ -64,6 +67,7 @@ class PluginManager(object): self.core.log.debug("Created index of plugins") + def parse(self, folder, rootplugins={}): """ returns dict with information @@ -179,6 +183,7 @@ class PluginManager(object): return plugins + def parseUrls(self, urls): """parse plugins for given list of urls""" @@ -217,6 +222,7 @@ class PluginManager(object): print res return res + def findPlugin(self, type, name): if type not in self.plugins: return None @@ -229,6 +235,7 @@ class PluginManager(object): else: return self.plugins[type][name] + def getPlugin(self, type, name, original=False): """return plugin module from hoster|decrypter|container""" plugin = self.findPlugin(type, name) @@ -241,6 +248,7 @@ class PluginManager(object): else: return self.loadModule(type, name) + def getPluginName(self, type, name): """ used to obtain new name if other plugin was injected""" plugin = self.findPlugin(type, name) @@ -253,6 +261,7 @@ class PluginManager(object): return name + def loadModule(self, type, name): """ Returns loaded module for plugin @@ -282,6 +291,7 @@ class PluginManager(object): % {'name': name, 'type': type, 'version': plugins[name]['version']}) return module + def loadClass(self, type, name): """Returns the class of a plugin with the same name""" module = self.loadModule(type, name) @@ -290,10 +300,12 @@ class PluginManager(object): else: return None + def getAccountPlugins(self): """return list of account plugin names""" return self.accountPlugins.keys() + def find_module(self, fullname, path=None): # redirecting imports if necesarry if fullname.startswith(self.ROOT) or fullname.startswith(self.USERROOT): # seperate pyload plugins @@ -312,6 +324,7 @@ class PluginManager(object): if user and not self.plugins[type][name]['user']: return self + def load_module(self, name, replace=True): if name not in sys.modules: # could be already in modules if replace: @@ -333,6 +346,7 @@ class PluginManager(object): return sys.modules[name] + def reloadPlugins(self, type_plugins): """ reload and reindex plugins """ if not type_plugins: @@ -378,6 +392,7 @@ class PluginManager(object): return reloaded #: return a list of the plugins successfully reloaded + def reloadPlugin(self, type_plugin): """ reload and reindex ONE plugin """ return True if self.reloadPlugins(type_plugin) else False |