diff options
| author | Pepper <pepper@scannerjammer.com> | 2016-03-02 20:24:12 -0500 |
|---|---|---|
| committer | Pepper <pepper@scannerjammer.com> | 2016-03-02 20:24:12 -0500 |
| commit | 1159eacbc62c2ab7c566be078c43c08bdfda8778 (patch) | |
| tree | 0c8c2c2b9f34cb52314b9619d24a916286242e78 /pluginloader.py | |
| parent | dc9ea65dfa903611593da57c397ebc67f26bdea9 (diff) | |
pluginloader
Diffstat (limited to 'pluginloader.py')
| -rw-r--r-- | pluginloader.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/pluginloader.py b/pluginloader.py new file mode 100644 index 0000000..1f568d4 --- /dev/null +++ b/pluginloader.py @@ -0,0 +1,19 @@ +import imp +import os + +PluginFolder = "./photoblaster/modules_src" +MainModule = "__init__" + +def getPlugins(): + plugins = [] + possibleplugins = os.listdir(PluginFolder) + for i in possibleplugins: + location = os.path.join(PluginFolder, i) + if not os.path.isdir(location) or not MainModule + ".py" in os.listdir(location): + continue + info = imp.find_module(MainModule, [location]) + plugins.append({"name": i, "info": info}) + return plugins + +def loadPlugin(plugin): + return imp.load_module(MainModule, *plugin["info"]) |
