Reload and reindex all modified plugins
(self)
| 93 | |
| 94 | @Expose |
| 95 | def autoreload_plugins(self): |
| 96 | """ |
| 97 | Reload and reindex all modified plugins |
| 98 | """ |
| 99 | reloads = [] |
| 100 | modules = filter( |
| 101 | lambda m: m and (m.__name__.startswith("module.plugins.") or |
| 102 | m.__name__.startswith("userplugins.")) and |
| 103 | m.__name__.count(".") >= 2, sys.modules.values() |
| 104 | ) |
| 105 | for m in modules: |
| 106 | root, plugin_type, plugin_name = m.__name__.rsplit(".", 2) |
| 107 | plugin_id = (plugin_type, plugin_name) |
| 108 | if plugin_type in self.pyload.pluginManager.plugins: |
| 109 | f = m.__file__.replace(".pyc", ".py") |
| 110 | if not os.path.isfile(f): |
| 111 | continue |
| 112 | |
| 113 | mtime = os.path.getmtime(f) |
| 114 | |
| 115 | if plugin_id not in self.mtimes: |
| 116 | self.mtimes[plugin_id] = mtime |
| 117 | |
| 118 | elif self.mtimes[plugin_id] < mtime: |
| 119 | reloads.append(plugin_id) |
| 120 | self.mtimes[plugin_id] = mtime |
| 121 | |
| 122 | return True if self.pyload.pluginManager.reloadPlugins(reloads) else False |
| 123 | |
| 124 | def server_response(self, line=None): |
| 125 | try: |