- def menuUpdate(self):
- for menuEntry in self.menuEntries:
- menuupdater.addMenuItem(menuEntry[0][0], menuEntry[0][2], menuEntry[1], menuEntry[0][3])
-
- def runPlugin(self, plugin, session):
- try:
- exec "import " + self.prefix + plugin[2] + ".plugin"
- eval(self.prefix + plugin[2] + ".plugin").main(session)
- except:
- print "exec of plugin failed!"
+ for p in plugins_removed:
+ self.removePlugin(p)
+
+ for p in plugins_added:
+ if self.firstRun or p.needsRestart is False:
+ self.addPlugin(p)
+ else:
+ for installed_plugin in self.installedPluginList:
+ if installed_plugin.path == p.path:
+ if installed_plugin.where == p.where:
+ p.needsRestart = False
+ self.addPlugin(p)
+
+ if self.firstRun:
+ self.firstRun = False
+ self.installedPluginList = self.pluginList
+
+ def getPlugins(self, where):
+ """Get list of plugins in a specific category"""
+
+ if not isinstance(where, list):
+ where = [ where ]
+ res = [ ]
+
+ for x in where:
+ res.extend(self.plugins.get(x, [ ]))
+ res.sort(key=lambda x:x.weight)
+ return res
+
+ def getPluginsForMenu(self, menuid):
+ res = [ ]
+ for p in self.getPlugins(PluginDescriptor.WHERE_MENU):
+ res += p(menuid)
+ res.sort(key=lambda x:x.weight)
+ return res
+
+ def clearPluginList(self):
+ self.pluginList = []
+ self.plugins = {}
+
+ def shutdown(self):
+ for p in self.pluginList[:]:
+ self.removePlugin(p)
+
+ def resetWarnings(self):
+ self.warnings = [ ]
+
+ def getNextWakeupTime(self):
+ wakeup = -1
+ for p in self.pluginList:
+ current = p.getWakeupTime()
+ if current > -1 and (wakeup > current or wakeup == -1):
+ wakeup = current
+ return int(wakeup)