def textApplicationReady(self, appid): print "[HbbTV].textApplicationReady, appid=%s" % (appid) if config.plugins.hbbtv.text.value: self._textApp = appid app = self.eHbbtv.getApplication(self._textApp) HbbTV.textDescriptor.name = app.getName() plugins.addPlugin(HbbTV.textDescriptor)
def housekeepingExtensionsmenu(el): if el.value: plugins.addPlugin(extDescriptor) else: try: plugins.removePlugin(extDescriptor) except ValueError as ve: doLog("[AutoTimer] housekeepingExtensionsmenu got confused, tried to remove non-existant plugin entry... ignoring.")
def AutozapExtensionsmenu(el): if el.value: plugins.addPlugin(autozapDescriptor) else: try: plugins.removePlugin(autozapDescriptor) except ValueError as ve: print("[EPGRefresh] housekeepingExtensionsmenu got confused, tried to remove non-existant plugin entry... ignoring.")
def AdjustExtensionsmenu(enable, PlugDescriptor): if enable: plugins.addPlugin(PlugDescriptor) else: try: plugins.removePlugin(PlugDescriptor) except ValueError as ve: if PlugDescriptor != extRunDescriptor: print("[EPGRefresh] AdjustExtensionsmenu got confused, tried to remove non-existant plugin entry... ignoring.")
def update_main_menu(cfg_el): print('[e2m3u2b] update main menu', file=log) try: if cfg_el.value: plugins.addPlugin(extDescriptorQuickMain) else: plugins.removePlugin(extDescriptorQuickMain) except Exception as e: print('[e2m3u2b] Failed to update main menu: ', e, file=log)
def update_extensions_menu(cfg_el): print >> log, '[e2m3u2b] update extensions menu' try: if cfg_el.value: plugins.addPlugin(extDescriptor) else: plugins.removePlugin(extDescriptor) except Exception as e: print >> log, '[e2m3u2b] Failed to update extensions menu: ', e
def AdjustPlugin(enable, PlugDescriptor): try: if enable: plugins.addPlugin(PlugDescriptor) else: plugins.removePlugin(PlugDescriptor) except ValueError: pass except: debugOut("AdjustPlugin-Error:\n" + str(format_exc()), forced=True)
def addEventinfomenu(el): if el.value == "1": plugins.addPlugin(eventinfoDescriptor) elif el.value == "3": plugins.addPlugin(eventinfoDescriptor) else: try: plugins.removePlugin(eventinfoDescriptor) except ValueError as ve: print("[EPGRefresh] housekeepingExtensionsmenu got confused, tried to remove non-existant plugin entry... ignoring.")
def update_main_menu(cfg_el): print >> log, '[e2m3u2b] [{}] update main menu'.format( time.strftime('%c', time.localtime(time.time()))) try: if cfg_el.value: plugins.addPlugin(extDescriptorQuickMain) else: plugins.removePlugin(extDescriptorQuickMain) except Exception, e: print >> log, '[e2m3u2b] Failed to update main menu: ', e
def __init__(self, type): global AllSkinUsage global isAllSatDataReady Converter.__init__(self, type) Poll.__init__(self) self.poll_enabled = False self.ECMtype = 0 self.type = type AllSkinUsage = AllSkinUsage + '%s\n' % type if self.type.find('%ECM') != -1 or self.type.find('%Bitr') != -1: self.poll_enabled = True self.poll_interval = 1000 if not isAllSatDataReady: self.getServList(eServiceReference('1:7:1:0:0:0:0:0:0:0:(type == 1) || (type == 17) || (type == 195) || (type == 25) FROM BOUQUET "bouquets.tv" ORDER BY bouquet')) self.getServList(eServiceReference('1:7:2:0:0:0:0:0:0:0:(type == 2) FROM BOUQUET "bouquets.radio" ORDER BY bouquet')) self.CreateSatList() isAllSatDataReady = True try: plugins.addPlugin(PluginDescriptor(name='About MoreInfo', description='About MoreInfo', where=PluginDescriptor.WHERE_MENU, fnc=About)) except: pass self.i = 0
def housekeepingPluginmenu(el): if el.value: plugins.addPlugin(activateDescriptor) else: plugins.removePlugin(activateDescriptor)
def filescan(**kwargs): from Components.Scanner import Scanner, ScanPath return \ Scanner(mimetypes = ["application/x-dream-package"], paths_to_scan = [ ScanPath(path = "dmpkg", with_subdirs = True), ScanPath(path = "", with_subdirs = False), ], name = "Dream-Package", description = _("Install settings, skins, software..."), openfnc = filescan_open, ) print "add dreampackage scanner plugin" plugins.addPlugin( PluginDescriptor(name="Dream-Package", where=PluginDescriptor.WHERE_FILESCAN, fnc=filescan, internal=True)) print "added" wizardManager.registerWizard(DefaultWizard, config.misc.defaultchosen.value, priority=6) if config.misc.defaultchosen.value: print "Installing image defaults" installer = ImageDefaultInstaller() print "installing done!"
def filescan_open(list, session, **kwargs): from Screens.ChoiceBox import ChoiceBox print "open default wizard" filelist = [(os_path.split(x.path)[1], x.path, session) for x in list] print filelist session.openWithCallback(install, ChoiceBox, title = _("Please choose he package..."), list=filelist) def filescan(**kwargs): from Components.Scanner import Scanner, ScanPath return \ Scanner(mimetypes = ["application/x-dream-package"], paths_to_scan = [ ScanPath(path = "dmpkg", with_subdirs = True), ScanPath(path = "", with_subdirs = False), ], name = "Dream-Package", description = _("Install settings, skins, software..."), openfnc = filescan_open, ) print "add dreampackage scanner plugin" plugins.addPlugin(PluginDescriptor(name="Dream-Package", where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan, internal = True)) print "added" wizardManager.registerWizard(DefaultWizard, config.misc.defaultchosen.value, priority = 6) if config.misc.defaultchosen.value: print "Installing image defaults" installer = ImageDefaultInstaller() print "installing done!"
def redButtonAppplicationReady(self, appid): print "[HbbTV].readButtonApplicationReady, appid=%s" % (appid) self._redButtonApp = appid app = self.eHbbtv.getApplication(self._redButtonApp) HbbTV.redButtonDescriptor.name = app.getName() plugins.addPlugin(HbbTV.redButtonDescriptor)
def autostart(reason, *args, **kwargs): if reason == 0: if hasattr(PluginComponent, 'pluginSort_baseAddPlugin'): print("[PluginSort] Something went wrong as our autostart handler was called multiple times for startup, printing traceback and ignoring.") import traceback, sys traceback.print_stack(limit=5, file=sys.stdout) else: PluginComponent.pluginSort_baseAddPlugin = PluginComponent.addPlugin PluginComponent.addPlugin = PluginComponent_addPlugin # we use a copy for installed plugins because we might change the 'where'-lists plugins.installedPluginList = plugins.pluginList[:] def PluginComponent__setattr__(self, key, value): if key == 'installedPluginList': return else: self.__dict__[key] = value PluginComponent.__setattr__ = PluginComponent__setattr__ if hasattr(plugins, 'pluginHider_baseGetPlugins'): pluginlist = plugins.pluginHider_baseGetPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_MOVIELIST, PluginDescriptor.WHERE_EVENTINFO]) else: pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_MOVIELIST, PluginDescriptor.WHERE_EVENTINFO]) # "fix" weight of plugins already added to list, future ones will be fixed automatically fixed = [] for plugin in pluginlist: if plugin in fixed: continue # skip double entries # create individual entries for multiple wheres, this is potentially harmful! if len(plugin.where) > 1: # remove all entries except for a potential autostart one (highly unlikely to mix autostart with one of the above, but you never know :D) if PluginDescriptor.WHERE_AUTOSTART in plugin.where: plugin.where.remove(PluginDescriptor.WHERE_AUTOSTART) hadAutostart = True else: hadAutostart = False plugins.removePlugin(plugin) plugins.addPlugin(plugin) # this is our own addPlugin now, which automatically creates copies # HACK: re-add autostart entry to internal list inside PluginComponent if hadAutostart: plugin.where = [ PluginDescriptor.WHERE_AUTOSTART ] plugins.pluginList.append(plugin) # we're keeping the entry, just fix the weight else: newWeight = pluginWeights.get(plugin) print("[PluginSort] Fixing weight for %s (was %d, now %d)" % (plugin.name, plugin.weight, newWeight)) plugin.weight = newWeight fixed.append(plugin) # let movieepg fix extensions list sorting if installed, else do this ourselves if not fileExists(resolveFilename(SCOPE_PLUGINS, "Extensions/MovieEPG/plugin.py")): def InfoBarPlugins_getPluginList(self, *args, **kwargs): l = InfoBarPlugins.pluginSort_baseGetPluginList(self, *args, **kwargs) try: l.sort(key=lambda e: (e[0][1].args[0].weight, e[2])) except Exception as e: print("[PluginSort] Failed to sort extensions", e) return l InfoBarPlugins.pluginSort_baseGetPluginList = InfoBarPlugins.getPluginList InfoBarPlugins.getPluginList = InfoBarPlugins_getPluginList PluginBrowser.PluginBrowser = SortingPluginBrowser else: if hasattr(PluginComponent, 'pluginSort_baseAddPlugin'): PluginComponent.addPlugin = PluginComponent.pluginSort_baseAddPlugin del PluginComponent.pluginSort_baseAddPlugin if hasattr(InfoBarPlugins, 'pluginSort_baseGetPluginList'): InfoBarPlugins.getPluginList = InfoBarPlugins.pluginSort_baseGetPluginList del InfoBarPlugins.pluginSort_baseGetPluginList PluginBrowser.PluginBrowser = OriginalPluginBrowser
def autostart(reason, *args, **kwargs): if reason == 0: if hasattr(PluginComponent, 'pluginSort_baseAddPlugin'): print( "[PluginSort] Something went wrong as our autostart handler was called multiple times for startup, printing traceback and ignoring." ) import traceback, sys traceback.print_stack(limit=5, file=sys.stdout) else: PluginComponent.pluginSort_baseAddPlugin = PluginComponent.addPlugin PluginComponent.addPlugin = PluginComponent_addPlugin # we use a copy for installed plugins because we might change the 'where'-lists plugins.installedPluginList = plugins.pluginList[:] def PluginComponent__setattr__(self, key, value): if key == 'installedPluginList': return else: self.__dict__[key] = value PluginComponent.__setattr__ = PluginComponent__setattr__ if hasattr(plugins, 'PluginComponent.pluginHider_baseGetPlugins'): pluginlist = plugins.pluginHider_baseGetPlugins([ PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_MOVIELIST, PluginDescriptor.WHERE_EVENTINFO ]) else: pluginlist = plugins.getPlugins([ PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_MOVIELIST, PluginDescriptor.WHERE_EVENTINFO ]) # "fix" weight of plugins already added to list, future ones will be fixed automatically fixed = [] for plugin in pluginlist: if plugin in fixed: continue # skip double entries # create individual entries for multiple wheres, this is potentially harmful! if len(plugin.where) > 1: # remove all entries except for a potential autostart one (highly unlikely to mix autostart with one of the above, but you never know :D) if PluginDescriptor.WHERE_AUTOSTART in plugin.where: plugin.where.remove(PluginDescriptor.WHERE_AUTOSTART) hadAutostart = True else: hadAutostart = False plugins.removePlugin(plugin) plugins.addPlugin( plugin ) # this is our own addPlugin now, which automatically creates copies # HACK: re-add autostart entry to internal list inside PluginComponent if hadAutostart: plugin.where = [PluginDescriptor.WHERE_AUTOSTART] plugins.pluginList.append(plugin) # we're keeping the entry, just fix the weight else: newWeight = pluginWeights.get(plugin) print( "[PluginSort] Fixing weight for %s (was %d, now %d)" % (plugin.name, plugin.weight, newWeight)) plugin.weight = newWeight fixed.append(plugin) # let movieepg fix extensions list sorting if installed, else do this ourselves if not fileExists( resolveFilename(SCOPE_PLUGINS, "Extensions/MovieEPG/plugin.py")): def InfoBarPlugins_getPluginList(self, *args, **kwargs): l = InfoBarPlugins.pluginSort_baseGetPluginList( self, *args, **kwargs) try: l.sort(key=lambda e: (e[0][1].args[0].weight, e[2])) except Exception as e: print("[PluginSort] Failed to sort extensions", e) return l InfoBarPlugins.pluginSort_baseGetPluginList = InfoBarPlugins.getPluginList InfoBarPlugins.getPluginList = InfoBarPlugins_getPluginList PluginBrowser.PluginBrowser = SortingPluginBrowser else: if hasattr(PluginComponent, 'pluginSort_baseAddPlugin'): PluginComponent.addPlugin = PluginComponent.pluginSort_baseAddPlugin del PluginComponent.pluginSort_baseAddPlugin if hasattr(InfoBarPlugins, 'pluginSort_baseGetPluginList'): InfoBarPlugins.getPluginList = InfoBarPlugins.pluginSort_baseGetPluginList del InfoBarPlugins.pluginSort_baseGetPluginList PluginBrowser.PluginBrowser = OriginalPluginBrowser
def housekeepingExtensionsmenu(el): if el.value: plugins.addPlugin(extDescriptor) else: plugins.removePlugin(extDescriptor)