MCPcopy Index your code
hub / github.com/pyload/pyload / createIndex

Method createIndex

module/plugins/PluginManager.py:56–115  ·  view source on GitHub ↗

create information for all plugins available

(self)

Source from the content-addressed store, hash-verified

54
55
56 def createIndex(self):
57 """create information for all plugins available"""
58
59 def merge(dst, src, overwrite=False):
60 """merge dict of dicts"""
61 for name in src:
62 if name in dst:
63 if overwrite is True:
64 dst[name].update(src[name])
65 else:
66 for _k in set(src[name].keys()) - set(dst[name].keys()):
67 dst[name][_k] = src[name][_k]
68 else:
69 dst[name] = src[name]
70
71 sys.path.append(abspath(""))
72
73 if not exists("userplugins"):
74 makedirs("userplugins")
75 if not exists(join("userplugins", "__init__.py")):
76 f = open(join("userplugins", "__init__.py"), "wb")
77 f.close()
78
79 self.crypterPlugins , config = self.parse("crypter", pattern=True)
80 self.plugins["crypter"] = self.crypterPlugins
81 default_config = config
82
83 self.containerPlugins, config = self.parse("container", pattern=True)
84 self.plugins["container"] = self.containerPlugins
85 merge(default_config, config)
86
87 self.hosterPlugins, config = self.parse("hoster", pattern=True)
88 self.plugins["hoster"] = self.hosterPlugins
89 merge(default_config, config)
90
91 self.hookPlugins, config = self.parse("hooks")
92 self.plugins["hooks"] = self.hookPlugins
93 merge(default_config, config)
94
95 self.captchaPlugins, config = self.parse("captcha")
96 self.plugins["captcha"] = self.captchaPlugins
97 merge(default_config, config)
98
99 self.accountPlugins, config = self.parse("accounts")
100 self.plugins["accounts"] = self.accountPlugins
101 merge(default_config, config)
102
103 self.internalPlugins, config = self.parse("internal")
104 self.plugins["internal"] = self.internalPlugins
105 merge(default_config, config)
106
107 for name, config in default_config.items():
108 desc = config.pop('desc', "")
109 config = [[k] + list(v) for k, v in config.items()]
110 try:
111 self.core.config.addPluginConfig(name, config, desc)
112 except:
113 self.log.error("Invalid config in %s: %s" % (name, config))

Callers 4

__init__Method · 0.95
indexMethod · 0.45
parentMethod · 0.45
indexMethod · 0.45

Calls 8

parseMethod · 0.95
existsFunction · 0.85
itemsMethod · 0.80
popMethod · 0.80
addPluginConfigMethod · 0.80
appendMethod · 0.45
closeMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected