Ejemplo n.º 1
0
	def aitInvalidated(self):
		print "[HbbTV].aitInvalidated"
		self._redButtonApp = None
		self._textApp = None
		if plugins.getPlugins(PluginDescriptor.WHERE_HBBTV).count(HbbTV.redButtonDescriptor) > 0:
			plugins.removePlugin(HbbTV.redButtonDescriptor)
		if plugins.getPlugins(PluginDescriptor.WHERE_TELETEXT).count(HbbTV.textDescriptor) > 0:
			plugins.removePlugin(HbbTV.textDescriptor)
Ejemplo n.º 2
0
	def getSubEntry(self, menuID, list):
		if menuID is None:
			for l in plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU):
				if isinstance(l.iconstr, str):
					menuitem = [l.name, '/'.join((l.path, l.iconstr)), boundFunction(self.runPlugin, (l, None)), l.weight]
				else:
					menuitem = [l.name, '', boundFunction(self.runPlugin, (l, None)), l.weight]
				if l.name in [
					_("Front Panel Update"),
					_("CrossEPG Downloader"),
					_("OpenWebif"),
					_("Software management"),
					_("MediaPortal"),
					_("AutoTimer"),
					_("Picture player"),
					_("YouTube TV Settings")]:
					print "Skip =>", l.name
				else:
					list.append(tuple(menuitem))
		else:
			for l in plugins.getPluginsForMenu(menuID):
				if len(l) > 5:
					menuitem = [l[0], l[2], boundFunction(self.runPlugin, (l[1], l[6])), l[3] or 50]
				else:
					menuitem = [l[0], l[2], boundFunction(self.runPlugin, (l[1], None)), l[3] or 50]
				if l[0] in [
					_("Front Panel Update"),
					_("CrossEPG Downloader"),
					_("OpenWebif"),
					_("Software management"),
					_("MediaPortal"),
					_("Picture player"),
					_("YouTube TV Settings")]:
					print "Skip =>", l.name
				else:
					list.append(tuple(menuitem))
			# This is little HACK to show AutoTimer in TV section, as We do not want to clone AutTimer git and reqwrite it to show in our section
			for l in plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU):
				if l.name == _("AutoTimer"):
					if menuID == "id_mainmenu_tv":
						if isinstance(l.iconstr, str):
							menuitem = [l.name, '/'.join((l.path, l.iconstr)), boundFunction(self.runPlugin, (l, None)), 60]
						else:
							menuitem = [l.name, '', boundFunction(self.runPlugin, (l, None)), 60]
						list.append(tuple(menuitem))
		try:
			list.sort(key=lambda x: int(x[3]))
		except:
			list.sort(key=lambda x: x[3])

		return list
Ejemplo n.º 3
0
	def Save(self):
		self.saveAll()
		if not config.plugins.autotimer.show_in_plugins.value:
			for plugin in plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU):
				if plugin.name == "AutoTimer":
					plugins.removePlugin(plugin)

		if not config.plugins.autotimer.show_in_extensionsmenu.value:
			for plugin in plugins.getPlugins(PluginDescriptor.WHERE_EXTENSIONSMENU):
				if plugin.name == "AutoTimer":
					plugins.removePlugin(plugin)
				
		plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
		self.close()
def removeExtension():
	# Remove from extension menu
	from Components.PluginComponent import plugins
	from Plugins.Extensions.InfoBarTunerState.plugin import IBTSSHOW, IBTSSETUP
	if config.infobartunerstate.extensions_menu_show.value:
		for p in plugins.getPlugins( where = PluginDescriptor.WHERE_EXTENSIONSMENU ):
			if p.name == IBTSSHOW:
				plugins.plugins[PluginDescriptor.WHERE_EXTENSIONSMENU].remove(p)
				break
	if config.infobartunerstate.extensions_menu_setup.value:
		for p in plugins.getPlugins( where = PluginDescriptor.WHERE_EXTENSIONSMENU ):
			if p.name == IBTSSETUP:
				plugins.plugins[PluginDescriptor.WHERE_EXTENSIONSMENU].remove(p)
				break
Ejemplo n.º 5
0
	def genMainMenu(self):
		menu = []
		menu.append((_("Adapter settings"), "edit"))
		menu.append((_("Nameserver settings"), "dns"))
		menu.append((_("Network test"), "test"))
		menu.append((_("Restart network"), "lanrestart"))

		self.extended = None
		self.extendedSetup = None
		for p in plugins.getPlugins(PluginDescriptor.WHERE_NETWORKSETUP):
			callFnc = p.__call__["ifaceSupported"](self.iface)
			if callFnc is not None:
				self.extended = callFnc
				if "WlanPluginEntry" in p.__call__: # internally used only for WLAN Plugin
					menu.append((_("Scan wireless networks"), "scanwlan"))
					if iNetwork.getAdapterAttribute(self.iface, "up"):
						menu.append((_("Show WLAN status"), "wlanstatus"))
				else:
					if "menuEntryName" in p.__call__:
						menuEntryName = p.__call__["menuEntryName"](self.iface)
					else:
						menuEntryName = _('Extended setup...')
					if "menuEntryDescription" in p.__call__:
						menuEntryDescription = p.__call__["menuEntryDescription"](self.iface)
					else:
						menuEntryDescription = _('Extended network setup plugin...')
					self.extendedSetup = ('extendedSetup',menuEntryDescription, self.extended)
					menu.append((menuEntryName,self.extendedSetup))

		if os.path.exists(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkWizard/networkwizard.xml")):
			menu.append((_("Network wizard"), "openwizard"))

		return menu
Ejemplo n.º 6
0
	def updateList(self):
		self.pluginlist = plugins.getPlugins(self.where)
		if self.where in (PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU):
			self.pluginlist.sort(key=attrgetter('weight', 'name')) # sort first by weight, then by name; we get pretty much a weight sorted but otherwise random list
		else: #if self.where in (PluginDescriptor.WHERE_EVENTINFO, PluginDescriptor.WHERE_MOVIELIST):
			self.pluginlist.sort(key=attrgetter('weight'))
		self.list = [PluginEntryComponent(plugin) for plugin in self.pluginlist]
		self["list"].l.setList(self.list)
		if self.where == PluginDescriptor.WHERE_PLUGINMENU:
			if fileExists(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/plugin.py")):
				# TRANSLATORS: leaving this empty is encouraged to not cause any confusion (this string was taken directly from the standard PluginBrowser)
				self["red"].setText(_("Manage extensions"))
				self["green"].setText(_("Sort") if not self.movemode else _("End Sort"))
				self["SoftwareActions"].setEnabled(True)
				self["PluginDownloadActions"].setEnabled(False)
				self["ColorActions"].setEnabled(True)
			else:
				# TRANSLATORS: leaving this empty is encouraged to not cause any confusion (this string was taken directly from the standard PluginBrowser)
				self["red"].setText(_("Remove Plugins"))
				# TRANSLATORS: leaving this empty is encouraged to not cause any confusion (this string was taken directly from the standard PluginBrowser)
				self["green"].setText(_("Download Plugins"))
				self["SoftwareActions"].setEnabled(False)
				self["PluginDownloadActions"].setEnabled(True)
				self["ColorActions"].setEnabled(False)
		else:
			self["red"].setText("")
			self["green"].setText(_("Sort") if not self.movemode else _("End Sort"))
			self["SoftwareActions"].setEnabled(False)
			self["PluginDownloadActions"].setEnabled(False)
			self["ColorActions"].setEnabled(True)
Ejemplo n.º 7
0
    def updateList(self):
        self.pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU)
        sorted_dict = {}
        self.list = []
        mylist = []
        if fileExists("/etc/bh_plugins.pos") == False:
            i = 1
            out = open("/etc/bh_plugins.pos", "w")
            for plugin in self.pluginlist:
                line = "%s:%d\n" % (plugin.name, i)
                out.write(line)
                i += 1

            out.close()
        f = open("/etc/bh_plugins.pos", "rb")
        for line in f.readlines():
            d = line.split(":", 1)
            if len(d) > 1:
                sorted_dict[d[0].strip()] = int(d[1].strip())
            f.close()

        for plugin in self.pluginlist:
            pos = sorted_dict.get(plugin.name, 99)
            if plugin.icon is None:
                png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/plugin.png"))
            else:
                png = plugin.icon
            res = (plugin.name, plugin.description, png, plugin, pos)
            mylist.append(res)

        self.list = sorted(mylist, key=itemgetter(4))
        self["list"].list = self.list
Ejemplo n.º 8
0
def startPlugin(self, pname):
    msgText = _("Unknown Error")
    no_plugin = True
    if pname != _("Nothing"):
        if pname == _("Single EPG"):
            from Screens.InfoBarGenerics import InfoBarEPG

            if isinstance(self, InfoBarEPG):
                self.openSingleServiceEPG()
            no_plugin = False
        elif pname == _("Multi EPG"):
            from Screens.InfoBarGenerics import InfoBarEPG

            if isinstance(self, InfoBarEPG):
                self.openMultiServiceEPG()
            no_plugin = False
        elif pname == _("MediaPlayer"):
            try:  # falls es nicht installiert ist
                from Plugins.Extensions.MediaPlayer.plugin import MediaPlayer

                self.session.open(MediaPlayer)
                no_plugin = False
            except Exception, e:
                msgText = _("Error!\nError Text: %s" % e)
        elif pname == _("Plugin browser"):
            from Screens.PluginBrowser import PluginBrowser

            self.session.open(PluginBrowser)
            no_plugin = False
        elif pname == _("switch 4:3 content display"):
            ar = {"pillarbox": _("Pillarbox"), "panscan": _("Pan&Scan"), "scale": _("Just Scale")}
            switch = {"pillarbox": "panscan", "panscan": "scale", "scale": "pillarbox"}
            config.av.policy_43.value = switch[config.av.policy_43.value]
            config.av.policy_43.save()
            self.session.open(
                MessageBox,
                _("Display 4:3 content as") + " " + ar[config.av.policy_43.value],
                MessageBox.TYPE_INFO,
                timeout=3,
            )
            no_plugin = False
        elif pname == _("Timer"):
            from Screens.TimerEdit import TimerEditList

            self.session.open(TimerEditList)
            no_plugin = False
        else:
            plugin = None
            for p in plugins.getPlugins(
                where=[PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_PLUGINMENU]
            ):
                if pname == str(p.name):
                    plugin = p
            if plugin is not None:
                try:
                    self.runPlugin(plugin)
                    no_plugin = False
                except Exception, e:
                    msgText = _("Error!\nError Text: %s" % e)
            else:
Ejemplo n.º 9
0
def openList(session, files):
    if not isinstance(files, list):
        files = [files]

    scanner = []

    for p in plugins.getPlugins(PluginDescriptor.WHERE_FILESCAN):
        l = p()
        if not isinstance(l, list):
            l = [l]
        scanner += l

    print "scanner:", scanner

    res = {}

    for file in files:
        for s in scanner:
            s.handleFile(res, file)

    choices = [(r.description, r, res[r], session) for r in res]
    Len = len(choices)
    if Len > 1:
        from Screens.ChoiceBox import ChoiceBox

        session.openWithCallback(execute, ChoiceBox, title="The following viewers were found...", list=choices)
        return True
    elif Len:
        execute(choices[0])
        return True

    return False
Ejemplo n.º 10
0
	def __init__(self, session, csel, service):
		Screen.__init__(self, session)
		self.csel = csel
		self.service = service

		self["actions"] = ActionMap(["OkCancelActions"],
			{
				"ok": self.okbuttonClick,
				"cancel": self.cancelClick
			})

		menu = [(_("delete..."), self.delete)]
		menu.extend([(p.description, boundFunction(self.execPlugin, p)) for p in plugins.getPlugins(PluginDescriptor.WHERE_MOVIELIST)])

		if config.movielist.moviesort.value == MovieList.SORT_ALPHANUMERIC:
			menu.append((_("sort by date"), boundFunction(self.sortBy, MovieList.SORT_RECORDED)))
		else:
			menu.append((_("alphabetic sort"), boundFunction(self.sortBy, MovieList.SORT_ALPHANUMERIC)))
		
		menu.extend((
			(_("list style default"), boundFunction(self.listType, MovieList.LISTTYPE_ORIGINAL)),
			(_("list style compact with description"), boundFunction(self.listType, MovieList.LISTTYPE_COMPACT_DESCRIPTION)),
			(_("list style compact"), boundFunction(self.listType, MovieList.LISTTYPE_COMPACT)),
			(_("list style single line"), boundFunction(self.listType, MovieList.LISTTYPE_MINIMAL))
		))

		if config.movielist.description.value == MovieList.SHOW_DESCRIPTION:
			menu.append((_("hide extended description"), boundFunction(self.showDescription, MovieList.HIDE_DESCRIPTION)))
		else:
			menu.append((_("show extended description"), boundFunction(self.showDescription, MovieList.SHOW_DESCRIPTION)))
		self["menu"] = MenuList(menu)
Ejemplo n.º 11
0
 def runPlugin(self, name):
     pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU)
     for plugin in pluginlist:
         x = PluginEntryComponent(plugin)
         if x[1][7] == name:
             x[0](session=self.session)
             return
Ejemplo n.º 12
0
    def updateList(self):
        self.list = []
        mylist = []
        sorted_dict = {}
        f = open('/etc/bh_plugins.pos', 'rb')
        for line in f.readlines():
            d = line.split(':', 1)
            if len(d) > 1:
                sorted_dict[d[0].strip()] = int(d[1].strip())
            f.close()

        self.pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU)
        for plugin in self.pluginlist:
            pos = sorted_dict.get(plugin.name, 99)
            res = (plugin.name, pos)
            mylist.append(res)

        mylist2 = sorted(mylist, key=itemgetter(1))
        for x in mylist2:
            item = NoSave(ConfigInteger(limits=(1, 99), default=99))
            item.value = x[1]
            res = getConfigListEntry(x[0], item)
            self.list.append(res)

        self['config'].list = self.list
        self['config'].l.setList(self.list)
Ejemplo n.º 13
0
	def __init__(self, session, path=None, args=None):
		Screen.__init__(self, session)
		self.session = session
		self.menu = args
		self.e = None
		xml_file = '/etc/openpanel.xml'
		if path:
			xml_file = path
		try:
			self.Desktop_width = getDesktop(0).size().width()
			self.Desktop_height = getDesktop(0).size().height()
		except:
			self.Desktop_width = 720
			self.Desktop_height = 576
#		print "[OpenPanel] Desktop size: ", self.Desktop_width, self.Desktop_height
		self.zapHistory = [None]
		self.pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO])
		try:
			parser = minidom.parse(xml_file)
			self.currentNode = parser.documentElement
			self.getList(self.makeEntrys(self.currentNode)[0], self.makeEntrys(self.currentNode)[1])
			self["list"] = OpenPanelList(list = self.list, selection = 0)
			self["summary_list"] = StaticText()
			self.updateSummary()
			
		except Exception, e:
			self.e = e
			self["list"] = OpenPanelList(None)
Ejemplo n.º 14
0
 def runExtension(self, name, servicelist):
     pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EXTENSIONSMENU)
     for plugin in pluginlist:
         x = PluginEntryComponent(plugin)
         if x[1][7] == name:
             x[0](session=self.session, servicelist=servicelist)
             return
Ejemplo n.º 15
0
	def __init__(self, session, csel, service):
		Screen.__init__(self, session)

		self["actions"] = ActionMap(["OkCancelActions"],
			{
				"ok": self.okbuttonClick,
				"cancel": self.cancelClick
			})

		menu = []
		if service:
		 	if (service.flags & eServiceReference.mustDescent):
				if isTrashFolder(service):
					menu.append((_("Permanently remove all deleted items"), csel.purgeAll))
				else:
					menu.append((_("Move"), csel.moveMovie))
			else:
				menu = [(_("Delete"), csel.delete),
					(_("Move"), csel.moveMovie),
					(_("Copy"), csel.copyMovie),
					(_("Reset playback position"), csel.resetMovie),
					]
				# Plugins expect a valid selection, so only include them if we selected a non-dir 
				menu.extend([(p.description, boundFunction(p, session, service)) for p in plugins.getPlugins(PluginDescriptor.WHERE_MOVIELIST)])

		menu.append((_("Settings") + "...", csel.configure))
		self["menu"] = MenuList(menu)
Ejemplo n.º 16
0
def addSeriesPlugin(menu, title, fnc=None):
	# Add to menu
	if( menu == WHERE_EPGMENU ):
		SPEPGSelectionInit()
	elif( menu == WHERE_CHANNELMENU ):
		try:
			addSeriesPlugin(PluginDescriptor.WHERE_CHANNEL_CONTEXT_MENU, SHOWINFO, fnc)
		except:
			SPChannelContextMenuInit()
	else:
		from Components.PluginComponent import plugins
		if plugins:
			for p in plugins.getPlugins( where = menu ):
				if p.name == title:
					# Plugin is already in menu
					break
			else:
				# Plugin not in menu - add it
				plugin = PluginDescriptor(
																name = title,
																description = title,
																where = menu,
																needsRestart = False,
																fnc = fnc)
				if menu in plugins.plugins:
					plugins.plugins[ menu ].append(plugin)
Ejemplo n.º 17
0
    def __init__(self, desktop=None, summary_desktop=None, navigation=None):
        self.desktop = desktop
        self.summary_desktop = summary_desktop
        self.nav = navigation
        self.delay_timer = enigma.eTimer()
        self.delay_timer.callback.append(self.processDelay)

        self.current_dialog = None

        self.dialog_stack = []
        self.summary_stack = []
        self.summary = None

        self.in_exec = False

        self.screen = SessionGlobals(self)

        for p in plugins.getPlugins(PluginDescriptor.WHERE_SESSIONSTART):
            try:
                p(reason=0, session=self)
            except:
                print "Plugin raised exception at WHERE_SESSIONSTART"
                import traceback

                traceback.print_exc()
Ejemplo n.º 18
0
	def save(self):
		#print "saving"
		self.updateTimer.stop()
		self.saveAll()
		if not config.plugins.xmltvimport.showinplugins.value:
			for plugin in plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU):
				if plugin.name == _("XMLTV-Importer"):
					plugins.removePlugin(plugin)

		if not config.plugins.xmltvimport.showinextensions.value:
			for plugin in plugins.getPlugins(PluginDescriptor.WHERE_EXTENSIONSMENU):
				if plugin.name == _("XMLTV-Importer"):
					plugins.removePlugin(plugin)
				
		plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
		self.close(True,self.session)
Ejemplo n.º 19
0
def scanDevice(mountpoint):
    scanner = []
    for p in plugins.getPlugins(PluginDescriptor.WHERE_FILESCAN):
        l = p()
        if not isinstance(l, list):
            l = [l]
        scanner += l

    print 'scanner:', scanner
    res = {}
    paths_to_scan = set()
    for s in scanner:
        paths_to_scan.update(set(s.paths_to_scan))

    for p in paths_to_scan:
        if p.with_subdirs == True and ScanPath(path=p.path) in paths_to_scan:
            paths_to_scan.remove(ScanPath(path=p.path))

    for p in paths_to_scan:
        path = os.path.join(mountpoint, p.path)
        for root, dirs, files in os.walk(path):
            for f in files:
                path = os.path.join(root, f)
                if f.endswith('.wav') and f.startswith('track'):
                    sfile = ScanFile(path, 'audio/x-cda')
                else:
                    sfile = ScanFile(path)
                for s in scanner:
                    s.handleFile(res, sfile)

            if not p.with_subdirs:
                del dirs[:]

    return res
Ejemplo n.º 20
0
def isExtension_installed(pname):
	try:
		for plugin in plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU,PluginDescriptor.WHERE_EXTENSIONSMENU]):
			if plugin.name == pname:
				return True
				break
	except:
		return False
def removeExtension():
	# Remove from extension menu
	from Components.PluginComponent import plugins
	from Plugins.Extensions.InfoBarTunerState.plugin import NAME, DESCRIPTION
	for p in plugins.getPlugins( where = PluginDescriptor.WHERE_EXTENSIONSMENU ):
		if p.name == NAME:
			plugins.plugins[PluginDescriptor.WHERE_EXTENSIONSMENU].remove(p)
			break
Ejemplo n.º 22
0
	def getPlugins(self):
		plist = []
		pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU)
		for plugin in pluginlist:
			plist.append(PluginEntryComponent(plugin))
		for p in plist:
			if (p[0].name.find("EPGSearch") != -1):
				self.epgserchplugin = p[0]
Ejemplo n.º 23
0
	def openEPGSearch(self):
		try:
			for plugin in plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU ,PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO]):
				if plugin.name == _("EPGSearch") or plugin.name == _("search EPG...") or plugin.name == "Durchsuche EPG...":
					self.runPlugin(plugin)
					break
		except Exception, e:
			self.session.open(MessageBox, _("The EPGSearch plugin is not installed!\nPlease install it."), type = MessageBox.TYPE_INFO,timeout = 10 )
Ejemplo n.º 24
0
	def openIMDB(self):
		try:
			for plugin in plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU ,PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO]):
				if plugin.name == _("IMDb Details"):
					self.runPlugin(plugin)
					break
		except Exception, e:
			self.session.open(MessageBox, _("The IMDb plugin is not installed!\nPlease install it."), type = MessageBox.TYPE_INFO,timeout = 10 )
Ejemplo n.º 25
0
	def getPluginList(self):
		from Components.PluginComponent import plugins
		list = []
		for p in plugins.getPlugins(where = PluginDescriptor.WHERE_EXTENSIONSMENU):
			if p.name != _('YouTube'):
				list.append(((boundFunction(self.getPluginName, p.name),
					boundFunction(self.runPlugin, p), lambda: True), None))
		return list
Ejemplo n.º 26
0
 def getPluginList(self):
     list = []
     for p in plugins.getPlugins(where=PluginDescriptor.WHERE_EXTENSIONSMENU):
         if (p.name != _("P**n Center")) and (p.name != config.plugins.PornCenter.name.value):
             list.append(
                 ((boundFunction(self.getPluginName, p.name), boundFunction(self.runPlugin, p), lambda: True), None)
             )
     return list
Ejemplo n.º 27
0
	def keySave(self):
		self.saveAll()
		if not config.plugins.imdb.showinplugins.value:
			for plugin in plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU):
				if plugin.name == _("IMDb Details"):
					plugins.removePlugin(plugin)

		plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
		self.close()
Ejemplo n.º 28
0
	def execHotkey(self, selected):
		if selected:
			selected = selected[1].split("/")
			if selected[0] == "Plugins":
				twinPlugins = []
				twinPaths = {}
				pluginlist = plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU ,PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO])
				pluginlist.sort(key=lambda p: p.name)
				for plugin in pluginlist:
					if plugin.name not in twinPlugins and plugin.path:
						if twinPaths.has_key(plugin.path[24:]):
							twinPaths[plugin.path[24:]] += 1
						else:
							twinPaths[plugin.path[24:]] = 1
						if plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]])== "/".join(selected):
							self.runPlugin(plugin)
							break
						twinPlugins.append(plugin.name)
			elif selected[0] == "MenuPlugin":
				for plugin in plugins.getPluginsForMenu(selected[1]):
					if plugin[2] == selected[2]:
						self.runPlugin(plugin[1])
						break
			elif selected[0] == "Infobar":
				if hasattr(self, selected[1]):
					exec "self." + ".".join(selected[1:]) + "()"
				else:
					return 0
			elif selected[0] == "Module":
				try:
					exec "from " + selected[1] + " import *"
					exec "self.session.open(" + ",".join(selected[2:]) + ")"
				except:
					print "[Hotkey] error during executing module %s, screen %s" % (selected[1], selected[2])
			elif selected[0] == "Setup":
				exec "from Screens.Setup import *"
				exec "self.session.open(Setup, \"" + selected[1] + "\")"
			elif selected[0].startswith("Zap"):
				if selected[0] == "ZapPanic":
					self.servicelist.history = []
				self.servicelist.servicelist.setCurrent(eServiceReference("/".join(selected[1:])))
				self.servicelist.zap(enable_pipzap = True)
				if hasattr(self, "lastservice"):
					self.lastservice = eServiceReference("/".join(selected[1:]))
					self.close()
				else:
					self.show()
			elif selected[0] == "PPanel":
				ppanelFileName = '/etc/ppanels/' + selected[1] + ".xml"
				if os.path.isfile(ppanelFileName) and os.path.isdir('/usr/lib/enigma2/python/Plugins/Extensions/PPanel'):
					from Plugins.Extensions.PPanel.ppanel import PPanel
					self.session.open(PPanel, name=selected[1] + ' PPanel', node=None, filename=ppanelFileName, deletenode=None)
			elif selected[0] == "Shellscript":
				command = '/etc/shellscripts/' + selected[1] + ".sh"
				if os.path.isfile(command) and os.path.isdir('/usr/lib/enigma2/python/Plugins/Extensions/PPanel'):
					from Plugins.Extensions.PPanel.ppanel import Execute
					self.session.open(Execute, selected[1] + " shellscript", None, command)
Ejemplo n.º 29
0
	def doContext(self):
		if self.event:
			menu = []
			for p in plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO):
				#only list service or event specific eventinfo plugins here, no servelist plugins
				if 'servicelist' not in p.__call__.func_code.co_varnames:
					menu.append((p.name, boundFunction(self.runPlugin, p)))
			if menu:
				self.session.open(EventViewContextMenu, menu)
Ejemplo n.º 30
0
    def openAutoTimerList(self):
        try:
            for plugin in plugins.getPlugins([PluginDescriptor.WHERE_PLUGINMENU, PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO]):
                if plugin.name == _('AutoTimer'):
                    self.runPlugin(plugin)
                    break

        except Exception as e:
            self.session.open(MessageBox, _('The AutoTimer plugin is not installed!\nPlease install it.'), type=MessageBox.TYPE_INFO, timeout=10)
Ejemplo n.º 31
0
def getButtonSetupFunctions():
    ButtonSetupFunctions = []
    twinPlugins = []
    twinPaths = {}
    pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO)
    pluginlist.sort(key=lambda p: p.name)
    for plugin in pluginlist:
        if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames:
            if twinPaths.has_key(plugin.path[plugin.path.rfind("Plugins"):]):
                twinPaths[plugin.path[plugin.path.rfind("Plugins"):]] += 1
            else:
                twinPaths[plugin.path[plugin.path.rfind("Plugins"):]] = 1
            ButtonSetupFunctions.append(
                (plugin.name,
                 plugin.path[plugin.path.rfind("Plugins"):] + "/" +
                 str(twinPaths[plugin.path[plugin.path.rfind("Plugins"):]]),
                 "EPG"))
            twinPlugins.append(plugin.name)
    pluginlist = plugins.getPlugins([
        PluginDescriptor.WHERE_PLUGINMENU,
        PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO
    ])
    pluginlist.sort(key=lambda p: p.name)
    for plugin in pluginlist:
        if plugin.name not in twinPlugins and plugin.path:
            if twinPaths.has_key(plugin.path[plugin.path.rfind("Plugins"):]):
                twinPaths[plugin.path[plugin.path.rfind("Plugins"):]] += 1
            else:
                twinPaths[plugin.path[plugin.path.rfind("Plugins"):]] = 1
            ButtonSetupFunctions.append(
                (plugin.name,
                 plugin.path[plugin.path.rfind("Plugins"):] + "/" +
                 str(twinPaths[plugin.path[plugin.path.rfind("Plugins"):]]),
                 "Plugins"))
            twinPlugins.append(plugin.name)
    ButtonSetupFunctions.append(
        (_("Show graphical multi EPG"), "Infobar/openGraphEPG", "EPG"))
    ButtonSetupFunctions.append(
        (_("Main menu"), "Infobar/mainMenu", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show help"), "Infobar/showHelp", "InfoBar"))
    ButtonSetupFunctions.append((_("Show extension selection"),
                                 "Infobar/showExtensionSelection", "InfoBar"))
    ButtonSetupFunctions.append((_("Zap down"), "Infobar/zapDown", "InfoBar"))
    ButtonSetupFunctions.append((_("Zap up"), "Infobar/zapUp", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show service list"), "Infobar/openServiceList", "InfoBar"))
    ButtonSetupFunctions.append((_("Show service list or movies"),
                                 "Infobar/showServiceListOrMovies", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show movies"), "Infobar/showMovies", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Restart last movie"), "Infobar/restartLastMovie", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show favourites list"), "Infobar/openFavouritesList", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("History back"), "Infobar/historyBack", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("History next"), "Infobar/historyNext", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show event info plugins"), "Infobar/showEventInfoPlugins", "EPG"))
    ButtonSetupFunctions.append(
        (_("Show event details"), "Infobar/openEventView", "EPG"))
    ButtonSetupFunctions.append((_("Show EPG for current service"),
                                 "Infobar/openSingleServiceEPG", "EPG"))
    ButtonSetupFunctions.append(
        (_("Show multi EPG"), "Infobar/openMultiServiceEPG", "EPG"))
    ButtonSetupFunctions.append(
        (_("Show select audio track"), "Infobar/audioSelection", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show subtitle selection"), "Infobar/subtitleSelection", "InfoBar"))
    ButtonSetupFunctions.append((_("Toggle default subtitles"),
                                 "Infobar/toggleDefaultSubtitles", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Switch to radio mode"), "Infobar/showRadio", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Switch to TV mode"), "Infobar/showTv", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Instant record"), "Infobar/instantRecord", "InfoBar"))
    ButtonSetupFunctions.append((_("Start instant recording"),
                                 "Infobar/startInstantRecording", "InfoBar"))
    ButtonSetupFunctions.append((_("Activate timeshift end"),
                                 "Infobar/activateTimeshiftEnd", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Activate timeshift end and pause"),
         "Infobar/activateTimeshiftEndAndPause", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Start timeshift"), "Infobar/startTimeshift", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Stop timeshift"), "Infobar/stopTimeshift", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Start teletext"), "Infobar/startTeletext", "InfoBar"))
    ButtonSetupFunctions.append((_("Show subservice selection"),
                                 "Infobar/subserviceSelection", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Letterbox zoom"), "Infobar/vmodeSelection", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Seekbar"), "Infobar/seekFwdVod", "InfoBar"))
    if SystemInfo["PIPAvailable"]:
        ButtonSetupFunctions.append(
            (_("Show PIP"), "Infobar/showPiP", "InfoBar"))
        ButtonSetupFunctions.append(
            (_("Swap PIP"), "Infobar/swapPiP", "InfoBar"))
        ButtonSetupFunctions.append(
            (_("Move PIP"), "Infobar/movePiP", "InfoBar"))
        ButtonSetupFunctions.append(
            (_("Toggle PIP-ZAP"), "Infobar/togglePipzap", "InfoBar"))
    ButtonSetupFunctions.append((_("Activate HbbTV (RedButton)"),
                                 "Infobar/activateRedButton", "InfoBar"))
    if SystemInfo["HasHDMIin"]:
        ButtonSetupFunctions.append(
            (_("Toggle HDMI-In full screen"), "Infobar/HDMIInFull", "InfoBar"))
        ButtonSetupFunctions.append(
            (_("Toggle HDMI-In PiP"), "Infobar/HDMIInPiP", "InfoBar"))
    if SystemInfo["LcdLiveTV"]:
        ButtonSetupFunctions.append(
            (_("Toggle LCD LiveTV"), "Infobar/ToggleLCDLiveTV", "InfoBar"))
    ButtonSetupFunctions.append((_("Do nothing"), "Void", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Button setup"), "Module/Screens.ButtonSetup/ButtonSetup", "Setup"))
    ButtonSetupFunctions.append(
        (_("Software update"), "Module/Screens.SoftwareUpdate/UpdatePlugin",
         "Setup"))
    ButtonSetupFunctions.append((_("CI (Common Interface) Setup"),
                                 "Module/Screens.Ci/CiSelection", "Setup"))
    ButtonSetupFunctions.append(
        (_("Show stream clients"),
         "Module/Screens.StreamingClientsInfo/StreamingClientsInfo", "Setup"))
    ButtonSetupFunctions.append(
        (_("Manual scan"), "Module/Screens.ScanSetup/ScanSetup", "Scanning"))
    ButtonSetupFunctions.append(
        (_("Automatic scan"), "Module/Screens.ScanSetup/ScanSimple",
         "Scanning"))
    for plugin in plugins.getPluginsForMenu("scan"):
        ButtonSetupFunctions.append(
            (plugin[0], "MenuPlugin/scan/" + plugin[2], "Scanning"))
    ButtonSetupFunctions.append(
        (_("Network Setup"),
         "Module/Screens.NetworkSetup/NetworkAdapterSelection", "Setup"))
    ButtonSetupFunctions.append(
        (_("Network menu"), "Infobar/showNetworkMounts", "Setup"))
    ButtonSetupFunctions.append(
        (_("Plugin browser"), "Module/Screens.PluginBrowser/PluginBrowser",
         "Setup"))
    ButtonSetupFunctions.append(
        (_("Channel info"), "Module/Screens.ServiceInfo/ServiceInfo", "Setup"))
    ButtonSetupFunctions.append(
        (_("Timers"), "Module/Screens.TimerEdit/TimerEditList", "Setup"))
    ButtonSetupFunctions.append(
        (_("Autotimer overview"), "Infobar/showAutoTimerList", "Setup"))
    for plugin in plugins.getPluginsForMenu("system"):
        if plugin[2]:
            ButtonSetupFunctions.append(
                (plugin[0], "MenuPlugin/system/" + plugin[2], "Setup"))
    ButtonSetupFunctions.append((_("Power menu"), "Menu/shutdown", "Power"))
    ButtonSetupFunctions.append(
        (_("Standby"), "Module/Screens.Standby/Standby", "Power"))
    ButtonSetupFunctions.append(
        (_("Restart"), "Module/Screens.Standby/TryQuitMainloop/2", "Power"))
    ButtonSetupFunctions.append(
        (_("Restart GUI"), "Module/Screens.Standby/TryQuitMainloop/3",
         "Power"))
    ButtonSetupFunctions.append(
        (_("Deep standby"), "Module/Screens.Standby/TryQuitMainloop/1",
         "Power"))
    ButtonSetupFunctions.append((_("Usage setup"), "Setup/usage", "Setup"))
    ButtonSetupFunctions.append(
        (_("User interface settings"), "Setup/userinterface", "Setup"))
    ButtonSetupFunctions.append(
        (_("Recording and playback settings"), "Setup/recording", "Setup"))
    ButtonSetupFunctions.append(
        (_("Skin setup"), "Module/Screens.SkinSelector/SkinSelector", "Setup"))
    ButtonSetupFunctions.append(
        (_("Harddisk setup"), "Setup/harddisk", "Setup"))
    ButtonSetupFunctions.append(
        (_("Subtitles settings"), "Setup/subtitlesetup", "Setup"))
    return ButtonSetupFunctions
Ejemplo n.º 32
0
 def doPluginCB(self):
     for p in plugins.getPlugins(PluginDescriptor.WHERE_SERVICESCAN):
         p()
Ejemplo n.º 33
0
def runScreenTest():
    config.misc.startCounter.value += 1

    profile("readPluginList")
    plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))

    profile("Init:Session")
    nav = Navigation(config.misc.nextWakeup.value)
    session = Session(desktop=enigma.getDesktop(0),
                      summary_desktop=enigma.getDesktop(1),
                      navigation=nav)

    CiHandler.setSession(session)

    profile("wizards")
    screensToRun = []
    RestoreSettings = None
    if os.path.exists("/media/hdd/images/config/settings"
                      ) and config.misc.firstrun.value:
        if autorestoreLoop():
            RestoreSettings = True
            from Plugins.SystemPlugins.SoftwareManager.BackupRestore import RestoreScreen
            session.open(RestoreScreen, runRestore=True)
        else:
            screensToRun = [
                p.__call__
                for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD)
            ]
            screensToRun += wizardManager.getWizards()
    else:
        if os.path.exists("/media/hdd/images/config/autorestore"):
            os.system('rm -f /media/hdd/images/config/autorestore')
        screensToRun = [
            p.__call__
            for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD)
        ]
        screensToRun += wizardManager.getWizards()

    screensToRun.append((100, InfoBar.InfoBar))
    screensToRun.sort()
    print screensToRun

    enigma.ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey)

    def runNextScreen(session, screensToRun, *result):
        if result:
            print "[mytest.py] quitMainloop #3"
            enigma.quitMainloop(*result)
            return

        screen = screensToRun[0][1]
        args = screensToRun[0][2:]
        if screensToRun:
            session.openWithCallback(
                boundFunction(runNextScreen, session, screensToRun[1:]),
                screen, *args)
        else:
            session.open(screen, *args)

    if not RestoreSettings:
        runNextScreen(session, screensToRun)

    profile("Init:VolumeControl")
    vol = VolumeControl(session)
    profile("Init:PowerKey")
    power = PowerKey(session)

    if boxtype in ('alien5', 'osninopro', 'osnino', 'osninoplus',
                   'alphatriple', 'spycat4kmini', 'tmtwin4k', 'mbmicrov2',
                   'revo4k', 'force3uhd', 'wetekplay', 'wetekplay2',
                   'wetekhub', 'dm7020hd', 'dm7020hdv2', 'osminiplus',
                   'osmega', 'sf3038', 'spycat', 'e4hd', 'e4hdhybrid',
                   'mbmicro', 'et7500', 'mixosf5', 'mixosf7', 'mixoslumi',
                   'gi9196m', 'maram9', 'ixussone', 'ixusszero', 'uniboxhd1',
                   'uniboxhd2', 'uniboxhd3', 'sezam5000hd', 'mbtwin',
                   'sezam1000hd', 'mbmini', 'atemio5x00', 'beyonwizt3',
                   '9910lx', '9911lx') or getBrandOEM() in (
                       'fulan') or getMachineBuild() in ('dags7362',
                                                         'dags73625', 'dags5'):
        profile("VFDSYMBOLS")
        import Components.VfdSymbols
        Components.VfdSymbols.SymbolsCheck(session)

    # we need session.scart to access it from within menu.xml
    session.scart = AutoScartControl(session)

    profile("Init:Trashcan")
    import Tools.Trashcan
    Tools.Trashcan.init(session)

    profile("Init:AutoVideoMode")
    import Screens.VideoMode
    Screens.VideoMode.autostart(session)

    profile("RunReactor")
    profile_final()

    if boxtype in ('sf8', 'classm', 'axodin', 'axodinc', 'starsatlx', 'genius',
                   'evo'):
        f = open("/dev/dbox/oled0", "w")
        f.write('-E2-')
        f.close()

    print "lastshutdown=%s		(True = last shutdown was OK)" % config.usage.shutdownOK.value
    print "NOK shutdown action=%s" % config.usage.shutdownNOK_action.value
    print "bootup action=%s" % config.usage.boot_action.value
    if not config.usage.shutdownOK.value and not config.usage.shutdownNOK_action.value == 'normal' or not config.usage.boot_action.value == 'normal':
        print "last shutdown = %s" % config.usage.shutdownOK.value
        import Screens.PowerLost
        Screens.PowerLost.PowerLost(session)

    if not RestoreSettings:
        config.usage.shutdownOK.setValue(False)
        config.usage.shutdownOK.save()
        configfile.save()

    # kill showiframe if it is running (sh4 hack...)
    if getMachineBuild() in ('spark', 'spark7162'):
        os.system("killall -9 showiframe")

    runReactor()

    print "[mytest.py] normal shutdown"
    config.misc.startCounter.save()
    config.usage.shutdownOK.setValue(True)
    config.usage.shutdownOK.save()

    profile("wakeup")

    #get currentTime
    nowTime = time()
    #	if not config.misc.SyncTimeUsing.value == "0" or getBrandOEM() == 'gigablue':
    if not config.misc.SyncTimeUsing.value == "0" or boxtype.startswith(
            'gb') or getBrandOEM().startswith('ini'):
        print "dvb time sync disabled... so set RTC now to current linux time!", strftime(
            "%Y/%m/%d %H:%M", localtime(nowTime))
        setRTCtime(nowTime)

    #recordtimer
    if session.nav.isRecordTimerImageStandard:  #check RecordTimer instance
        tmp = session.nav.RecordTimer.getNextRecordingTime(
            getNextStbPowerOn=True)
        nextRecordTime = tmp[0]
        nextRecordTimeInStandby = tmp[1]
    else:
        nextRecordTime = session.nav.RecordTimer.getNextRecordingTime()
        nextRecordTimeInStandby = session.nav.RecordTimer.isNextRecordAfterEventActionAuto(
        )
    #zaptimer
    nextZapTime = session.nav.RecordTimer.getNextZapTime()
    nextZapTimeInStandby = 0
    #powertimer
    tmp = session.nav.PowerTimer.getNextPowerManagerTime(
        getNextStbPowerOn=True)
    nextPowerTime = tmp[0]
    nextPowerTimeInStandby = tmp[1]
    #plugintimer
    tmp = plugins.getNextWakeupTime(getPluginIdent=True)
    nextPluginTime = tmp[0]
    nextPluginIdent = tmp[1]  #"pluginname | pluginfolder"
    tmp = tmp[1].lower()
    #start in standby, depending on plugin type
    if "epgrefresh" in tmp:
        nextPluginName = "EPGRefresh"
        nextPluginTimeInStandby = 1
    elif "vps" in tmp:
        nextPluginName = "VPS"
        nextPluginTimeInStandby = 1
    elif "serienrecorder" in tmp:
        nextPluginName = "SerienRecorder"
        nextPluginTimeInStandby = 0  # plugin function for deep standby from standby not compatible (not available)
    elif "elektro" in tmp:
        nextPluginName = "Elektro"
        nextPluginTimeInStandby = 1
    elif "minipowersave" in tmp:
        nextPluginName = "MiniPowersave"
        nextPluginTimeInStandby = 1
    elif "enhancedpowersave" in tmp:
        nextPluginName = "EnhancedPowersave"
        nextPluginTimeInStandby = 1
    else:
        #default for plugins
        nextPluginName = nextPluginIdent
        nextPluginTimeInStandby = 0

    wakeupList = [
        x for x in ((nextRecordTime, 0, nextRecordTimeInStandby),
                    (nextZapTime, 1, nextZapTimeInStandby),
                    (nextPowerTime, 2, nextPowerTimeInStandby),
                    (nextPluginTime, 3, nextPluginTimeInStandby)) if x[0] != -1
    ]
    wakeupList.sort()

    print "=" * 100
    if wakeupList and wakeupList[0][0] > 0:
        startTime = wakeupList[0]
        # wakeup time before timer begins
        wptime = startTime[0] - (config.workaround.wakeuptime.value * 60)
        if (wptime - nowTime) < 120:  # no time to switch box back on
            wptime = int(nowTime) + 120  # so switch back on in 120 seconds

        #check for plugin-, zap- or power-timer to enable the 'forced' record-timer wakeup
        forceNextRecord = 0
        setStandby = startTime[2]
        if startTime[1] != 0 and nextRecordTime > 0:
            #when next record starts in 15 mins
            if abs(nextRecordTime - startTime[0]) <= 900:
                setStandby = forceNextRecord = 1
            #by vps-plugin
            elif startTime[1] == 3 and nextPluginName == "VPS":
                setStandby = forceNextRecord = 1

        if startTime[1] == 3:
            nextPluginName = " (%s)" % nextPluginName
        else:
            nextPluginName = ""
        print "[mytest.py] set next wakeup type to '%s'%s %s" % (
            {
                0: "record-timer",
                1: "zap-timer",
                2: "power-timer",
                3: "plugin-timer"
            }[startTime[1]], nextPluginName, {
                0: "and starts normal",
                1: "and starts in standby"
            }[setStandby])
        if forceNextRecord:
            print "[mytest.py] set from 'vps-plugin' or just before a 'record-timer' starts, set 'record-timer' wakeup flag"
        print "[mytest.py] set next wakeup time to", strftime(
            "%a, %Y/%m/%d %H:%M:%S", localtime(wptime))
        #set next wakeup
        setFPWakeuptime(wptime)
        #set next standby only after shutdown in deep standby
        if Screens.Standby.quitMainloopCode != 1 and Screens.Standby.quitMainloopCode != 45:
            setStandby = 2  # 0=no standby, but get in standby if wakeup to timer start > 60 sec (not for plugin-timer, here is no standby), 1=standby, 2=no standby, when before was not in deep-standby
        config.misc.nextWakeup.value = "%d,%d,%d,%d,%d,%d" % (
            wptime, startTime[0], startTime[1], setStandby, nextRecordTime,
            forceNextRecord)
    else:
        config.misc.nextWakeup.value = "-1,-1,0,0,-1,0"
        if not boxtype.startswith(
                'azboxm'
        ):  #skip for Azbox (mini)ME - setting wakeup time to past reboots box
            setFPWakeuptime(int(nowTime) -
                            3600)  #minus one hour -> overwrite old wakeup time
        print "[mytest.py] no set next wakeup time"
    config.misc.nextWakeup.save()
    print "=" * 100

    profile("stopService")
    session.nav.stopService()
    profile("nav shutdown")
    session.nav.shutdown()

    profile("configfile.save")
    configfile.save()
    from Screens import InfoBarGenerics
    InfoBarGenerics.saveResumePoints()

    return 0
Ejemplo n.º 34
0
def runScreenTest():
	config.misc.startCounter.value += 1
	config.misc.startCounter.save()

	profile("readPluginList")
	enigma.pauseInit()
	plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
	enigma.resumeInit()

	profile("Init:Session")
	nav = Navigation()
	session = Session(desktop = enigma.getDesktop(0), summary_desktop = enigma.getDesktop(1), navigation = nav)

	CiHandler.setSession(session)

	screensToRun = [ p.__call__ for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD) ]

	profile("wizards")
	screensToRun += wizardManager.getWizards()

	screensToRun.append((100, InfoBar.InfoBar))

	screensToRun.sort()

	enigma.ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey)

	def runNextScreen(session, screensToRun, *result):
		if result:
			enigma.quitMainloop(*result)
			return

		screen = screensToRun[0][1]
		args = screensToRun[0][2:]

		if screensToRun:
			session.openWithCallback(boundFunction(runNextScreen, session, screensToRun[1:]), screen, *args)
		else:
			session.open(screen, *args)

	config.misc.epgcache_filename.addNotifier(setEPGCachePath)

	runNextScreen(session, screensToRun)

	profile("Init:VolumeControl")
	vol = VolumeControl(session)
	profile("Init:PowerKey")
	power = PowerKey(session)

	from enigma import getBoxType
	if SystemInfo in ["FirstCheckModel","SecondCheckModel","ThirdCheckModel","DifferentLCDSettings"] or getBoxType() in ("alphatriplehd","tmtwin4k","osminiplus","sf3038","spycat","et7x00","ebox5000","ebox7358","eboxlumi","maram9","sezam5000hd","mbtwin","sezam1000hd","mbmini","atemio5x00","beyonwizt3","dinoboth265","axashistwin"):
		profile("VFDSYMBOLS")
		import Components.VfdSymbols
		Components.VfdSymbols.SymbolsCheck(session)

	# we need session.scart to access it from within menu.xml
	session.scart = AutoScartControl(session)

	profile("Init:Trashcan")
	import Tools.Trashcan
	Tools.Trashcan.init(session)

	profile("RunReactor")
	profile_final()
	runReactor()

	profile("wakeup")
	from time import strftime, localtime
	from Tools.StbHardware import setFPWakeuptime, setRTCtime
	from Screens.SleepTimerEdit import isNextWakeupTime
	#get currentTime
	nowTime = time()
	wakeupList = [
		x for x in ((session.nav.RecordTimer.getNextRecordingTime(), 0),
					(session.nav.RecordTimer.getNextZapTime(isWakeup=True), 1),
					(plugins.getNextWakeupTime(), 2),
					(isNextWakeupTime(), 3))
		if x[0] != -1
	]
	wakeupList.sort()
	if wakeupList:
		from time import strftime
		from enigma import getBoxBrand
		startTime = wakeupList[0]
		if (startTime[0] - nowTime) < 270: # no time to switch box back on
			wptime = nowTime + 30  # so switch back on in 30 seconds
		else:
			if getBoxBrand() == 'gigablue':
				wptime = startTime[0] - 120 # GigaBlue already starts 2 min. before wakeup time
			else:
				wptime = startTime[0] - 240
		if not config.misc.SyncTimeUsing.value == "0" or getBoxBrand() == 'gigablue':
			print("[mytest] dvb time sync disabled... so set RTC now to current linux time!", strftime("%Y/%m/%d %H:%M", localtime(nowTime)))
			setRTCtime(nowTime)
		print("[mytest] set wakeup time to", strftime("%Y/%m/%d %H:%M", localtime(wptime)))
		setFPWakeuptime(wptime)
		config.misc.prev_wakeup_time.value = int(startTime[0])
		config.misc.prev_wakeup_time_type.value = startTime[1]
		config.misc.prev_wakeup_time_type.save()
	else:
		config.misc.prev_wakeup_time.value = 0
	config.misc.prev_wakeup_time.save()

	profile("stopService")
	session.nav.stopService()
	profile("nav shutdown")
	session.nav.shutdown()

	profile("configfile.save")
	configfile.save()
	from Screens import InfoBarGenerics
	InfoBarGenerics.saveResumePoints()

	return 0
Ejemplo n.º 35
0
def runScreenTest():
    config.misc.startCounter.value += 1

    profile("readPluginList")
    plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))

    profile("Init:Session")
    nav = Navigation(config.misc.isNextRecordTimerAfterEventActionAuto.value,
                     config.misc.isNextPowerTimerAfterEventActionAuto.value)
    session = Session(desktop=enigma.getDesktop(0),
                      summary_desktop=enigma.getDesktop(1),
                      navigation=nav)

    CiHandler.setSession(session)

    profile("wizards")
    screensToRun = []
    RestoreSettings = None
    if os.path.exists("/media/hdd/images/config/settings"
                      ) and config.misc.firstrun.value:
        if autorestoreLoop():
            RestoreSettings = True
            from Plugins.SystemPlugins.SoftwareManager.BackupRestore import RestoreScreen
            os.system("rm /media/hdd/images/config/settings")
            session.open(RestoreScreen, runRestore=True)
        else:
            os.system("rm /media/hdd/images/config/settings")
            screensToRun = [
                p.__call__
                for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD)
            ]
            screensToRun += wizardManager.getWizards()
    else:
        if os.path.exists("/media/hdd/images/config/autorestore"):
            os.system('rm -f /media/hdd/images/config/autorestore')
        screensToRun = [
            p.__call__
            for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD)
        ]
        screensToRun += wizardManager.getWizards()

    screensToRun.append((100, InfoBar.InfoBar))
    screensToRun.sort()
    print screensToRun

    enigma.ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey)

    def runNextScreen(session, screensToRun, *result):
        if result:
            print "[mytest.py] quitMainloop #3"
            enigma.quitMainloop(*result)
            return

        screen = screensToRun[0][1]
        args = screensToRun[0][2:]
        if screensToRun:
            session.openWithCallback(
                boundFunction(runNextScreen, session, screensToRun[1:]),
                screen, *args)
        else:
            session.open(screen, *args)

    if not RestoreSettings:
        runNextScreen(session, screensToRun)

    profile("Init:VolumeControl")
    vol = VolumeControl(session)
    profile("Init:PowerKey")
    power = PowerKey(session)

    if boxtype in ('osmega', 'sf3038', 'spycat', 'e4hd', 'e4hdhybrid',
                   'mbmicro', 'et7500', 'mixosf5', 'mixosf7', 'mixoslumi',
                   'gi9196m', 'maram9', 'ixussone', 'ixussone', 'uniboxhd1',
                   'uniboxhd2', 'uniboxhd3', 'sezam5000hd', 'mbtwin',
                   'sezam1000hd', 'mbmini', 'atemio5x00',
                   'beyonwizt3') or getBrandOEM() in (
                       'fulan') or getMachineBuild() in ('dags7362', 'dags5'):
        profile("VFDSYMBOLS")
        import Components.VfdSymbols
        Components.VfdSymbols.SymbolsCheck(session)

    # we need session.scart to access it from within menu.xml
    session.scart = AutoScartControl(session)

    profile("Init:Trashcan")
    import Tools.Trashcan
    Tools.Trashcan.init(session)

    profile("Init:AutoVideoMode")
    import Screens.VideoMode
    Screens.VideoMode.autostart(session)

    profile("RunReactor")
    profile_final()
    # kill showiframe if it is running (sh4 hack...)
    os.system("killall -9 showiframe")
    runReactor()

    config.misc.startCounter.save()

    profile("wakeup")

    #get currentTime
    nowTime = time()
    if not config.misc.SyncTimeUsing.value == "0" or getBoxType().startswith(
            'gb') or getMachineProcModel().startswith('ini'):
        print "dvb time sync disabled... so set RTC now to current linux time!", strftime(
            "%Y/%m/%d %H:%M", localtime(nowTime))
        setRTCtime(nowTime)

    wakeupList = [
        x for x in (
            (session.nav.RecordTimer.getNextRecordingTime(), 0,
             session.nav.RecordTimer.isNextRecordAfterEventActionAuto()),
            (session.nav.RecordTimer.getNextZapTime(),
             1), (plugins.getNextWakeupTime(), 2),
            (session.nav.PowerTimer.getNextPowerManagerTime(), 3,
             session.nav.PowerTimer.isNextPowerManagerAfterEventActionAuto()))
        if x[0] != -1
    ]
    wakeupList.sort()
    recordTimerWakeupAuto = False
    if wakeupList and wakeupList[0][1] != 3:
        startTime = wakeupList[0]
        if (startTime[0] - nowTime) < 270:  # no time to switch box back on
            wptime = nowTime + 30  # so switch back on in 30 seconds
        else:
            if getBoxType().startswith("gb"):
                wptime = startTime[
                    0] - 120  # Gigaboxes already starts 2 min. before wakeup time
            else:
                wptime = startTime[0] - 240

        #if not config.misc.SyncTimeUsing.value == "0" or getBoxType().startswith('gb'):
        #	print "dvb time sync disabled... so set RTC now to current linux time!", strftime("%Y/%m/%d %H:%M", localtime(nowTime))
        #	setRTCtime(nowTime)
        print "set wakeup time to", strftime("%Y/%m/%d %H:%M",
                                             localtime(wptime))
        setFPWakeuptime(wptime)
        recordTimerWakeupAuto = startTime[1] == 0 and startTime[2]
        print 'recordTimerWakeupAuto', recordTimerWakeupAuto
    config.misc.isNextRecordTimerAfterEventActionAuto.value = recordTimerWakeupAuto
    config.misc.isNextRecordTimerAfterEventActionAuto.save()

    PowerTimerWakeupAuto = False
    if wakeupList and wakeupList[0][1] == 3:
        startTime = wakeupList[0]
        if (startTime[0] - nowTime) < 60:  # no time to switch box back on
            wptime = nowTime + 30  # so switch back on in 30 seconds
        else:
            if getBoxType().startswith("gb"):
                wptime = startTime[
                    0] + 120  # Gigaboxes already starts 2 min. before wakeup time
            else:
                wptime = startTime[0]
        #if not config.misc.SyncTimeUsing.value == "0" or getBoxType().startswith('gb'):
        #	print "dvb time sync disabled... so set RTC now to current linux time!", strftime("%Y/%m/%d %H:%M", localtime(nowTime))
        #	setRTCtime(nowTime)
        print "set wakeup time to", strftime("%Y/%m/%d %H:%M",
                                             localtime(wptime + 60))
        setFPWakeuptime(wptime)
        PowerTimerWakeupAuto = startTime[1] == 3 and startTime[2]
        print 'PowerTimerWakeupAuto', PowerTimerWakeupAuto
    config.misc.isNextPowerTimerAfterEventActionAuto.value = PowerTimerWakeupAuto
    config.misc.isNextPowerTimerAfterEventActionAuto.save()

    profile("stopService")
    session.nav.stopService()
    profile("nav shutdown")
    session.nav.shutdown()

    profile("configfile.save")
    configfile.save()
    from Screens import InfoBarGenerics
    InfoBarGenerics.saveResumePoints()

    return 0
Ejemplo n.º 36
0
def runScreenTest():
    config.misc.startCounter.value += 1

    profile("readPluginList")
    enigma.pauseInit()
    plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
    enigma.resumeInit()

    profile("Init:Session")
    nav = Navigation(
        config.misc.isNextRecordTimerAfterEventActionAuto.getValue())
    session = Session(desktop=enigma.getDesktop(0),
                      summary_desktop=enigma.getDesktop(1),
                      navigation=nav)

    CiHandler.setSession(session)
    powerOffTimer.setSession(session)

    profile("wizards")
    screensToRun = []
    RestoreSettings = None
    if os.path.exists("/media/hdd/images/config/settings"
                      ) and config.misc.firstrun.value:
        if autorestoreLoop():
            RestoreSettings = True
            from Plugins.SystemPlugins.SoftwareManager.BackupRestore import RestoreScreen
            session.open(RestoreScreen, runRestore=True)
        else:
            screensToRun = [
                p.__call__
                for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD)
            ]
            screensToRun += wizardManager.getWizards()
    else:
        if os.path.exists("/media/hdd/images/config/autorestore"):
            os.system('rm -f /media/hdd/images/config/autorestore')
        screensToRun = [
            p.__call__
            for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD)
        ]
        screensToRun += wizardManager.getWizards()

    screensToRun.append((100, InfoBar.InfoBar))
    screensToRun.sort()

    enigma.ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey)

    def runNextScreen(session, screensToRun, *result):
        if result:
            enigma.quitMainloop(*result)
            return

        screen = screensToRun[0][1]
        args = screensToRun[0][2:]

        if screensToRun:
            session.openWithCallback(
                boundFunction(runNextScreen, session, screensToRun[1:]),
                screen, *args)
        else:
            session.open(screen, *args)

    config.misc.epgcache_filename.addNotifier(setEPGCachePath)

    if not RestoreSettings:
        runNextScreen(session, screensToRun)

    profile("Init:VolumeControl")
    vol = VolumeControl(session)
    profile("Init:PowerKey")
    power = PowerKey(session)

    # we need session.scart to access it from within menu.xml
    session.scart = AutoScartControl(session)

    profile("Init:Trashcan")
    import Tools.Trashcan
    Tools.Trashcan.init(session)

    profile("RunReactor")
    profile_final()

    if not config.usage.shutdownOK.value and not config.usage.shutdownNOK_action.value == 'normal':
        print("last shutdown = %s" % config.usage.shutdownOK.value)
    if not RestoreSettings:
        config.usage.shutdownOK.setValue(False)
        config.usage.shutdownOK.save()
        configfile.save()

    runReactor()

    config.misc.startCounter.save()
    config.usage.shutdownOK.setValue(True)
    config.usage.shutdownOK.save()

    profile("wakeup")

    try:
        from Plugins.SystemPlugins.VFDControl.plugin import SetTime
        SetTime()
    except:
        print "[mytest] Failed SetTime from VFDControl !!"

    from time import time, strftime, localtime
    from Tools.StbHardware import setFPWakeuptime, setRTCtime
    from Screens.SleepTimerEdit import isNextWakeupTime
    #get currentTime
    nowTime = time()
    wakeupList = [
        x
        for x in ((session.nav.RecordTimer.getNextRecordingTime(), 0,
                   session.nav.RecordTimer.isNextRecordAfterEventActionAuto()),
                  (session.nav.RecordTimer.getNextZapTime(), 1),
                  (plugins.getNextWakeupTime(), 2), (isNextWakeupTime(), 3))
        if x[0] != -1
    ]
    wakeupList.sort()
    recordTimerWakeupAuto = False
    if wakeupList:
        from time import strftime, altzone, timezone
        startTime = wakeupList[0]
        if (startTime[0] - nowTime) < 270:  # no time to switch box back on
            wptime = nowTime + 30  # so switch back on in 30 seconds
        else:
            wptime = startTime[0] - 120
        if not config.misc.useTransponderTime.value:
            print "[mytest] dvb time sync disabled... so set RTC now to current linux time!", strftime(
                "%Y/%m/%d %H:%M", localtime(nowTime))
            setRTCtime(nowTime)
        print "[StartEnigma] Set wakeup time to", strftime(
            "%Y/%m/%d %H:%M", localtime(wptime))
        setFPWakeuptime(wptime)
        recordTimerWakeupAuto = startTime[1] == 0 and startTime[2]
        print '[mytest] recordTimerWakeupAuto', recordTimerWakeupAuto
        config.misc.prev_wakeup_time.value = startTime[0]
        config.misc.prev_wakeup_time_type.value = startTime[1]
        config.misc.prev_wakeup_time_type.save()
    else:
        config.misc.prev_wakeup_time.value = 0
    config.misc.prev_wakeup_time.save()
    config.misc.isNextRecordTimerAfterEventActionAuto.value = recordTimerWakeupAuto
    config.misc.isNextRecordTimerAfterEventActionAuto.save()

    profile("stopService")
    session.nav.stopService()
    profile("nav shutdown")
    session.nav.shutdown()

    profile("configfile.save")
    configfile.save()
    from Screens import InfoBarGenerics
    InfoBarGenerics.saveResumePoints()

    return 0
Ejemplo n.º 37
0
def runScreenTest():
    config.misc.startCounter.value += 1
    config.misc.startCounter.save()

    profile("readPluginList")
    enigma.pauseInit()
    plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
    enigma.resumeInit()

    profile("Init:Session")
    nav = Navigation()
    session = Session(desktop=enigma.getDesktop(0),
                      summary_desktop=enigma.getDesktop(1),
                      navigation=nav)

    CiHandler.setSession(session)

    screensToRun = [
        p.__call__ for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD)
    ]

    profile("wizards")
    screensToRun += wizardManager.getWizards()

    screensToRun.append((100, InfoBar.InfoBar))

    screensToRun.sort()

    enigma.ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey)

    def runNextScreen(session, screensToRun, *result):
        if result:
            enigma.quitMainloop(*result)
            return

        screen = screensToRun[0][1]
        args = screensToRun[0][2:]

        if screensToRun:
            session.openWithCallback(
                boundFunction(runNextScreen, session, screensToRun[1:]),
                screen, *args)
        else:
            session.open(screen, *args)

    config.misc.epgcache_filename.addNotifier(setEPGCachePath)

    runNextScreen(session, screensToRun)

    profile("Init:VolumeControl")
    vol = VolumeControl(session)
    profile("Init:PowerKey")
    power = PowerKey(session)

    # we need session.scart to access it from within menu.xml
    session.scart = AutoScartControl(session)

    profile("Init:Trashcan")
    import Tools.Trashcan
    Tools.Trashcan.init(session)

    profile("RunReactor")
    profile_final()
    runReactor()

    profile("wakeup")
    from time import strftime, localtime
    from Tools.StbHardware import setFPWakeuptime, setRTCtime
    from Screens.SleepTimerEdit import isNextWakeupTime
    #get currentTime
    nowTime = time()
    wakeupList = [
        x for x in ((session.nav.RecordTimer.getNextRecordingTime(), 0),
                    (session.nav.RecordTimer.getNextZapTime(isWakeup=True), 1),
                    (plugins.getNextWakeupTime(), 2), (isNextWakeupTime(), 3))
        if x[0] != -1
    ]
    wakeupList.sort()
    if wakeupList:
        from time import strftime
        startTime = wakeupList[0]
        if (startTime[0] - nowTime) < 330:  # no time to switch box back on
            wptime = nowTime + 30  # so switch back on in 30 seconds
        else:
            wptime = startTime[0] - 300
        if not config.misc.SyncTimeUsing.value == "0":
            print(
                "[mytest] dvb time sync disabled... so set RTC now to current linux time!",
                strftime("%Y/%m/%d %H:%M", localtime(nowTime)))
            setRTCtime(nowTime)
        print("[mytest] set wakeup time to",
              strftime("%Y/%m/%d %H:%M", localtime(wptime)))
        setFPWakeuptime(wptime)
        config.misc.prev_wakeup_time.value = int(startTime[0])
        config.misc.prev_wakeup_time_type.value = startTime[1]
        config.misc.prev_wakeup_time_type.save()
    elif config.misc.prev_wakeup_time.value != 0:
        config.misc.prev_wakeup_time.value = 0
        config.misc.prev_wakeup_time.save()

    profile("stopService")
    session.nav.stopService()
    profile("nav shutdown")
    session.nav.shutdown()

    profile("configfile.save")
    configfile.save()
    from Screens import InfoBarGenerics
    InfoBarGenerics.saveResumePoints()

    return 0
Ejemplo n.º 38
0
def startPlugin(self, pname):
    msgText = _("Unknown Error")
    no_plugin = True
    if pname != _("Nothing"):
        if pname == _("Single EPG"):
            from Screens.InfoBarGenerics import InfoBarEPG
            if isinstance(self, InfoBarEPG):
                self.openSingleServiceEPG()
            no_plugin = False
        elif pname == _("Multi EPG"):
            from Screens.InfoBarGenerics import InfoBarEPG
            if isinstance(self, InfoBarEPG):
                self.openMultiServiceEPG()
            no_plugin = False
        elif pname == _("MediaPlayer"):
            try:  # falls es nicht installiert ist
                from Plugins.Extensions.MediaPlayer.plugin import MediaPlayer
                self.session.open(MediaPlayer)
                no_plugin = False
            except Exception as e:
                msgText = _("Error!\nError Text: %s" % e)
        elif pname == _("Plugin browser"):
            from Screens.PluginBrowser import PluginBrowser
            self.session.open(PluginBrowser)
            no_plugin = False
        elif pname == _("switch 4:3 content display"):
            ar = {
                "pillarbox": _("Pillarbox"),
                "panscan": _("Pan&Scan"),
                "scale": _("Just Scale")
            }
            switch = {
                "pillarbox": "panscan",
                "panscan": "scale",
                "scale": "pillarbox"
            }
            config.av.policy_43.value = switch[config.av.policy_43.value]
            config.av.policy_43.save()
            self.session.open(MessageBox,
                              _("Display 4:3 content as") + " " +
                              ar[config.av.policy_43.value],
                              MessageBox.TYPE_INFO,
                              timeout=3)
            no_plugin = False
        elif pname == _("Timer"):
            from Screens.TimerEdit import TimerEditList
            self.session.open(TimerEditList)
            no_plugin = False
        elif pname == _("HbbTV Applications"):
            try:
                from Plugins.Extensions.HbbTV.HbbTV import HbbTV
                no_plugin = not config.plugins.hbbtv.enabled.value
            except ImportError as e:
                no_plugin = True
            finally:
                if not no_plugin:
                    hbbtv_instance = HbbTV.instance
                    if hbbtv_instance:
                        hbbtv_instance._showApplicationList()
        else:
            plugin = None
            for p in plugins.getPlugins(where=[
                    PluginDescriptor.WHERE_EXTENSIONSMENU,
                    PluginDescriptor.WHERE_PLUGINMENU
            ]):
                if pname == str(p.name):
                    plugin = p
            if plugin is not None:
                try:
                    self.runPlugin(plugin)
                    no_plugin = False
                except Exception as e:
                    msgText = _("Error!\nError Text: %s" % e)
            else:
                msgText = _("Plugin not found!")
    else:
        msgText = _("No plugin assigned!")
    if no_plugin:
        self.session.open(MessageBox, msgText, MessageBox.TYPE_INFO)
Ejemplo n.º 39
0
    def __init__(self, session, menumode, mselection, mlist, service,
                 selections, currentPath):
        Screen.__init__(self, session)
        self.mode = menumode
        self.mselection = mselection
        self.mlist = mlist
        self.service = service
        self.selections = selections
        self.currentPath = currentPath
        self.reloadafterclose = False

        self.menu = []
        if menumode == "normal":
            self["title"] = StaticText(_("Choose operation"))

            if os.path.realpath(self.currentPath) != os.path.realpath(
                    config.EMC.movie_homepath.value):
                self.menu.append(
                    (_("Movie home"), boundFunction(self.close, "Movie home")))

            if currentPath == config.EMC.movie_pathlimit.value:
                self.menu.append(
                    (_("Directory up"), boundFunction(self.close, "dirup")))

            self.menu.append((_("Reload current directory"),
                              boundFunction(self.close, "reloadwithoutcache")))

            self.menu.append(
                (_("Play last"), boundFunction(self.close, "Play last")))

            self.menu.append(
                (_("Play All"), boundFunction(self.close, "playall")))
            self.menu.append(
                (_("Shuffle All"), boundFunction(self.close, "shuffleall")))

            self.menu.append(
                (_("Cover search"), boundFunction(self.close, "imdb")))
            self.menu.append((_("Delete"), boundFunction(self.close, "del")))

            if config.EMC.movie_trashcan_enable.value and os.path.exists(
                    config.EMC.movie_trashcan_path.value):
                if service:
                    self.menu.append((_("Delete permanently"),
                                      boundFunction(self.close, "delete")))
                self.menu.append(
                    (_("Empty trashcan"), boundFunction(self.emptyTrash)))
                self.menu.append(
                    (_("Go to trashcan"), boundFunction(self.close, "trash")))

            self.menu.append(
                (_("Mark all movies"), boundFunction(self.close, "markall")))
            self.menu.append(
                (_("Remove rogue files"), boundFunction(self.remRogueFiles)))

            self.menu.append(
                (_("Delete cut file"), boundFunction(self.deleteCutFileQ)))

            self.menu.append(
                (_("Create link"), boundFunction(self.createLink,
                                                 currentPath)))
            self.menu.append((_("Create directory"),
                              boundFunction(self.createDir, currentPath)))

            self.menu.append((_("(Un-)Lock Directory"),
                              boundFunction(self.lockDir, currentPath)))

            if service:
                if os.path.isfile(service.getPath()):
                    self.menu.append((_("Copy Movie"),
                                      boundFunction(self.close, "Copy Movie")))
                    self.menu.append((_("Move Movie"),
                                      boundFunction(self.close, "Move Movie")))
                    #self.menu.append((_("Download Movie Information"), boundFunction(self.close, "Movie Information")))
                if service.getPath() != config.EMC.movie_trashcan_path.value:
                    if not service.getPath().endswith(
                            "/..") and not service.getPath().endswith(
                                "/Latest Recordings"):
                        self.menu.append(
                            (_("Download Movie Information"),
                             boundFunction(self.close, "Movie Information")))
                        #self.menu.append((_("Download Movie Cover"), boundFunction(self.close, "dlcover")))

            if self.service or self.selections:
                self.menu.append((_("Rename selected movie(s)"),
                                  boundFunction(self.renameMovies)))
                self.menu.append((_("Remove cut list marker"),
                                  boundFunction(self.remCutListMarker)))
                show_plugins = True
                if self.selections:
                    for service in self.selections:
                        ext = os.path.splitext(service.getPath())[1].lower()
                        if ext not in extTS:
                            show_plugins = False
                            break
                else:
                    ext = os.path.splitext(self.service.getPath())[1].lower()
                    if ext not in extTS:
                        show_plugins = False
                if show_plugins:
                    # Only valid for ts files: CutListEditor, DVDBurn, ...
                    self.menu.extend([(p.description,
                                       boundFunction(self.execPlugin, p))
                                      for p in plugins.getPlugins(
                                          PluginDescriptor.WHERE_MOVIELIST)])

            self.menu.append((_("Open E2 Bookmark path"),
                              boundFunction(self.close, "openE2Bookmarks")))
            if not self.isE2Bookmark(currentPath):
                self.menu.append((_("Add directory to E2 Bookmarks"),
                                  boundFunction(self.addDirToE2Bookmarks,
                                                currentPath)))
            else:
                self.menu.append((_("Remove directory from E2 Bookmarks"),
                                  boundFunction(self.removeDirFromE2Bookmarks,
                                                currentPath)))
            if service and self.isE2Bookmark(service.getPath()):
                self.menu.append((_("Remove selected E2 Bookmark"),
                                  boundFunction(self.close, "removeE2Bookmark",
                                                service)))

            self.menu.append((_("Open EMC Bookmark path"),
                              boundFunction(self.close, "openEMCBookmarks")))
            if not self.isEMCBookmark(currentPath):
                self.menu.append((_("Add directory to EMC Bookmarks"),
                                  boundFunction(self.addDirToEMCBookmarks,
                                                currentPath)))
            else:
                self.menu.append((_("Remove directory from EMC Bookmarks"),
                                  boundFunction(self.removeDirFromEMCBookmarks,
                                                currentPath)))
            if service and self.isEMCBookmark(service.getPath()):
                self.menu.append((_("Remove selected EMC Bookmark"),
                                  boundFunction(self.close,
                                                "removeEMCBookmark", service)))

            self.menu.append((_("Set permanent sort"),
                              boundFunction(self.setPermanentSort, currentPath,
                                            mlist.actualSort)))
            if mlist.hasFolderPermanentSort(currentPath):
                self.menu.append((_("Remove permanent sort"),
                                  boundFunction(self.removePermanentSort,
                                                currentPath)))
            else:
                path = mlist.hasParentPermanentSort(currentPath)
                if path:
                    self.menu.append((_("Remove permanent sort from parent"),
                                      boundFunction(self.removePermanentSort,
                                                    path)))

            #self.menu.append((_("Open shell script menu"), boundFunction(self.close, "oscripts")))
            self.menu.append(
                (_("EMC Setup"), boundFunction(self.execPlugin, emcsetup)))

        elif menumode == "plugins":
            self["title"] = StaticText(_("Choose plugin"))
            if self.service is not None:
                for p in plugins.getPlugins(PluginDescriptor.WHERE_MOVIELIST):
                    self.menu.append(
                        (p.description, boundFunction(self.execPlugin, p)))

        elif menumode == "emcBookmarks":
            self["title"] = StaticText(_("Choose bookmark"))
            bm = self.getEMCBookmarks()
            if bm:
                for line in bm:
                    self.menu.append((line, boundFunction(self.close, line)))

        self["menu"] = List(self.menu)
        self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], {
            "ok": self.okButton,
            "cancel": self.close,
            "red": self.redButton,
        })
        self.skinName = "Menu"
        self.onShow.append(self.onDialogShow)
Ejemplo n.º 40
0
class CrossEPG_Setup(Screen):
	def __init__(self, session):
		if (getDesktop(0).size().width() < 800):
			skin = "%s/skins/setup_sd.xml" % (os.path.dirname(sys.modules[__name__].__file__))
		else:
			skin = "%s/skins/setup_hd.xml" % (os.path.dirname(sys.modules[__name__].__file__))
		f = open(skin, "r")
		self.skin = f.read()
		f.close()
		Screen.__init__(self, session)

		patchtype = getEPGPatchType()
		if patchtype == 0 or patchtype == 1 or patchtype == 3:
			self.fastpatch = True
		else:
			self.fastpatch = False
		
		self.session = session

		self.config = CrossEPG_Config()
		self.config.load()

		self.lamedbs = self.config.getAllLamedbs()

		self.lamedbs_desc = []
		self.mountpoint = []
		self.mountdescription = []
		self.automatictype = []

		self.show_extension = self.config.show_extension
		self.show_plugin = self.config.show_plugin
		self.show_force_reload_as_plugin = self.config.show_force_reload_as_plugin

		# make devices entries
		if self.config.isQBOXHD():
			self.mountdescription.append(_("Internal flash"))
			self.mountpoint.append("/var/crossepg/data")

		for partition in harddiskmanager.getMountedPartitions():
			if (partition.mountpoint != '/') and (partition.mountpoint != '') and self.isMountedInRW(partition.mountpoint):
				self.mountpoint.append(partition.mountpoint + "/crossepg")

				if partition.description != '':
					self.mountdescription.append(partition.description)
				else:
					self.mountdescription.append(partition.mountpoint)
				
		if not self.config.isQBOXHD():		# for other decoders we add internal flash as last entry (it's unsuggested)
			self.mountdescription.append(_("Internal flash (unsuggested)"))
			self.mountpoint.append(self.config.home_directory + "/data")
			
		# make lamedb entries
		for lamedb in self.lamedbs:
			if lamedb == "lamedb":
				self.lamedbs_desc.append(_("main lamedb"))
			else:
				self.lamedbs_desc.append(lamedb.replace("lamedb.", "").replace(".", " "))
				
		# make automatic type entries
		self.automatictype.append(_("disabled"))
		self.automatictype.append(_("once a day"))
		self.automatictype.append(_("every hour (only in standby)"))

		self.list = []
		self["config"] = ConfigList(self.list, session = self.session)
		self["config"].onSelectionChanged.append(self.setInfo)
		self["information"] = Label("")
		self["key_red"] = Button(_("Back"))
		self["key_green"] = Button()
		self["key_yellow"] = Button()
		self["key_blue"] = Button("")
		self["config_actions"] = NumberActionMap(["SetupActions", "InputAsciiActions", "KeyboardInputActions", "ColorActions"],
		{
			"red": self.quit,
			"cancel": self.quit,
			"left": self.keyLeft,
			"right": self.keyRight,
			"home": self.keyHome,
			"end": self.keyEnd,
			"1": self.keyNumberGlobal,
			"2": self.keyNumberGlobal,
			"3": self.keyNumberGlobal,
			"4": self.keyNumberGlobal,
			"5": self.keyNumberGlobal,
			"6": self.keyNumberGlobal,
			"7": self.keyNumberGlobal,
			"8": self.keyNumberGlobal,
			"9": self.keyNumberGlobal,
			"0": self.keyNumberGlobal
		}, -1) # to prevent left/right overriding the listbox

		self.makeList()

	# Modded by IAmATeaf 13/04/2012
	# def isMountedInRW(self, path):
	# 	testfile = path + "/tmp-rw-test"
	# 	os.system("touch " + testfile)
	# 	if os.path.exists(testfile):
	# 		os.system("rm -f " + testfile)
	# 		return True
	# 	return False

	def isMountedInRW(self, path):
		testfile = os.path.join(path, "tmp-rw-test")
		try:
			open(testfile, "wb").close()
			os.unlink(testfile)
		except:
			return False
		return True
		
	def showWarning(self):	
		self.session.open(MessageBox, _("PLEASE READ!\nNo disk found. An hard drive or an usb pen is HARDLY SUGGESTED. If you still want use your internal flash pay attention to:\n(1) If you don't have enough free space your box may completely block and you need to flash it again\n(2) Many write operations on your internal flash may damage your flash memory"), type = MessageBox.TYPE_ERROR)
	
	def keyLeft(self):
		self["config"].handleKey(KEY_LEFT)
		self.update()
		#self.setInfo()

	def keyRight(self):
		self["config"].handleKey(KEY_RIGHT)
		self.update()
		#self.setInfo()

	def keyHome(self):
		self["config"].handleKey(KEY_HOME)
		self.update()
		#self.setInfo()

	def keyEnd(self):
		self["config"].handleKey(KEY_END)
		self.update()
		#self.setInfo()

	def keyNumberGlobal(self, number):
		self["config"].handleKey(KEY_0 + number)
		self.update()
		#self.setInfo()

	def makeList(self):
		self.list = []

		device_default = None
		i = 0
		for mountpoint in self.mountpoint:
			if mountpoint == self.config.db_root:
				device_default = self.mountdescription[i]
			i += 1

		# default device is really important... if miss a default we force it on first entry and update now the main config
		if device_default == None:
			self.config.db_root = self.mountpoint[0]
			device_default = self.mountdescription[0]
			
		lamedb_default = _("main lamedb")
		if self.config.lamedb != "lamedb":
			lamedb_default = self.config.lamedb.replace("lamedb.", "").replace(".", " ")

		scheduled_default = None
		if self.config.download_standby_enabled:
			scheduled_default = _("every hour (only in standby)")
		elif self.config.download_daily_enabled:
			scheduled_default = _("once a day")
		else:
			scheduled_default = _("disabled")

		self.list.append((_("Storage device"), ConfigSelection(self.mountdescription, device_default)))
		if len(self.lamedbs_desc) > 1:
			self.list.append((_("Preferred lamedb"), ConfigSelection(self.lamedbs_desc, lamedb_default)))

		self.list.append((_("Enable csv import"), ConfigYesNo(self.config.csv_import_enabled > 0)))
		self.list.append((_("Force epg reload on boot"), ConfigYesNo(self.config.force_load_on_boot > 0)))
		self.list.append((_("Download on tune"), ConfigYesNo(self.config.download_tune_enabled > 0)))
		self.list.append((_("Scheduled download"), ConfigSelection(self.automatictype, scheduled_default)))

		if self.config.download_daily_enabled:
			ttime = localtime()
			ltime = (ttime[0], ttime[1], ttime[2], self.config.download_daily_hours, self.config.download_daily_minutes, ttime[5], ttime[6], ttime[7], ttime[8])
			self.list.append((_("Scheduled download at"), ConfigClock(mktime(ltime))))

		if not self.fastpatch:
			self.list.append((_("Reboot after a scheduled download"), ConfigYesNo(self.config.download_daily_reboot > 0)))
			self.list.append((_("Reboot after a manual download"), ConfigYesNo(self.config.download_manual_reboot > 0)))
		self.list.append((_("Show as plugin"), ConfigYesNo(self.config.show_plugin > 0)))
		self.list.append((_("Show as extension"), ConfigYesNo(self.config.show_extension > 0)))
		self.list.append((_("Show 'Force reload' as plugin"), ConfigYesNo(self.config.show_force_reload_as_plugin > 0)))

		self["config"].setList(self.list)
		self.setInfo()

	def update(self):
		redraw = False
		self.config.db_root = self.mountpoint[self.list[0][1].getIndex()]
		
		i = 1
		if len(self.lamedbs_desc) > 1:
			self.config.lamedb = self.lamedbs[self.list[i][1].getIndex()]
			i += 1

		self.config.csv_import_enabled = int(self.list[i][1].getValue())
		self.config.force_load_on_boot = int(self.list[i+1][1].getValue())
		self.config.download_tune_enabled = int(self.list[i+2][1].getValue())

		dailycache = self.config.download_daily_enabled
		standbycache = self.config.download_standby_enabled
		if self.list[i+3][1].getIndex() == 0:
			self.config.download_daily_enabled = 0
			self.config.download_standby_enabled = 0
		elif self.list[i+3][1].getIndex() == 1:
			self.config.download_daily_enabled = 1
			self.config.download_standby_enabled = 0
		else:
			self.config.download_daily_enabled = 0
			self.config.download_standby_enabled = 1

		if dailycache != self.config.download_daily_enabled or standbycache != self.config.download_standby_enabled:
			redraw = True

		i += 4
		if dailycache:
			self.config.download_daily_hours = self.list[i][1].getValue()[0]
			self.config.download_daily_minutes = self.list[i][1].getValue()[1]
			i += 1

		if not self.fastpatch:
			self.config.download_daily_reboot = int(self.list[i][1].getValue())
			self.config.download_manual_reboot = int(self.list[i+1][1].getValue())
			i += 2

		self.config.show_plugin = int(self.list[i][1].getValue())
		self.config.show_extension = int(self.list[i+1][1].getValue())
		self.config.show_force_reload_as_plugin = int(self.list[i+2][1].getValue())

		if redraw:
			self.makeList()

	def setInfo(self):
		index = self["config"].getCurrentIndex()
		if len(self.lamedbs_desc) <= 1 and index > 0:
			index += 1
		if self.config.download_daily_enabled == 0 and index > 5:
			index += 1
		if self.fastpatch and index > 6:
			index += 2

		if index == 0:
			self["information"].setText(_("Drive where you save data.\nThe drive MUST be mounted in rw. If you can't see your device here probably is mounted as read only or autofs handle it only in read only mode. In case of mount it manually and try again"))
		elif index == 1:
			self["information"].setText(_("Lamedb used for epg.dat conversion.\nThis option doesn't work with crossepg patch v2"))
		elif index == 2:
			self["information"].setText(_("Import *.csv and *.bin from %s/import or %s/import\n(*.bin are binaries with a csv as stdout)") % (self.config.db_root, self.config.home_directory))
		elif index == 3:
			self["information"].setText(_("Reload epg at every boot.\nNormally it's not necessary but recover epg after an enigma2 crash"))
		elif index == 4:
			self["information"].setText(_("Only for opentv providers.\nIf you zap on channel used from a provider it download the epg in background"))
		elif index == 5:
			if self.config.download_standby_enabled:
				self["information"].setText(_("When the decoder is in standby opentv providers will be automatically downloaded every hour.\nXMLTV providers will be always downloaded only once a day"))
			elif self.config.download_daily_enabled:
				self["information"].setText(_("Download epg once a day"))
			else:
				self["information"].setText(_("Scheduled download disabled"))
		elif index == 6:
			self["information"].setText(_("Time for scheduled daily download"))
		elif index == 7:
			self["information"].setText(_("Automatically reboot the decoder after a scheduled download"))
		elif index == 8:
			self["information"].setText(_("Automatically reboot the decoder after a manual download"))
		elif index == 9:
			self["information"].setText(_("Show crossepg in plugin menu"))
		elif index == 10:
			self["information"].setText(_("Show crossepg in extensions menu"))
		
	def quit(self):
		self.config.last_full_download_timestamp = 0
		self.config.last_partial_download_timestamp = 0
		self.config.configured = 1
		self.config.save()
		try:
			if self.config.db_root[-8:] == "crossepg":
				config.misc.epgcache_filename.setValue(self.config.db_root[:-9] + "/epg.dat")
			else:
				config.misc.epgcache_filename.setValue(self.config.db_root + "/epg.dat")
			config.misc.epgcache_filename.callNotifiersOnSaveAndCancel = True
			config.misc.epgcache_filename.save()
			configfile.save()
		except Exception, e:
			print "custom epgcache filename not supported by current enigma2 version"
			
		if getEPGPatchType() == -1:
			# exec crossepg_prepare_pre_start for unpatched images
			os.system(self.config.home_directory + "/crossepg_prepare_pre_start.sh")
			
		if self.show_extension != self.config.show_extension or self.show_plugin != self.config.show_plugin:
			for plugin in plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU):
				if plugin.name == "CrossEPG Downloader":
					plugins.removePlugin(plugin)
				
			for plugin in plugins.getPlugins(PluginDescriptor.WHERE_EXTENSIONSMENU):
				if plugin.name == "CrossEPG Downloader":
					plugins.removePlugin(plugin)
				
			plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
			
		crossepg_auto.forcePoll()
		
		if self.config.db_root == self.config.home_directory + "/data" and not self.config.isQBOXHD():
			self.showWarning()
			
		self.close()
Ejemplo n.º 41
0
    def __init__(self, nextRecordTimerAfterEventActionAuto=False):
        if NavigationInstance.instance is not None:
            raise NavigationInstance.instance

        NavigationInstance.instance = self
        self.ServiceHandler = eServiceCenter.getInstance()

        import Navigation as Nav
        Nav.navcore = self

        self.pnav = pNavigation()
        self.pnav.m_event.get().append(self.dispatchEvent)
        self.pnav.m_record_event.get().append(self.dispatchRecordEvent)
        self.event = []
        self.record_event = []
        self.currentlyPlayingServiceReference = None
        self.currentlyPlayingServiceOrGroup = None
        self.currentlyPlayingService = None
        self.RecordTimer = None
        for p in plugins.getPlugins(PluginDescriptor.WHERE_RECORDTIMER):
            self.RecordTimer = p()
            if self.RecordTimer:
                break
        if not self.RecordTimer:
            self.RecordTimer = RecordTimer.RecordTimer()
        self.nextRecordTimerAfterEventActionAuto = nextRecordTimerAfterEventActionAuto
        self.__wasTimerWakeup = False
        self.__wasRecTimerWakeup = False
        self.syncCount = 0
        self.__isRestartUI = config.misc.RestartUI.value
        startup_to_standby = config.usage.startup_to_standby.value
        wakeup_time_type = config.misc.prev_wakeup_time_type.value

        wasTimerWakeup = getFPWasTimerWakeup()
        if not wasTimerWakeup:  #work-around for boxes where driver not sent was_timer_wakeup signal to e2
            print "[NAVIGATION] getNextRecordingTime= %s" % self.RecordTimer.getNextRecordingTime(
            )
            print "[NAVIGATION] current Time=%s" % time()
            print "[NAVIGATION] timediff=%s" % abs(
                self.RecordTimer.getNextRecordingTime() - time())

            if time(
            ) <= 31536000:  # check for NTP-time sync, if no sync, wait for transponder time
                self.timesynctimer = eTimer()
                self.timesynctimer.callback.append(self.TimeSynctimer)
                self.timesynctimer.start(5000, True)
                print "[NAVIGATION] wait for time sync"

            elif abs(
                    self.RecordTimer.getNextRecordingTime() - time()
            ) <= 360:  # if there is a recording sheduled in the next 5 mins, set the wasTimerWakeup flag
                wasTimerWakeup = True
                f = open("/tmp/was_timer_wakeup_workaround.txt", "w")
                file = f.write(str(wasTimerWakeup))
                f.close()

        print "[NAVIGATION] wasTimerWakeup = %s" % wasTimerWakeup

        if wasTimerWakeup:
            self.__wasTimerWakeup = True
            if time() <= 31536000:
                self.timesynctimer = eTimer()
                self.timesynctimer.callback.append(self.TimeSynctimer)
                self.timesynctimer.start(5000, True)
                print "[NAVIGATION] wait for time sync"

            elif nextRecordTimerAfterEventActionAuto and abs(
                    self.RecordTimer.getNextRecordingTime() - time()) <= 360:
                self.__wasRecTimerWakeup = True
                print 'RECTIMER: wakeup to standby detected.'
                f = open("/tmp/was_rectimer_wakeup", "w")
                f.write('1')
                f.close()
                # as we woke the box to record, place the box in standby.
                self.standbytimer = eTimer()
                self.standbytimer.callback.append(self.gotostandby)
                self.standbytimer.start(15000, True)
        if config.usage.remote_fallback_import_restart.value:
            ImportChannels()
        if config.misc.RestartUI.value:
            config.misc.RestartUI.value = False
            config.misc.RestartUI.save()
            configfile.save()
        else:
            if config.usage.remote_fallback_import.value and not config.usage.remote_fallback_import_restart.value:
                ImportChannels()
            if startup_to_standby == "yes" or self.__wasTimerWakeup and config.misc.prev_wakeup_time.value and (
                (wakeup_time_type == 0 or wakeup_time_type == 1) or
                (wakeup_time_type == 3 and startup_to_standby == "except")):
                if not Screens.Standby.inTryQuitMainloop:
                    Notifications.AddNotification(Screens.Standby.Standby)
        if config.misc.prev_wakeup_time.value:
            config.misc.prev_wakeup_time.value = 0
            config.misc.prev_wakeup_time.save()
            configfile.save()
Ejemplo n.º 42
0
    def fillList(self, arg=None):
        streams = []
        conflist = []
        selectedidx = 0

        if self.settings.menupage.getValue() == PAGE_AUDIO:
            self.setTitle(_("Select audio track"))
            service = self.session.nav.getCurrentService()
            self.audioTracks = audio = service and service.audioTracks()
            n = audio and audio.getNumberOfTracks() or 0
            if SystemInfo["CanDownmixAC3"]:
                self.settings.downmix = ConfigOnOff(
                    default=config.av.downmix_ac3.value)
                self.settings.downmix.addNotifier(self.changeAC3Downmix,
                                                  initial_call=False)
                conflist.append(
                    getConfigListEntry(_("AC3 downmix"),
                                       self.settings.downmix))
                self["key_red"].setBoolean(True)

            if n > 0:
                self.audioChannel = service.audioChannel()
                if self.audioChannel:
                    choicelist = [("0", _("left")), ("1", _("stereo")),
                                  ("2", _("right"))]
                    self.settings.channelmode = ConfigSelection(
                        choices=choicelist,
                        default=str(self.audioChannel.getCurrentChannel()))
                    self.settings.channelmode.addNotifier(self.changeMode,
                                                          initial_call=False)
                    conflist.append(
                        getConfigListEntry(_("Channel"),
                                           self.settings.channelmode))
                    self["key_green"].setBoolean(True)
                else:
                    conflist.append(('', ))
                    self["key_green"].setBoolean(False)
                selectedAudio = self.audioTracks.getCurrentTrack()
                for x in range(n):
                    number = str(x)
                    i = audio.getTrackInfo(x)
                    languages = i.getLanguage().split('/')
                    description = i.getDescription() or _("<unknown>")
                    selected = ""
                    language = ""

                    if selectedAudio == x:
                        selected = _("Running")
                        selectedidx = x

                    cnt = 0
                    for lang in languages:
                        if cnt:
                            language += ' / '
                        if LanguageCodes.has_key(lang):
                            language += LanguageCodes[lang][0]
                        elif lang == "und":
                            _("<unknown>")
                        else:
                            language += lang
                        cnt += 1

                    streams.append(
                        (x, "", number, description, language, selected))

            else:
                streams = []
                conflist.append(('', ))
                self["key_green"].setBoolean(False)

        elif self.settings.menupage.getValue() == PAGE_SUBTITLES:
            self.setTitle(_("Subtitle selection"))
            conflist.append(('', ))
            conflist.append(('', ))
            self["key_red"].setBoolean(False)
            self["key_green"].setBoolean(False)

            if self.subtitlesEnabled():
                sel = self.infobar.selected_subtitle
            else:
                sel = None

            idx = 0

            subtitlelist = self.getSubtitleList()

            if len(subtitlelist):
                for x in subtitlelist:
                    number = str(x[1])
                    description = "?"
                    language = _("<unknown>")
                    selected = ""

                    if sel and x == sel:
                        selected = _("Running")
                        selectedidx = idx

                    if x[4] != "und":
                        if LanguageCodes.has_key(x[4]):
                            language = LanguageCodes[x[4]][0]
                        else:
                            language = x[4]

                    if x[0] == 0:
                        description = "DVB"
                        number = "%x" % (x[1])

                    elif x[0] == 1:
                        description = "TTX"
                        number = "%x%02x" % (x[3], x[2])

                    elif x[0] == 2:
                        types = (_("<unknown>"), "UTF-8 text", "SSA", "AAS",
                                 ".SRT file", "VOB", "PGS (unsupported)")
                        description = types[x[2]]

                    streams.append(
                        (x, "", number, description, language, selected))
                    idx += 1

            else:
                streams = []

        conflist.append(getConfigListEntry(_("Menu"), self.settings.menupage))

        from Components.PluginComponent import plugins
        from Plugins.Plugin import PluginDescriptor

        if hasattr(self.infobar, "runPlugin"):

            class PluginCaller:
                def __init__(self, fnc, *args):
                    self.fnc = fnc
                    self.args = args

                def __call__(self, *args, **kwargs):
                    self.fnc(*self.args)

            Plugins = [(p.name, PluginCaller(self.infobar.runPlugin, p))
                       for p in plugins.getPlugins(
                           where=PluginDescriptor.WHERE_AUDIOMENU)]

            if len(Plugins):
                self["key_blue"].setBoolean(True)
                conflist.append(
                    getConfigListEntry(Plugins[0][0], ConfigNothing()))
                self.plugincallfunc = Plugins[0][1]
            if len(Plugins) > 1:
                print "plugin(s) installed but not displayed in the dialog box:", Plugins[
                    1:]

        self["config"].list = conflist
        self["config"].l.setList(conflist)

        self["streams"].list = streams
        self["streams"].setIndex(selectedidx)
Ejemplo n.º 43
0
    def createMenuList(self):
        self.list = []
        self.menuID = None
        count = 0
        for x in self.parentmenu:  #walk through the actual nodelist
            if not x.tag:
                continue
            if x.tag == 'item':
                item_level = int(x.get('level', 0))
                if item_level <= config.usage.setup_level.index:
                    self.addItem(self.list, x)
                    count += 1
            elif x.tag == 'menu':
                item_level = int(x.get('level', 0))
                if item_level <= config.usage.setup_level.index:
                    self.addMenu(self.list, x)
                    count += 1
            elif x.tag == 'id':
                self.menuID = x.get('val')
                count = 0
            if self.menuID is not None:
                if menuupdater.updatedMenuAvailable(self.menuID):
                    for x in menuupdater.getUpdatedMenu(self.menuID):
                        if x[1] == count:
                            description = x.get('description',
                                                '').encode('UTF-8') or None
                            description = description and _(description)
                            menupng = MenuEntryPixmap(self.menuID,
                                                      self.png_cache,
                                                      lastMenuID)
                            self.list.append(
                                (x[0],
                                 boundFunction(self.runScreen,
                                               (x[2], x[3] + ', ')), x[4],
                                 description, menupng))
                            count += 1

        if self.menuID is not None:
            for l in plugins.getPluginsForMenu(self.menuID):
                plugin_menuid = l[2]
                for x in self.list:
                    if x[2] == plugin_menuid:
                        self.list.remove(x)
                        break

                description = plugins.getDescriptionForMenuEntryID(
                    self.menuID, plugin_menuid)
                menupng = MenuEntryPixmap(l[2], self.png_cache, lastMenuID)
                self.list.append((l[0], boundFunction(l[1],
                                                      self.session), l[2], l[3]
                                  or 50, description, menupng))

        if config.usage.menu_sort_mode.value == 'user' and self.menuID == 'mainmenu':
            plugin_list = []
            id_list = []
            for l in plugins.getPlugins([
                    PluginDescriptor.WHERE_PLUGINMENU,
                    PluginDescriptor.WHERE_EXTENSIONSMENU,
                    PluginDescriptor.WHERE_EVENTINFO
            ]):
                l.id = l.name.lower().replace(' ', '_')
                if l.id not in id_list:
                    id_list.append(l.id)
                    plugin_list.append(
                        (l.name, boundFunction(l.__call__,
                                               self.session), l.id, 200))

        if self.menuID is not None and config.usage.menu_sort_mode.value == 'user':
            self.sub_menu_sort = NoSave(ConfigDictionarySet())
            self.sub_menu_sort.value = config.usage.menu_sort_weight.getConfigValue(
                self.menuID, 'submenu') or {}
            idx = 0
            for x in self.list:
                entry = list(self.list.pop(idx))
                m_weight = self.sub_menu_sort.getConfigValue(
                    entry[2], 'sort') or entry[3]
                entry.append(m_weight)
                self.list.insert(idx, tuple(entry))
                self.sub_menu_sort.changeConfigValue(entry[2], 'sort',
                                                     m_weight)
                idx += 1

            self.full_list = list(self.list)
        if config.usage.menu_sort_mode.value == 'a_z':
            self.list.sort(key=self.sortByName)
        elif config.usage.menu_sort_mode.value == 'user':
            self.hide_show_entries()
        else:
            self.list.sort(key=lambda x: int(x[3]))

        if config.usage.menu_show_numbers.value:
            self.list = [(str(x[0] + 1) + " " + x[1][0], x[1][1], x[1][2])
                         for x in enumerate(self.list)]

        self['menu'].updateList(self.list)
Ejemplo n.º 44
0
 def execHotkey(self, selected):
     if selected:
         selected = selected[1].split("/")
         if selected[0] == "Plugins":
             twinPlugins = []
             twinPaths = {}
             pluginlist = plugins.getPlugins(
                 PluginDescriptor.WHERE_EVENTINFO)
             pluginlist.sort(key=lambda p: p.name)
             for plugin in pluginlist:
                 if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames:
                     if plugin.path[24:] in twinPaths:
                         twinPaths[plugin.path[24:]] += 1
                     else:
                         twinPaths[plugin.path[24:]] = 1
                     if plugin.path[24:] + "/" + str(twinPaths[
                             plugin.path[24:]]) == "/".join(selected):
                         self.runPlugin(plugin)
                         return
                     twinPlugins.append(plugin.name)
             pluginlist = plugins.getPlugins([
                 PluginDescriptor.WHERE_PLUGINMENU,
                 PluginDescriptor.WHERE_EXTENSIONSMENU
             ])
             pluginlist.sort(key=lambda p: p.name)
             for plugin in pluginlist:
                 if plugin.name not in twinPlugins and plugin.path:
                     if plugin.path[24:] in twinPaths:
                         twinPaths[plugin.path[24:]] += 1
                     else:
                         twinPaths[plugin.path[24:]] = 1
                     if plugin.path[24:] + "/" + str(twinPaths[
                             plugin.path[24:]]) == "/".join(selected):
                         self.runPlugin(plugin)
                         return
                     twinPlugins.append(plugin.name)
         elif selected[0] == "MenuPlugin":
             for plugin in plugins.getPluginsForMenu(selected[1]):
                 if plugin[2] == selected[2]:
                     self.runPlugin(plugin[1])
                     return
         elif selected[0] == "Infobar":
             if hasattr(self, selected[1]):
                 exec "self." + ".".join(selected[1:]) + "()"
             else:
                 return 0
         elif selected[0] == "Module":
             try:
                 exec "from " + selected[1] + " import *"
                 exec "self.session.open(" + ",".join(selected[2:]) + ")"
             except:
                 print "[Hotkey] error during executing module %s, screen %s" % (
                     selected[1], selected[2])
         elif selected[0] == "SoftcamSetup" and SystemInfo[
                 "HasSoftcamInstalled"]:
             from Screens.SoftcamSetup import SoftcamSetup
             self.session.open(SoftcamSetup)
         elif selected[0] == "Setup":
             from Screens.Setup import *
             exec "self.session.open(Setup, \"" + selected[1] + "\")"
         elif selected[0].startswith("Zap"):
             if selected[0] == "ZapPanic":
                 self.servicelist.history = []
                 self.pipShown() and self.showPiP()
             self.servicelist.servicelist.setCurrent(
                 eServiceReference("/".join(selected[1:])))
             self.servicelist.zap(enable_pipzap=True)
             if hasattr(self, "lastservice"):
                 self.lastservice = eServiceReference("/".join(
                     selected[1:]))
                 self.close()
             else:
                 self.show()
             from Screens.MovieSelection import defaultMoviePath
             moviepath = defaultMoviePath()
             if moviepath:
                 config.movielist.last_videodir.value = moviepath
         elif selected[0] == "PPanel":
             ppanelFileName = '/etc/ppanels/' + selected[1] + ".xml"
             if os.path.isfile(ppanelFileName) and os.path.isdir(
                     '/usr/lib/enigma2/python/Plugins/Extensions/PPanel'):
                 from Plugins.Extensions.PPanel.ppanel import PPanel
                 self.session.open(PPanel,
                                   name=selected[1] + ' PPanel',
                                   node=None,
                                   filename=ppanelFileName,
                                   deletenode=None)
         elif selected[0] == "Shellscript":
             command = '/usr/script/' + selected[1] + ".sh"
             if os.path.isfile(command):
                 if ".hidden." in command:
                     from enigma import eConsoleAppContainer
                     eConsoleAppContainer().execute(command)
                 else:
                     from Screens.Console import Console
                     self.session.open(
                         Console,
                         selected[1] + " shellscript",
                         command,
                         closeOnSuccess=selected[1].startswith('!'),
                         showStartStopText=False)
         elif selected[0] == "Menu":
             from Screens.Menu import MainMenu, mdom
             root = mdom.getroot()
             for x in root.findall("menu"):
                 y = x.find("id")
                 if y is not None:
                     id = y.get("val")
                     if id and id == selected[1]:
                         menu_screen = self.session.open(MainMenu, x)
                         break
Ejemplo n.º 45
0
 def createSetup(self, widget):
     cfglist = []
     red_b_selectedindex = self.getStaticPluginName(
         config.plugins.Quickbutton.red_b.value)
     red_selectedindex = self.getStaticPluginName(
         config.plugins.Quickbutton.red.value)
     green_selectedindex = self.getStaticPluginName(
         config.plugins.Quickbutton.green.value)
     yellow_selectedindex = self.getStaticPluginName(
         config.plugins.Quickbutton.yellow.value)
     blue_selectedindex = self.getStaticPluginName(
         config.plugins.Quickbutton.blue.value)
     # feste Vorgaben...koennte man noch erweitern, da hole ich mir sinnvolle Vorschlaege aus Foren noch ein...
     self.entryguilist.append(("0", _("Nothing")))
     self.entryguilist.append(("1", _("Single EPG")))
     self.entryguilist.append(("2", _("Multi EPG")))
     self.entryguilist.append(("3", _("MediaPlayer")))
     self.entryguilist.append(("4", _("Plugin browser")))
     self.entryguilist.append(("5", _("switch 4:3 content display")))
     self.entryguilist.append(("6", _("Timer")))
     if self.hbbtvinstalled:
         self.entryguilist.append(("7", _("HbbTV Applications")))
         index = 8
     else:
         index = 7
     # Vorgaben aus EXTENSIONSMENU, PLUGINMENU
     for p in plugins.getPlugins(where=[
             PluginDescriptor.WHERE_EXTENSIONSMENU,
             PluginDescriptor.WHERE_PLUGINMENU
     ]):
         self.entryguilist.append((str(index), str(p.name)))
         if config.plugins.Quickbutton.red.value == str(p.name):
             red_selectedindex = str(index)
         if config.plugins.Quickbutton.red_b.value == str(p.name):
             red_b_selectedindex = str(index)
         if config.plugins.Quickbutton.green.value == str(p.name):
             green_selectedindex = str(index)
         if config.plugins.Quickbutton.yellow.value == str(p.name):
             yellow_selectedindex = str(index)
         if config.plugins.Quickbutton.blue.value == str(p.name):
             blue_selectedindex = str(index)
         index = index + 1
     self.overwriteHBBTVButtonEntry = None
     if self.hbbtvinstalled and ENABLE_RED_BUTTON:
         self.overwriteHBBTVButtonEntry = getConfigListEntry(
             _("Overwrite HBBTV-red-button"), self.overwriteHBBTVButton)
         cfglist.append(self.overwriteHBBTVButtonEntry)
     self.redchoice = ConfigSelection(default=red_selectedindex,
                                      choices=self.entryguilist)
     self.greenchoice = ConfigSelection(default=green_selectedindex,
                                        choices=self.entryguilist)
     self.yellowchoice = ConfigSelection(default=yellow_selectedindex,
                                         choices=self.entryguilist)
     self.bluechoice = ConfigSelection(default=blue_selectedindex,
                                       choices=self.entryguilist)
     cfglist.append(
         getConfigListEntry(_("assigned to long red"), self.redchoice))
     cfglist.append(
         getConfigListEntry(_("assigned to long green"), self.greenchoice))
     cfglist.append(
         getConfigListEntry(_("assigned to long yellow"),
                            self.yellowchoice))
     cfglist.append(
         getConfigListEntry(_("assigned to long blue"), self.bluechoice))
     if ENABLE_RED_BUTTON and (self.overwriteHBBTVButton.value
                               or not self.hbbtvinstalled):
         self.red_b_choice = ConfigSelection(default=red_b_selectedindex,
                                             choices=self.entryguilist)
         cfglist.append(
             getConfigListEntry(_("assigned to red"), self.red_b_choice))
     self[widget].list = cfglist
     self[widget].l.setList(cfglist)
Ejemplo n.º 46
0
def getButtonSetupFunctions():
    ButtonSetupFunctions = []
    twinPlugins = []
    twinPaths = {}
    pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO)
    pluginlist.sort(key=lambda p: p.name)
    for plugin in pluginlist:
        if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames:
            if twinPaths.has_key(plugin.path[24:]):
                twinPaths[plugin.path[24:]] += 1
            else:
                twinPaths[plugin.path[24:]] = 1
            ButtonSetupFunctions.append(
                (plugin.name,
                 plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]),
                 "EPG"))
            twinPlugins.append(plugin.name)
    pluginlist = plugins.getPlugins([
        PluginDescriptor.WHERE_PLUGINMENU,
        PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO
    ])
    pluginlist.sort(key=lambda p: p.name)
    for plugin in pluginlist:
        if plugin.name not in twinPlugins and plugin.path:
            if twinPaths.has_key(plugin.path[24:]):
                twinPaths[plugin.path[24:]] += 1
            else:
                twinPaths[plugin.path[24:]] = 1
            ButtonSetupFunctions.append(
                (plugin.name,
                 plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]),
                 "Plugins"))
            twinPlugins.append(plugin.name)
    ButtonSetupFunctions.append(
        (_("Show graphical multi EPG"), "Infobar/openGraphEPG", "EPG"))
    ButtonSetupFunctions.append(
        (_("Main menu"), "Infobar/mainMenu", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show help"), "Infobar/showHelp", "InfoBar"))
    ButtonSetupFunctions.append((_("Show extension selection"),
                                 "Infobar/showExtensionSelection", "InfoBar"))
    ButtonSetupFunctions.append((_("Zap down"), "Infobar/zapDown", "InfoBar"))
    ButtonSetupFunctions.append((_("Zap up"), "Infobar/zapUp", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Volume down"), "Infobar/volumeDown", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Volume up"), "Infobar/volumeUp", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show Infobar"), "Infobar/toggleShow", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show service list"), "Infobar/openServiceList", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show favourites list"), "Infobar/openBouquets", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show satellites list"), "Infobar/openSatellites", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("History back"), "Infobar/historyBack", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("History next"), "Infobar/historyNext", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show eventinfo plugins"), "Infobar/showEventInfoPlugins", "EPG"))
    ButtonSetupFunctions.append(
        (_("Show event details"), "Infobar/openEventView", "EPG"))
    ButtonSetupFunctions.append(
        (_("Show single service EPG"), "Infobar/openSingleServiceEPG", "EPG"))
    ButtonSetupFunctions.append(
        (_("Show multi channel EPG"), "Infobar/openMultiServiceEPG", "EPG"))
    ButtonSetupFunctions.append(
        (_("Show Audioselection"), "Infobar/audioSelection", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Switch to radio mode"), "Infobar/showRadio", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Switch to TV mode"), "Infobar/showTv", "InfoBar"))
    ButtonSetupFunctions.append((_("Show servicelist or movies"),
                                 "Infobar/showServiceListOrMovies", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show movies"), "Infobar/showMovies", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Instant record"), "Infobar/instantRecord", "InfoBar"))
    ButtonSetupFunctions.append((_("Start instant recording"),
                                 "Infobar/startInstantRecording", "InfoBar"))
    ButtonSetupFunctions.append((_("Activate timeshift End"),
                                 "Infobar/activateTimeshiftEnd", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Activate timeshift end and pause"),
         "Infobar/activateTimeshiftEndAndPause", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Start timeshift"), "Infobar/startTimeshift", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Stop timeshift"), "Infobar/stopTimeshift", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Start teletext"), "Infobar/startTeletext", "InfoBar"))
    ButtonSetupFunctions.append((_("Show subservice selection"),
                                 "Infobar/subserviceSelection", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show subtitle selection"), "Infobar/subtitleSelection", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Letterbox zoom"), "Infobar/vmodeSelection", "InfoBar"))
    if SystemInfo["PIPAvailable"]:
        ButtonSetupFunctions.append(
            (_("Show PIP"), "Infobar/showPiP", "InfoBar"))
        ButtonSetupFunctions.append(
            (_("Swap PIP"), "Infobar/swapPiP", "InfoBar"))
        ButtonSetupFunctions.append(
            (_("Move PIP"), "Infobar/movePiP", "InfoBar"))
        ButtonSetupFunctions.append(
            (_("Toggle PIPzap"), "Infobar/togglePipzap", "InfoBar"))
    ButtonSetupFunctions.append((_("Activate HbbTV (Redbutton)"),
                                 "Infobar/activateRedButton", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Toggle HDMI-In full screen"), "Infobar/HDMIInFull", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Toggle HDMI-In PiP"), "Infobar/HDMIInPiP", "InfoBar"))
    if SystemInfo["LcdLiveTV"]:
        ButtonSetupFunctions.append(
            (_("Toggle LCD LiveTV"), "Infobar/ToggleLCDLiveTV", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Hotkey Setup"), "Module/Screens.ButtonSetup/ButtonSetup", "Setup"))
    ButtonSetupFunctions.append(
        (_("Software update"), "Module/Screens.SoftwareUpdate/UpdatePlugin",
         "Setup"))
    ButtonSetupFunctions.append((_("CI (Common Interface) Setup"),
                                 "Module/Screens.Ci/CiSelection", "Setup"))
    ButtonSetupFunctions.append(
        (_("Tuner Configuration"), "Module/Screens.Satconfig/NimSelection",
         "Scanning"))
    ButtonSetupFunctions.append(
        (_("Manual Scan"), "Module/Screens.ScanSetup/ScanSetup", "Scanning"))
    ButtonSetupFunctions.append(
        (_("Automatic Scan"), "Module/Screens.ScanSetup/ScanSimple",
         "Scanning"))
    for plugin in plugins.getPluginsForMenu("scan"):
        ButtonSetupFunctions.append(
            (plugin[0], "MenuPlugin/scan/" + plugin[2], "Scanning"))
    ButtonSetupFunctions.append(
        (_("Network setup"),
         "Module/Screens.NetworkSetup/NetworkAdapterSelection", "Setup"))
    ButtonSetupFunctions.append(
        (_("Network menu"), "Infobar/showNetworkMounts", "Setup"))
    ButtonSetupFunctions.append(
        (_("Plugin Browser"), "Module/Screens.PluginBrowser/PluginBrowser",
         "Setup"))
    ButtonSetupFunctions.append(
        (_("Channel Info"), "Module/Screens.ServiceInfo/ServiceInfo", "Setup"))
    ButtonSetupFunctions.append(
        (_("SkinSelector"), "Module/Screens.SkinSelector/SkinSelector",
         "Setup"))
    ButtonSetupFunctions.append(
        (_("LCD SkinSelector"), "Module/Screens.SkinSelector/LcdSkinSelector",
         "Setup"))
    ButtonSetupFunctions.append(
        (_("Timer"), "Module/Screens.TimerEdit/TimerEditList", "Setup"))
    ButtonSetupFunctions.append(
        (_("Open AutoTimer"), "Infobar/showAutoTimerList", "Setup"))
    for plugin in plugins.getPluginsForMenu("system"):
        if plugin[2]:
            ButtonSetupFunctions.append(
                (plugin[0], "MenuPlugin/system/" + plugin[2], "Setup"))
    ButtonSetupFunctions.append(
        (_("Standby"), "Module/Screens.Standby/Standby", "Power"))
    ButtonSetupFunctions.append(
        (_("Restart"), "Module/Screens.Standby/TryQuitMainloop/2", "Power"))
    ButtonSetupFunctions.append(
        (_("Restart enigma"), "Module/Screens.Standby/TryQuitMainloop/3",
         "Power"))
    ButtonSetupFunctions.append(
        (_("Deep standby"), "Module/Screens.Standby/TryQuitMainloop/1",
         "Power"))
    ButtonSetupFunctions.append(
        (_("SleepTimer"), "Module/Screens.SleepTimerEdit/SleepTimerEdit",
         "Power"))
    ButtonSetupFunctions.append(
        (_("PowerTimer"), "Module/Screens.PowerTimerEdit/PowerTimerEditList",
         "Power"))
    ButtonSetupFunctions.append((_("Usage Setup"), "Setup/usage", "Setup"))
    ButtonSetupFunctions.append(
        (_("User interface settings"), "Setup/userinterface", "Setup"))
    ButtonSetupFunctions.append(
        (_("Recording Setup"), "Setup/recording", "Setup"))
    ButtonSetupFunctions.append(
        (_("Harddisk Setup"), "Setup/harddisk", "Setup"))
    ButtonSetupFunctions.append(
        (_("Subtitles Settings"), "Setup/subtitlesetup", "Setup"))
    ButtonSetupFunctions.append(
        (_("Language"), "Module/Screens.LanguageSelection/LanguageSelection",
         "Setup"))
    ButtonSetupFunctions.append(
        (_("OscamInfo Mainmenu"), "Module/Screens.OScamInfo/OscamInfoMenu",
         "Plugins"))
    ButtonSetupFunctions.append(
        (_("CCcamInfo Mainmenu"), "Module/Screens.CCcamInfo/CCcamInfoMain",
         "Plugins"))
    if os.path.isdir("/etc/ppanels"):
        for x in [x for x in os.listdir("/etc/ppanels") if x.endswith(".xml")]:
            x = x[:-4]
            ButtonSetupFunctions.append(
                (_("PPanel") + " " + x, "PPanel/" + x, "PPanels"))
    if os.path.isdir("/usr/script"):
        for x in [x for x in os.listdir("/usr/script") if x.endswith(".sh")]:
            x = x[:-3]
            ButtonSetupFunctions.append((_("Shellscript") + " " + x,
                                         "Shellscript/" + x, "Shellscripts"))
    if os.path.isfile(
            "/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/ScriptRunner.pyo"
    ):
        ButtonSetupFunctions.append(
            (_("ScriptRunner"), "ScriptRunner/", "Plugins"))
    if os.path.isfile(
            "/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/QuickMenu.pyo"
    ):
        ButtonSetupFunctions.append((_("QuickMenu"), "QuickMenu/", "Plugins"))
    if os.path.isfile(
            "/usr/lib/enigma2/python/Plugins/Extensions/Kodi/plugin.pyo"):
        ButtonSetupFunctions.append(
            (_("Kodi MediaCenter"), "Kodi/", "Plugins"))
    return ButtonSetupFunctions
Ejemplo n.º 47
0
def runScreenTest():
    config.misc.startCounter.value += 1

    profile("readPluginList")
    plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))

    profile("Init:Session")
    nav = Navigation(config.misc.isNextRecordTimerAfterEventActionAuto.value)
    session = Session(desktop=getDesktop(0),
                      summary_desktop=getDesktop(1),
                      navigation=nav)

    CiHandler.setSession(session)

    screensToRun = [
        p.__call__ for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD)
    ]

    profile("wizards")
    screensToRun += wizardManager.getWizards()

    screensToRun.append((100, Screens.InfoBar.InfoBar))

    screensToRun.sort()

    ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey)

    #	eDVBCIInterfaces.getInstance().setDescrambleRules(0 # Slot Number
    #		,(	["1:0:1:24:4:85:C00000:0:0:0:"], #service_list
    #			["PREMIERE"], #provider_list,
    #			[] #caid_list
    #		));

    def runNextScreen(session, screensToRun, *result):
        if result:
            quitMainloop(*result)
            return

        screen = screensToRun[0][1]
        args = screensToRun[0][2:]

        if screensToRun:
            session.openWithCallback(
                boundFunction(runNextScreen, session, screensToRun[1:]),
                screen, *args)
        else:
            session.open(screen, *args)

    runNextScreen(session, screensToRun)

    profile("Init:VolumeControl")
    vol = VolumeControl(session)
    profile("Init:PowerKey")
    power = PowerKey(session)

    # we need session.scart to access it from within menu.xml
    session.scart = AutoScartControl(session)

    profile("RunReactor")
    profile_final()
    runReactor()

    config.misc.startCounter.save()

    profile("wakeup")
    from time import time, strftime, localtime
    from Tools.DreamboxHardware import setFPWakeuptime, getFPWakeuptime, setRTCtime
    #get currentTime
    nowTime = time()
    wakeupList = [
        x
        for x in ((session.nav.RecordTimer.getNextRecordingTime(), 0,
                   session.nav.RecordTimer.isNextRecordAfterEventActionAuto()),
                  (session.nav.RecordTimer.getNextZapTime(),
                   1), (plugins.getNextWakeupTime(), 2)) if x[0] != -1
    ]
    wakeupList.sort()
    recordTimerWakeupAuto = False
    if wakeupList:
        from time import strftime
        startTime = wakeupList[0]
        #+++> # Unfortunatly sometimes it takes longer to boot (filesystemcheck, ...) so start earlier
        #-		if (startTime[0] - nowTime) < 270: # no time to switch box back on
        #-			wptime = nowTime + 30  # so switch back on in 30 seconds
        #-		else:
        #-			wptime = startTime[0] - 240

        if (startTime[0] - nowTime) < 330:  # no time to switch box back on
            wptime = nowTime + 30  # so switch back on in 30 seconds
        else:
            wptime = startTime[0] - 300


#+++<
        if not config.misc.useTransponderTime.value:
            print "dvb time sync disabled... so set RTC now to current linux time!", strftime(
                "%Y/%m/%d %H:%M", localtime(nowTime))
            setRTCtime(nowTime)
        print "set wakeup time to", strftime("%Y/%m/%d %H:%M",
                                             localtime(wptime))
        setFPWakeuptime(wptime)
        recordTimerWakeupAuto = startTime[1] == 0 and startTime[2]
    config.misc.isNextRecordTimerAfterEventActionAuto.value = recordTimerWakeupAuto
    config.misc.isNextRecordTimerAfterEventActionAuto.save()

    profile("stopService")
    session.nav.stopService()
    profile("nav shutdown")
    session.nav.shutdown()

    profile("configfile.save")
    configfile.save()

    return 0
Ejemplo n.º 48
0
	def __init__(self, desktop = None, summary_desktop = None, navigation = None):
		self.desktop = desktop
		self.summary_desktop = summary_desktop
		self.nav = navigation
		self.delay_timer = enigma.eTimer()
		self.delay_timer.callback.append(self.processDelay)

		self.current_dialog = None

		self.dialog_stack = [ ]
		self.summary_stack = [ ]
		self.summary = None

		self.in_exec = False

		self.screen = SessionGlobals(self)

		##### hack for Openwebif - Create folders & symlink
		from enigma import eEnv
		from Tools.Directories import fileExists
		import os
		origwebifpath = eEnv.resolve('${libdir}/enigma2/python/Plugins/Extensions/WebInterface')
		hookpath = eEnv.resolve('${libdir}/enigma2/python/Plugins/Extensions/OpenWebif/pluginshook.src')
		if not os.path.islink(origwebifpath + "/WebChilds/Toplevel.py") and os.path.exists(hookpath):
			print "[OpenWebif] hooking original webif plugins"

			cleanuplist = [
				"/__init__.py",
				"/__init__.pyo",
				"/__init__.pyc",
				"/WebChilds/__init__.py",
				"/WebChilds/__init__.pyo",
				"/WebChilds/__init__.pyc",
				"/WebChilds/External/__init__.py",
				"/WebChilds/External/__init__.pyo",
				"/WebChilds/External/__init__.pyc",
				"/WebChilds/Toplevel.py",
				"/WebChilds/Toplevel.pyo"
				"/WebChilds/Toplevel.pyc"
			]

			for cleanupfile in cleanuplist:
				if fileExists(origwebifpath + cleanupfile):
					os.remove(origwebifpath + cleanupfile)

			if not os.path.exists(origwebifpath + "/WebChilds/External"):
				os.makedirs(origwebifpath + "/WebChilds/External")
			open(origwebifpath + "/__init__.py", "w").close()
			open(origwebifpath + "/WebChilds/__init__.py", "w").close()
			open(origwebifpath + "/WebChilds/External/__init__.py", "w").close()

			os.symlink(hookpath, origwebifpath + "/WebChilds/Toplevel.py")
		##########################################################

		for p in plugins.getPlugins(PluginDescriptor.WHERE_SESSIONSTART):
			try:
				p(reason=0, session=self)
			except:
				print "Plugin raised exception at WHERE_SESSIONSTART"
				import traceback
				traceback.print_exc()
Ejemplo n.º 49
0
 def execButtonSetup(self, selected):
     if selected:
         selected = selected[1].split("/")
         if selected[0] == "Plugins":
             twinPlugins = []
             twinPaths = {}
             pluginlist = plugins.getPlugins(
                 PluginDescriptor.WHERE_EVENTINFO)
             pluginlist.sort(key=lambda p: p.name)
             for plugin in pluginlist:
                 if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames:
                     if twinPaths.has_key(
                             plugin.path[plugin.path.rfind("Plugins"):]):
                         twinPaths[plugin.path[plugin.path.rfind("Plugins"
                                                                 ):]] += 1
                     else:
                         twinPaths[
                             plugin.path[plugin.path.rfind("Plugins"):]] = 1
                     if plugin.path[
                             plugin.path.rfind("Plugins"):] + "/" + str(
                                 twinPaths[plugin.path[plugin.path.rfind(
                                     "Plugins"):]]) == "/".join(selected):
                         self.runPlugin(plugin)
                         return
                     twinPlugins.append(plugin.name)
             pluginlist = plugins.getPlugins([
                 PluginDescriptor.WHERE_PLUGINMENU,
                 PluginDescriptor.WHERE_EXTENSIONSMENU
             ])
             pluginlist.sort(key=lambda p: p.name)
             for plugin in pluginlist:
                 if plugin.name not in twinPlugins and plugin.path:
                     if twinPaths.has_key(
                             plugin.path[plugin.path.rfind("Plugins"):]):
                         twinPaths[plugin.path[plugin.path.rfind("Plugins"
                                                                 ):]] += 1
                     else:
                         twinPaths[
                             plugin.path[plugin.path.rfind("Plugins"):]] = 1
                     if plugin.path[
                             plugin.path.rfind("Plugins"):] + "/" + str(
                                 twinPaths[plugin.path[plugin.path.rfind(
                                     "Plugins"):]]) == "/".join(selected):
                         self.runPlugin(plugin)
                         return
                     twinPlugins.append(plugin.name)
         elif selected[0] == "MenuPlugin":
             for plugin in plugins.getPluginsForMenu(selected[1]):
                 if plugin[2] == selected[2]:
                     self.runPlugin(plugin[1])
                     return
         elif selected[0] == "Infobar":
             if hasattr(self, selected[1]):
                 exec "self." + ".".join(selected[1:]) + "()"
             else:
                 return 0
         elif selected[0] == "Module":
             try:
                 exec "from " + selected[1] + " import *"
                 exec "self.session.open(" + ",".join(selected[2:]) + ")"
             except Exception as e:
                 print "[ButtonSetup] error during executing module %s, screen %s, %s" % (
                     selected[1], selected[2], e)
                 import traceback
                 traceback.print_exc()
         elif selected[0] == "Setup":
             exec "from Screens.Setup import *"
             exec "self.session.open(Setup, \"" + selected[1] + "\")"
         elif selected[0].startswith("Zap"):
             if selected[0] == "ZapPanic":
                 self.servicelist.history = []
                 self.pipShown() and self.showPiP()
             self.servicelist.servicelist.setCurrent(
                 eServiceReference("/".join(selected[1:])))
             self.servicelist.zap(enable_pipzap=True)
             if hasattr(self, "lastservice"):
                 self.lastservice = eServiceReference("/".join(
                     selected[1:]))
                 self.close()
             else:
                 self.show()
             from Screens.MovieSelection import defaultMoviePath
             moviepath = defaultMoviePath()
             if moviepath:
                 config.movielist.last_videodir.value = moviepath
         elif selected[0] == "Menu":
             from Screens.Menu import MainMenu, mdom
             root = mdom.getroot()
             for x in root.findall("menu"):
                 y = x.find("id")
                 if y is not None:
                     id = y.get("val")
                     if id and id == selected[1]:
                         menu_screen = self.session.open(MainMenu, x)
                         break
Ejemplo n.º 50
0
    def fillList(self, arg=None):
        streams = []
        conflist = []
        selectedidx = 0

        # self["key_blue"].setBoolean(False)

        subtitlelist = self.getSubtitleList()
        self.nummplugin = None

        #### modify this section for add audio functions
        if self.settings.menupage.getValue() == PAGE_AUDIO:
            self.setTitle(_("Select audio track"))
            self["key_yellow"].setBoolean(True)
            self["key_green"].setBoolean(True)
            self["key_red"].setBoolean(True)
            service = self.session.nav.getCurrentService()
            self.audioTracks = audio = service and service.audioTracks()
            n = audio and audio.getNumberOfTracks() or 0
            if SystemInfo["CanDownmixAC3"]:
                self.settings.downmix_ac3 = ConfigOnOff(
                    default=config.av.downmix_ac3.getValue())
                self.settings.downmix_ac3.addNotifier(self.changeAC3Downmix,
                                                      initial_call=False)
                conflist.append(
                    getConfigListEntry(_("AC3 downmix"),
                                       self.settings.downmix_ac3))

            if SystemInfo["CanDownmixAAC"]:
                self.settings.downmix_aac = ConfigOnOff(
                    default=config.av.downmix_aac.getValue())
                self.settings.downmix_aac.addNotifier(self.changeAACDownmix,
                                                      initial_call=False)
                conflist.append(
                    getConfigListEntry(_("AAC downmix"),
                                       self.settings.downmix_aac))

            if SystemInfo["Can3DSurround"]:
                surround_choicelist = [("none", _("off")), ("hdmi", _("HDMI")),
                                       ("spdif", _("SPDIF")),
                                       ("dac", _("DAC"))]
                self.settings.surround_3d = ConfigSelection(
                    choices=surround_choicelist,
                    default=config.av.surround_3d.getValue())
                self.settings.surround_3d.addNotifier(self.change3DSurround,
                                                      initial_call=False)
                conflist.append(
                    getConfigListEntry(_("3D Surround"),
                                       self.settings.surround_3d))

            if SystemInfo["CanPcmMultichannel"]:
                self.settings.pcm_multichannel = ConfigOnOff(
                    default=config.av.pcm_multichannel.getValue())
                self.settings.pcm_multichannel.addNotifier(
                    self.changePCMMultichannel, initial_call=False)
                conflist.append(
                    getConfigListEntry(_("PCM Multichannel"),
                                       self.settings.pcm_multichannel, None))

            if SystemInfo["Canedidchecking"]:
                edid_bypass_choicelist = [("00000001", _("on")),
                                          ("00000000", _("off"))]
                self.settings.edid_bypass = ConfigSelection(
                    choices=edid_bypass_choicelist,
                    default=config.av.bypass_edid_checking.getValue())
                self.settings.edid_bypass.addNotifier(self.changeEDIDBypass,
                                                      initial_call=False)
                conflist.append(
                    getConfigListEntry(_("Bypass HDMI EDID Check"),
                                       self.settings.edid_bypass))

            if n > 0:
                self.audioChannel = service.audioChannel()
                if self.audioChannel:
                    choicelist = [("0", _("left")), ("1", _("stereo")),
                                  ("2", _("right"))]
                    self.settings.channelmode = ConfigSelection(
                        choices=choicelist,
                        default=str(self.audioChannel.getCurrentChannel()))
                    self.settings.channelmode.addNotifier(self.changeMode,
                                                          initial_call=False)
                    conflist.append(
                        getConfigListEntry(_("Channel"),
                                           self.settings.channelmode))
                else:
                    conflist.append(getConfigListEntry("", ConfigNothing()))
                    # self["key_green"].setBoolean(False)
                selectedAudio = self.audioTracks.getCurrentTrack()
                conta = 0

                for x in range(n):

                    number = str(conta + 1)
                    i = audio.getTrackInfo(x)

                    languages = i.getLanguage().split('/')
                    description = i.getDescription() or ""
                    pondebug("AUDIO " + str(conta) + " - " + str(languages) +
                             " - " + str(description))
                    selected = ""
                    language = ""

                    if selectedAudio == x:
                        selected = "X"
                        selectedidx = x

                    cnt = 0
                    for lang in languages:
                        if cnt:
                            language += ' / '
                        if lang.lower() == "und":
                            language += _("Language") + " " + number + ""
                        elif lang.lower() == "qaa":
                            language += _("Original track audio") + ""
                        elif LanguageCodes.has_key(lang):
                            templan = str(LanguageCodes[lang][0])
                            if templan == None or templan == "":
                                language += _(
                                    "Language") + " " + number + " (" + str(
                                        lang) + ")"
                            else:
                                language += _(templan)
                        else:

                            if lang == None or lang == "":
                                language += _(
                                    "Language") + " [" + number + "] " + str(
                                        lang) + ""
                            else:
                                language += _(
                                    "Language") + " [" + number + "] " + str(
                                        lang) + ""

                        cnt += 1
                    if language != "---":
                        try:
                            streams.append((x, "", number, language,
                                            description, selected))
                            conta += 1
                        except:
                            pass

            else:
                streams = []
                conflist.append(getConfigListEntry("", ConfigNothing()))
                # self["key_green"].setBoolean(False)

            #add by mpiero
            try:
                self["key_info"].setText(_("To subtitle selection"))
            except:
                pass

            if subtitlelist:
                # self["key_yellow"].setBoolean(True)
                # conflist.append(getConfigListEntry(_("To subtitle selection"), self.settings.menupage))
                pass
            else:
                # self["key_yellow"].setBoolean(False)
                conflist.append(getConfigListEntry("", ConfigNothing()))

            from Components.PluginComponent import plugins
            from Plugins.Plugin import PluginDescriptor

            if hasattr(self.infobar, "runPlugin"):

                class PluginCaller:
                    def __init__(self, fnc, *args):
                        self.fnc = fnc
                        self.args = args

                    def __call__(self, *args, **kwargs):
                        self.fnc(*self.args)

                Plugins = [(p.name, PluginCaller(self.infobar.runPlugin, p))
                           for p in plugins.getPlugins(
                               where=PluginDescriptor.WHERE_AUDIOMENU)]

                if len(Plugins):
                    #add by mpiero
                    # self["key_blue"].setBoolean(True)
                    conflist.append(
                        getConfigListEntry(Plugins[0][0], ConfigNothing()))
                    self.plugincallfunc = Plugins[0][1]
                    self.nummplugin = len(conflist) - 1

                if len(Plugins) > 1:
                    print "plugin(s) installed but not displayed in the dialog box:", Plugins[
                        1:]

        #### modify this section for add subtitle functions
        elif self.settings.menupage.getValue() == PAGE_SUBTITLES:

            self.setTitle(_("Subtitle selection"))
            # conflist.append(getConfigListEntry("----", ConfigNothing()))
            # conflist.append(getConfigListEntry("----", ConfigNothing()))
            self["key_yellow"].setBoolean(False)
            self["key_green"].setBoolean(False)
            self["key_red"].setBoolean(False)
            selected = "X"
            for x in subtitlelist:
                if self.selectedSubtitle and x[:4] == self.selectedSubtitle[:4]:
                    selected = ""

            streams.append(("Ninguno", "", "1", "(" + _("Deactivate") + ")",
                            "" + _("No subtitles"), selected))
            idx = 1
            selectedidx = 0
            for x in subtitlelist:
                pondebug("SUBTITLES " + str(idx) + " - " + str(x))
                number = str(x[1])
                description = "?"
                language = ""
                selected = ""

                if self.selectedSubtitle and x[:4] == self.selectedSubtitle[:4]:
                    selected = "X"
                    selectedidx = idx

                try:
                    if x[4].lower() == "und":
                        language += _("Language") + " " + str(idx + 1) + ""
                    elif x[4].lower() == "qaa":
                        language += _("Original track audio") + ""
                    elif LanguageCodes.has_key(x[4]):
                        language = _(LanguageCodes[x[4]][0])
                    else:
                        language = _("Language") + " " + str(idx +
                                                             1) + " (" + str(
                                                                 x[4]) + ")"
                except:
                    language = ""

                if x[0] == 0:
                    description = _("Digital Subtitle") + "(DVB)"
                    number = "%x" % (x[1])

                elif x[0] == 1:
                    description = _("Teletext Subtitle") + "(TXT)"
                    number = "%x%02x" % (x[3] and x[3] or 8, x[2])

                elif x[0] == 2:
                    types = (_("unknown"), "embedded", _("File") + " " + "SSA",
                             _("File") + " " + "ASS", _("File") + " " + "SRT",
                             _("File") + " " + "VOB", _("File") + " " + "PGS")
                    try:
                        description = types[x[2]]
                    except:
                        description = _("unknown") + ": %s" % x[2]
                    number = str(int(number) + 1)
                if language == None or language == "":
                    pass
                else:
                    streams.append(
                        (x, "", str(idx + 1), language, description, selected))
                    idx += 1

            # conflist.append(getConfigListEntry(_("To audio selection"), self.settings.menupage))
            try:
                self["key_info"].setText(_("To audio selection"))
            except:
                pass
            if self.infobar.selected_subtitle and self.infobar.selected_subtitle != (
                    0, 0, 0, 0) and not ".DVDPlayer'>" in ` self.infobar `:
                self["key_red"].setBoolean(True)
                conflist.append(
                    getConfigListEntry(_("Subtitle Quickmenu"),
                                       ConfigNothing()))
            # else:
            # conflist.append(getConfigListEntry("----", ConfigNothing()))

        self["config"].list = conflist
        self["config"].l.setList(conflist)

        self["streams"].list = streams
        self["streams"].setIndex(selectedidx)
Ejemplo n.º 51
0
	def okpress(self):
		#// Menu Selection

		global INFOCONF
#		menu = self['list'].l.getCurrentSelection()[0][2]
                current = self['list'].getCurrent()
                if current:
                        name = current[0]
                        menu = current[1]
		if menu == "BackupFlashManager":
			self.BackupFlashManager()
		elif menu == "BackupImage":
			self.session.open(ImageBackup)
		elif menu == "FlashImage":
			self.session.open(FlashOnline)
		elif menu == "BackupSettings":
			self.session.openWithCallback(self.backupDone,BackupScreen, runBackup = True)
		elif menu == "RestoreSettings":
			self.backuppath = getBackupPath()
			self.backupfile = getBackupFilename()
			self.fullbackupfilename = self.backuppath + "/" + self.backupfile
			if os_path.exists(self.fullbackupfilename):
				self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore your STB backup?\nSTB will restart after the restore"), default = False)
			else:
				self.session.open(MessageBox, _("Sorry no backups found!"), MessageBox.TYPE_INFO, timeout = 10)
		elif menu == "BackupFiles":
			self.session.openWithCallback(self.backupfiles_choosen,BackupSelection)
		elif menu == "BackupLocation":
					parts = [ (r.description, r.mountpoint, self.session) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)]
					for x in parts:
						if not access(x[1], F_OK|R_OK|W_OK) or x[1] == '/':
							parts.remove(x)
					if len(parts):
						self.session.openWithCallback(self.backuplocation_choosen, ChoiceBox, title = _("Please select medium to use as backup location"), list = parts)
								
		elif menu == "CamSetup":
			self.session.open(Sc.ScNewSelection)
		elif menu == "AdvancedRestore":
		        self.session.open(RestoreMenu, self.skin)	
                elif menu == "SkinSetup":
			self.session.open(SkinSetup)
		elif menu == "ImageTools":
			self.Plugins()
		elif menu == "Pluginbrowser":
			self.session.open(PluginBrowser)
		elif menu == "Infos":
			self.Infos()
		elif menu == "InfoPanel":
			self.session.open(Info, "InfoPanel")
		elif menu == "Info":
			self.session.open(Info, "Sytem_info")
		elif menu == "Default":
			self.session.open(Info, "Default")
		elif menu == "FreeSpace":
			self.session.open(Info, "FreeSpace")
		elif menu == "Network":
			self.session.open(Info, "Network")
		elif menu == "Mounts":
			self.session.open(Info, "Mounts")
		elif menu == "Kernel":
			self.session.open(Info, "Kernel")
		elif menu == "Ram":
			self.session.open(Info, "Free")
		elif menu == "Cpu":
			self.session.open(Info, "Cpu")
		elif menu == "Top":
			self.session.open(Info, "Top")
		elif menu == "MemInfo":
			self.session.open(Info, "MemInfo")
		elif menu == "Module":
			self.session.open(Info, "Module")
		elif menu == "Mtd":
			self.session.open(Info, "Mtd")
		elif menu == "Partitions":
			self.session.open(Info, "Partitions")
		elif menu == "Swap":
			self.session.open(Info, "Swap")
		elif menu == "System_Info":
			self.System()
		elif menu == "CronManager":
			self.session.open(CronManager)	
		elif menu == "JobManager":
			self.session.open(ScriptRunner)
		elif menu == "SoftcamPanel":
			self.session.open(SoftcamPanel)
		elif menu == "SoftwareManager":
			self.Software_Manager()
		elif menu == "ImageUpdate":
			self.session.open(SoftwarePanel)
		elif menu == "MultiQuickButton":
			sz_w = getDesktop(0).size().width()
			from Components.PluginComponent import plugins
			plugin = _('MultiQuickbutton')
			for p in plugins.getPlugins(where=[PluginDescriptor.WHERE_PLUGINMENU]):
				if 'MultiQuickbutton' == str(p.name):
					plugin = p
			if plugin is not None and sz_w == 1280:
				plugin(session=self.session)
			else:
				self.session.open(MessageBox, _('Sorry:\nET-MultiQuickButton supports only HD skins with 1280x720px'), MessageBox.TYPE_INFO, timeout=10)
		elif menu == "PacketManager":
			self.session.open(PacketManager, self.skin)
		elif menu == "DVB-NTP-Time":
			from Plugins.Extensions.ExtrasPanel.XTDVBNTPTime import *
                        self.session.open(XTDVBNTPTime)
		elif menu == 'IPK-installManager':	
			self.session.open(AddonsFileBrowser)
		elif menu == 'IPK-uninstaller':	
			self.session.open(Ipkuninstall)	
		elif menu == "MountManager":
			self.session.open(DevicesMountPanel)
		elif menu == "SundtekControlCenter":
			self.session.open(SundtekControlCenter)
		elif menu == "SwapManager":
			self.session.open(Swap)
		elif menu == "RedPanel":
			self.session.open(RedPanel)
		elif menu == "Yellow-Key-Action":
			self.session.open(YellowPanel)
		elif menu == "Softcam-Panel Setup":
			self.session.open(ShowSoftcamPanelExtensions)
		elif menu == "KeymapSel":
			self.session.open(KeymapSel)
		else:
			pass
Ejemplo n.º 52
0
    def fillList(self, arg=None):
        streams = []
        conflist = []
        selectedidx = 0

        self["key_blue"].setBoolean(False)

        subtitlelist = self.getSubtitleList()

        if self.settings.menupage.getValue() == PAGE_AUDIO:
            self.setTitle(_("Select audio track"))
            service = self.session.nav.getCurrentService()
            self.audioTracks = audio = service and service.audioTracks()
            n = audio and audio.getNumberOfTracks() or 0
            if SystemInfo["CanDownmixAC3"]:
                self.settings.downmix = ConfigOnOff(
                    default=config.av.downmix_ac3.value)
                self.settings.downmix.addNotifier(self.changeAC3Downmix,
                                                  initial_call=False)
                conflist.append(
                    getConfigListEntry(_("Multi channel downmix"),
                                       self.settings.downmix))
                self["key_red"].setBoolean(True)

            if n > 0:
                self.audioChannel = service.audioChannel()
                if self.audioChannel:
                    choicelist = [("0", _("left")), ("1", _("stereo")),
                                  ("2", _("right"))]
                    self.settings.channelmode = ConfigSelection(
                        choices=choicelist,
                        default=str(self.audioChannel.getCurrentChannel()))
                    self.settings.channelmode.addNotifier(self.changeMode,
                                                          initial_call=False)
                    conflist.append(
                        getConfigListEntry(_("Channel"),
                                           self.settings.channelmode))
                    self["key_green"].setBoolean(True)
                else:
                    conflist.append(('', ))
                    self["key_green"].setBoolean(False)
                selectedAudio = self.audioTracks.getCurrentTrack()
                for x in range(n):
                    number = str(x + 1)
                    i = audio.getTrackInfo(x)
                    languages = i.getLanguage().split('/')
                    description = i.getDescription() or ""
                    selected = ""
                    language = ""

                    if selectedAudio == x:
                        selected = "X"
                        selectedidx = x

                    cnt = 0
                    for lang in languages:
                        if cnt:
                            language += ' / '
                        if LanguageCodes.has_key(lang):
                            language += _(LanguageCodes[lang][0])
                        elif lang == "und":
                            ""
                        else:
                            language += lang
                        cnt += 1

                    streams.append(
                        (x, "", number, description, language, selected))

            else:
                streams = []
                conflist.append(('', ))
                self["key_green"].setBoolean(False)

            if subtitlelist:
                self["key_yellow"].setBoolean(True)
                conflist.append(
                    getConfigListEntry(_("To subtitle selection"),
                                       self.settings.menupage))
            else:
                self["key_yellow"].setBoolean(False)
                conflist.append(('', ))

            from Components.PluginComponent import plugins
            from Plugins.Plugin import PluginDescriptor

            if hasattr(self.infobar, "runPlugin"):

                class PluginCaller:
                    def __init__(self, fnc, *args):
                        self.fnc = fnc
                        self.args = args

                    def __call__(self, *args, **kwargs):
                        self.fnc(*self.args)

                self.Plugins = [(p.name, PluginCaller(self.infobar.runPlugin,
                                                      p))
                                for p in plugins.getPlugins(
                                    where=PluginDescriptor.WHERE_AUDIOMENU)]

                if self.Plugins:
                    self["key_blue"].setBoolean(True)
                    if len(self.Plugins) > 1:
                        conflist.append(
                            getConfigListEntry(_("Audio plugins"),
                                               ConfigNothing()))
                        self.plugincallfunc = [(x[0], x[1])
                                               for x in self.Plugins]
                    else:
                        conflist.append(
                            getConfigListEntry(self.Plugins[0][0],
                                               ConfigNothing()))
                        self.plugincallfunc = self.Plugins[0][1]

        elif self.settings.menupage.getValue() == PAGE_SUBTITLES:

            self.setTitle(_("Subtitle selection"))
            conflist.append(('', ))
            conflist.append(('', ))
            self["key_red"].setBoolean(False)
            self["key_green"].setBoolean(False)

            idx = 0

            for x in subtitlelist:
                number = str(x[1])
                description = "?"
                language = ""
                selected = ""

                if self.selectedSubtitle and x[:4] == self.selectedSubtitle[:4]:
                    selected = "X"
                    selectedidx = idx

                try:
                    if x[4] != "und":
                        if LanguageCodes.has_key(x[4]):
                            language = _(LanguageCodes[x[4]][0])
                        else:
                            language = x[4]
                except:
                    language = ""

                if x[0] == 0:
                    description = "DVB"
                    number = "%x" % (x[1])

                elif x[0] == 1:
                    description = "teletext"
                    number = "%x%02x" % (x[3] and x[3] or 8, x[2])

                elif x[0] == 2:
                    types = (_("unknown"), _("embedded"), _("SSA file"),
                             _("ASS file"), _("SRT file"), _("VOB file"),
                             _("PGS file"))
                    try:
                        description = types[x[2]]
                    except:
                        description = _("unknown") + ": %s" % x[2]
                    number = str(int(number) + 1)

                streams.append(
                    (x, "", number, description, language, selected))
                idx += 1

            conflist.append(
                getConfigListEntry(_("To audio selection"),
                                   self.settings.menupage))

            if self.infobar.selected_subtitle and self.infobar.selected_subtitle != (
                    0, 0, 0, 0) and not ".DVDPlayer'>" in ` self.infobar `:
                self["key_blue"].setBoolean(True)
                conflist.append(
                    getConfigListEntry(_("Subtitle Quickmenu"),
                                       ConfigNothing()))

        self["config"].list = conflist
        self["config"].l.setList(conflist)

        self["streams"].list = streams
        self["streams"].setIndex(selectedidx)
Ejemplo n.º 53
0
def runScreenTest():
	config.misc.startCounter.value += 1
	config.misc.startCounter.save()

	profile("readPluginList")
	plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))

	profile("Init:Session")
	nav = Navigation(config.misc.isNextRecordTimerAfterEventActionAuto.value, config.misc.isNextPowerTimerAfterEventActionAuto.value)
	session = Session(desktop = enigma.getDesktop(0), summary_desktop = enigma.getDesktop(1), navigation = nav)

	CiHandler.setSession(session)

	screensToRun = [ p.__call__ for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD) ]

	profile("wizards")
	screensToRun += wizardManager.getWizards()
	screensToRun.append((100, InfoBar.InfoBar))
	screensToRun.sort()

	enigma.ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey)

	def runNextScreen(session, screensToRun, *result):
		if result:
			enigma.quitMainloop(*result)
			return

		screen = screensToRun[0][1]
		args = screensToRun[0][2:]
		if screensToRun:
			session.openWithCallback(boundFunction(runNextScreen, session, screensToRun[1:]), screen, *args)
		else:
			session.open(screen, *args)

	runNextScreen(session, screensToRun)

	profile("Init:VolumeControl")
	vol = VolumeControl(session)
	profile("Init:PowerKey")
	power = PowerKey(session)

	# we need session.scart to access it from within menu.xml
	session.scart = AutoScartControl(session)

	profile("Init:Trashcan")
	import Tools.Trashcan
	Tools.Trashcan.init(session)

	profile("Init:AutoVideoMode")
	import Screens.VideoMode
	Screens.VideoMode.autostart(session)

	profile("RunReactor")
	profile_final()
	runReactor()

	profile("wakeup")

	#get currentTime
	nowTime = time()
	wakeupList = [
		x for x in ((session.nav.RecordTimer.getNextRecordingTime(), 0, session.nav.RecordTimer.isNextRecordAfterEventActionAuto()),
					(session.nav.RecordTimer.getNextZapTime(), 1),
					(plugins.getNextWakeupTime(), 2),
					(session.nav.PowerTimer.getNextPowerManagerTime(), 3, session.nav.PowerTimer.isNextPowerManagerAfterEventActionAuto()))
		if x[0] != -1
	]
	wakeupList.sort()
	recordTimerWakeupAuto = False
	if wakeupList and wakeupList[0][1] != 3:
		startTime = wakeupList[0]
		if (startTime[0] - nowTime) < 270: # no time to switch box back on
			wptime = nowTime + 30  # so switch back on in 30 seconds
		else:
			if getBrandOEM() == 'gigablue':
				wptime = startTime[0] - 120 # Gigaboxes already starts 2 min. before wakeup time
			else:
				wptime = startTime[0] - 240
		if not config.misc.SyncTimeUsing.value == "0" or getBrandOEM() == 'gigablue':
			print "dvb time sync disabled... so set RTC now to current linux time!", strftime("%Y/%m/%d %H:%M", localtime(nowTime))
			setRTCtime(nowTime)
		print "set wakeup time to", strftime("%Y/%m/%d %H:%M", localtime(wptime))
		setFPWakeuptime(wptime)
		recordTimerWakeupAuto = startTime[1] == 0 and startTime[2]
		print 'recordTimerWakeupAuto',recordTimerWakeupAuto
	config.misc.isNextRecordTimerAfterEventActionAuto.value = recordTimerWakeupAuto
	config.misc.isNextRecordTimerAfterEventActionAuto.save()


	PowerTimerWakeupAuto = False
	if wakeupList and wakeupList[0][1] == 3:
		startTime = wakeupList[0]
		if (startTime[0] - nowTime) < 60: # no time to switch box back on
			wptime = nowTime + 30  # so switch back on in 30 seconds
		else:
			if getBrandOEM() == 'gigablue':
				wptime = startTime[0] + 120 # Gigaboxes already starts 2 min. before wakeup time
			else:
				wptime = startTime[0]
		if not config.misc.SyncTimeUsing.value == "0" or getBrandOEM() == 'gigablue':
			print "dvb time sync disabled... so set RTC now to current linux time!", strftime("%Y/%m/%d %H:%M", localtime(nowTime))
			setRTCtime(nowTime)
		print "set wakeup time to", strftime("%Y/%m/%d %H:%M", localtime(wptime+60))
		setFPWakeuptime(wptime)
		PowerTimerWakeupAuto = startTime[1] == 3 and startTime[2]
		print 'PowerTimerWakeupAuto',PowerTimerWakeupAuto
	config.misc.isNextPowerTimerAfterEventActionAuto.value = PowerTimerWakeupAuto
	config.misc.isNextPowerTimerAfterEventActionAuto.save()

	profile("stopService")
	session.nav.stopService()
	profile("nav shutdown")
	session.nav.shutdown()

	profile("configfile.save")
	configfile.save()
	from Screens import InfoBarGenerics
	InfoBarGenerics.saveResumePoints()

	return 0
Ejemplo n.º 54
0
 def updateList(self):
     self.pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU)
     self.list = [
         PluginEntryComponent(plugin) for plugin in self.pluginlist
     ]
     self["pluginlist"].setList(self.list)
Ejemplo n.º 55
0
def runScreenTest():
    config.misc.startCounter.value += 1
    config.misc.startCounter.save()

    profile("readPluginList")
    plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))

    profile("Init:Session")
    nav = Navigation()
    session = Session(desktop=enigma.getDesktop(0),
                      summary_desktop=enigma.getDesktop(1),
                      navigation=nav)

    CiHandler.setSession(session)

    profile("wizards")
    screensToRun = []
    RestoreSettings = None
    if os.path.exists("/media/hdd/images/config/settings"
                      ) and config.misc.firstrun.value:
        if autorestoreLoop():
            RestoreSettings = True
            from Plugins.SystemPlugins.SoftwareManager.BackupRestore import RestoreScreen
            session.open(RestoreScreen, runRestore=True)
        else:
            screensToRun = [
                p.__call__
                for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD)
            ]
            screensToRun += wizardManager.getWizards()
    else:
        if os.path.exists("/media/hdd/images/config/autorestore"):
            os.system('rm -f /media/hdd/images/config/autorestore')
        screensToRun = [
            p.__call__
            for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD)
        ]
        screensToRun += wizardManager.getWizards()

    screensToRun.append((100, InfoBar.InfoBar))

    screensToRun.sort()

    enigma.ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey)

    #	eDVBCIInterfaces.getInstance().setDescrambleRules(0 # Slot Number
    #		,(	["1:0:1:24:4:85:C00000:0:0:0:"], #service_list
    #			["PREMIERE"], #provider_list,
    #			[] #caid_list
    #		));

    def runNextScreen(session, screensToRun, *result):
        if result:
            enigma.quitMainloop(*result)
            return

        screen = screensToRun[0][1]
        args = screensToRun[0][2:]

        if screensToRun:
            session.openWithCallback(
                boundFunction(runNextScreen, session, screensToRun[1:]),
                screen, *args)
        else:
            session.open(screen, *args)

    config.misc.epgcache_filename.addNotifier(setEPGCachePath)

    if not RestoreSettings:
        runNextScreen(session, screensToRun)

    profile("Init:VolumeControl")
    vol = VolumeControl(session)
    profile("Init:PowerKey")
    power = PowerKey(session)

    # we need session.scart to access it from within menu.xml
    session.scart = AutoScartControl(session)

    profile("Init:Trashcan")
    import Tools.Trashcan
    Tools.Trashcan.init(session)

    profile("RunReactor")
    profile_final()
    runReactor()

    profile("wakeup")
    from time import time, strftime, localtime
    from Tools.StbHardware import setFPWakeuptime, getFPWakeuptime, setRTCtime
    from Screens.SleepTimerEdit import isNextWakeupTime
    #get currentTime
    nowTime = time()
    wakeupList = [
        x for x in ((session.nav.RecordTimer.getNextRecordingTime(), 0),
                    (session.nav.RecordTimer.getNextZapTime(isWakeup=True), 1),
                    (plugins.getNextWakeupTime(), 2), (isNextWakeupTime(), 3))
        if x[0] != -1
    ]
    wakeupList.sort()
    if wakeupList:
        from time import strftime
        startTime = wakeupList[0]
        if (startTime[0] - nowTime) < 270:  # no time to switch box back on
            wptime = nowTime + 30  # so switch back on in 30 seconds
        else:
            wptime = startTime[0] - 240
        if not config.misc.useTransponderTime.value:
            print "dvb time sync disabled... so set RTC now to current linux time!", strftime(
                "%Y/%m/%d %H:%M", localtime(nowTime))
            setRTCtime(nowTime)
        print "set wakeup time to", strftime("%Y/%m/%d %H:%M",
                                             localtime(wptime))
        setFPWakeuptime(wptime)
        config.misc.prev_wakeup_time.value = int(startTime[0])
        config.misc.prev_wakeup_time_type.value = startTime[1]
        config.misc.prev_wakeup_time_type.save()
    else:
        config.misc.prev_wakeup_time.value = 0
    config.misc.prev_wakeup_time.save()

    profile("stopService")
    session.nav.stopService()
    profile("nav shutdown")
    session.nav.shutdown()

    profile("configfile.save")
    configfile.save()
    from Screens import InfoBarGenerics
    InfoBarGenerics.saveResumePoints()

    return 0
Ejemplo n.º 56
0
def getHotkeyFunctions():
    hotkeyFunctions = []
    twinPlugins = []
    twinPaths = {}
    pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO)
    pluginlist.sort(key=lambda p: p.name)
    for plugin in pluginlist:
        if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames:
            if twinPaths.has_key(plugin.path[24:]):
                twinPaths[plugin.path[24:]] += 1
            else:
                twinPaths[plugin.path[24:]] = 1
            hotkeyFunctions.append((plugin.name, plugin.path[24:] + "/" +
                                    str(twinPaths[plugin.path[24:]]), "EPG"))
            twinPlugins.append(plugin.name)
    pluginlist = plugins.getPlugins([
        PluginDescriptor.WHERE_PLUGINMENU,
        PluginDescriptor.WHERE_EXTENSIONSMENU
    ])
    pluginlist.sort(key=lambda p: p.name)
    for plugin in pluginlist:
        if plugin.name not in twinPlugins and plugin.path:
            if twinPaths.has_key(plugin.path[24:]):
                twinPaths[plugin.path[24:]] += 1
            else:
                twinPaths[plugin.path[24:]] = 1
            hotkeyFunctions.append(
                (plugin.name,
                 plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]),
                 "Plugins"))
            twinPlugins.append(plugin.name)
    hotkeyFunctions.append((_("Main menu"), "Infobar/mainMenu", "InfoBar"))
    hotkeyFunctions.append((_("Show help"), "Infobar/showHelp", "InfoBar"))
    hotkeyFunctions.append((_("Show extension selection"),
                            "Infobar/showExtensionSelection", "InfoBar"))
    hotkeyFunctions.append((_("Zap down"), "Infobar/zapDown", "InfoBar"))
    hotkeyFunctions.append((_("Zap up"), "Infobar/zapUp", "InfoBar"))
    hotkeyFunctions.append(
        (_("Switch channel up"), "Infobar/switchChannelUp", "InfoBar"))
    hotkeyFunctions.append(
        (_("Switch channel down"), "Infobar/switchChannelDown", "InfoBar"))
    hotkeyFunctions.append(
        (_("Show service list"), "Infobar/openServiceList", "InfoBar"))
    hotkeyFunctions.append((_("Show movies"), "Infobar/showMovies", "InfoBar"))
    hotkeyFunctions.append((_("Show servicelist or movies"),
                            "Infobar/showServiceListOrMovies", "InfoBar"))
    hotkeyFunctions.append(
        (_("Show favourites list"), "Infobar/openFavouritesList", "InfoBar"))
    hotkeyFunctions.append(
        (_("History back"), "Infobar/historyBack", "InfoBar"))
    hotkeyFunctions.append(
        (_("History next"), "Infobar/historyNext", "InfoBar"))
    hotkeyFunctions.append(
        (_("Recall to previous service"),
         "Infobar/servicelist/recallPrevService", "InfoBar"))
    hotkeyFunctions.append(
        (_("Show eventinfo plugins"), "Infobar/showEventInfoPlugins", "EPG"))
    hotkeyFunctions.append(
        (_("Show event details"), "Infobar/openEventView", "EPG"))
    hotkeyFunctions.append(
        (_("Show single service EPG"), "Infobar/openSingleServiceEPG", "EPG"))
    hotkeyFunctions.append(
        (_("Show multi channel EPG"), "Infobar/openMultiServiceEPG", "EPG"))
    hotkeyFunctions.append(
        (_("Show Audioselection"), "Infobar/audioSelection", "InfoBar"))
    hotkeyFunctions.append(
        (_("Switch to radio mode"), "Infobar/showRadio", "InfoBar"))
    hotkeyFunctions.append(
        (_("Switch to TV mode"), "Infobar/showTv", "InfoBar"))
    hotkeyFunctions.append(
        (_("Instant record"), "Infobar/instantRecord", "InfoBar"))
    hotkeyFunctions.append((_("Start instant recording"),
                            "Infobar/startInstantRecording", "InfoBar"))
    hotkeyFunctions.append((_("Activate timeshift End"),
                            "Infobar/activateTimeshiftEnd", "InfoBar"))
    hotkeyFunctions.append((_("Activate timeshift end and pause"),
                            "Infobar/activateTimeshiftEndAndPause", "InfoBar"))
    hotkeyFunctions.append(
        (_("Start timeshift"), "Infobar/startTimeshift", "InfoBar"))
    hotkeyFunctions.append(
        (_("Stop timeshift"), "Infobar/stopTimeshift", "InfoBar"))
    hotkeyFunctions.append(
        (_("Start teletext"), "Infobar/startTeletext", "InfoBar"))
    hotkeyFunctions.append((_("Show subservice selection"),
                            "Infobar/subserviceSelection", "InfoBar"))
    hotkeyFunctions.append(
        (_("Show subtitle selection"), "Infobar/subtitleSelection", "InfoBar"))
    hotkeyFunctions.append(
        (_("Show InfoBar"), "Infobar/showFirstInfoBar", "InfoBar"))
    hotkeyFunctions.append(
        (_("Show second InfoBar"), "Infobar/showSecondInfoBar", "InfoBar"))
    hotkeyFunctions.append(
        (_("Toggle infoBar"), "Infobar/toggleShow", "InfoBar"))
    hotkeyFunctions.append(
        (_("Letterbox zoom"), "Infobar/vmodeSelection", "InfoBar"))
    if SystemInfo["PIPAvailable"]:
        hotkeyFunctions.append((_("Show PIP"), "Infobar/showPiP", "InfoBar"))
        hotkeyFunctions.append((_("Swap PIP"), "Infobar/swapPiP", "InfoBar"))
        hotkeyFunctions.append((_("Move PIP"), "Infobar/movePiP", "InfoBar"))
        hotkeyFunctions.append(
            (_("Toggle PIPzap"), "Infobar/togglePipzap", "InfoBar"))
    hotkeyFunctions.append((_("Activate HbbTV (Redbutton)"),
                            "Infobar/activateRedButton", "InfoBar"))
    #hotkeyFunctions.append((_("Toggle HDMI In"), "Infobar/HDMIIn", "InfoBar"))
    if SystemInfo["LcdLiveTV"]:
        hotkeyFunctions.append(
            (_("Toggle LCD LiveTV"), "Infobar/ToggleLCDLiveTV", "InfoBar"))
    hotkeyFunctions.append(
        (_("HotKey Setup"), "Module/Screens.Hotkey/HotkeySetup", "Setup"))
    #hotkeyFunctions.append((_("Software update"), "Module/Screens.SoftwareUpdate/UpdatePlugin", "Setup"))
    #hotkeyFunctions.append((_("Latest Commits"), "Module/Screens.About/CommitInfo", "Setup"))
    hotkeyFunctions.append((_("CI (Common Interface) Setup"),
                            "Module/Screens.Ci/CiSelection", "Setup"))
    hotkeyFunctions.append(
        (_("Tuner Configuration"), "Module/Screens.Satconfig/NimSelection",
         "Scanning"))
    hotkeyFunctions.append(
        (_("Manual Scan"), "Module/Screens.ScanSetup/ScanSetup", "Scanning"))
    hotkeyFunctions.append((_("Automatic Scan"),
                            "Module/Screens.ScanSetup/ScanSimple", "Scanning"))
    for plugin in plugins.getPluginsForMenu("scan"):
        hotkeyFunctions.append(
            (plugin[0], "MenuPlugin/scan/" + plugin[2], "Scanning"))
    hotkeyFunctions.append(
        (_("Network"), "Module/Screens.NetworkSetup/NetworkAdapterSelection",
         "Setup"))
    hotkeyFunctions.append(
        (_("Plugin Browser"), "Module/Screens.PluginBrowser/PluginBrowser",
         "Setup"))
    hotkeyFunctions.append(
        (_("Sleeptimer edit"), "Module/Screens.SleepTimerEdit/SleepTimerEdit",
         "Setup"))
    hotkeyFunctions.append(
        (_("Channel Info"), "Module/Screens.ServiceInfo/ServiceInfo", "Setup"))
    hotkeyFunctions.append(
        (_("Timer"), "Module/Screens.TimerEdit/TimerEditList", "Setup"))
    for plugin in plugins.getPluginsForMenu("system"):
        if plugin[2]:
            hotkeyFunctions.append(
                (plugin[0], "MenuPlugin/system/" + plugin[2], "Setup"))
    hotkeyFunctions.append(
        (_("Standby"), "Module/Screens.Standby/Standby", "Power"))
    hotkeyFunctions.append(
        (_("Restart"), "Module/Screens.Standby/TryQuitMainloop/2", "Power"))
    hotkeyFunctions.append(
        (_("Restart enigma"), "Module/Screens.Standby/TryQuitMainloop/3",
         "Power"))
    hotkeyFunctions.append(
        (_("Deep standby"), "Module/Screens.Standby/TryQuitMainloop/1",
         "Power"))
    hotkeyFunctions.append((_("Usage Setup"), "Setup/usage", "Setup"))
    hotkeyFunctions.append(
        (_("User interface"), "Setup/userinterface", "Setup"))
    hotkeyFunctions.append((_("Recording Setup"), "Setup/recording", "Setup"))
    hotkeyFunctions.append((_("Harddisk Setup"), "Setup/harddisk", "Setup"))
    hotkeyFunctions.append(
        (_("Subtitles Settings"), "Setup/subtitlesetup", "Setup"))
    hotkeyFunctions.append(
        (_("Language"), "Module/Screens.LanguageSelection/LanguageSelection",
         "Setup"))
    hotkeyFunctions.append(
        (_("Skin setup"), "Module/Screens.SkinSelector/SkinSelector", "Setup"))
    hotkeyFunctions.append(
        (_("Memory Info"), "Module/Screens.About/MemoryInfo", "Setup"))
    if os.path.isdir("/etc/ppanels"):
        for x in [x for x in os.listdir("/etc/ppanels") if x.endswith(".xml")]:
            x = x[:-4]
            hotkeyFunctions.append(
                (_("PPanel") + " " + x, "PPanel/" + x, "PPanels"))
    if os.path.isdir("/usr/script"):
        for x in [x for x in os.listdir("/usr/script") if x.endswith(".sh")]:
            x = x[:-3]
            hotkeyFunctions.append((_("Shellscript") + " " + x,
                                    "Shellscript/" + x, "Shellscripts"))
    return hotkeyFunctions
Ejemplo n.º 57
0
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
Ejemplo n.º 58
0
    def fillList(self, arg=None):
        streams = []
        conflist = []
        selectedidx = 0

        self["key_red"].setBoolean(False)
        self["key_green"].setBoolean(False)
        self["key_yellow"].setBoolean(False)
        self["key_blue"].setBoolean(False)

        service = self.session.nav.getCurrentService()
        self.audioTracks = audio = service and service.audioTracks()
        n = audio and audio.getNumberOfTracks() or 0

        subtitlelist = self.getSubtitleList()

        if self.settings.menupage.value == PAGE_AUDIO:
            self.setTitle(_("Select audio track"))
            service = self.session.nav.getCurrentService()
            self.audioTracks = audio = service and service.audioTracks()
            n = audio and audio.getNumberOfTracks() or 0

            if SystemInfo["CanDownmixAC3"]:
                self.settings.downmix_ac3 = ConfigOnOff(
                    default=config.av.downmix_ac3.value)
                self.settings.downmix_ac3.addNotifier(self.changeAC3Downmix,
                                                      initial_call=False)
                conflist.append(
                    getConfigListEntry(_("AC3 downmix"),
                                       self.settings.downmix_ac3, None))

            if SystemInfo["CanDownmixDTS"]:
                self.settings.downmix_dts = ConfigOnOff(
                    default=config.av.downmix_dts.value)
                self.settings.downmix_dts.addNotifier(self.changeDTSDownmix,
                                                      initial_call=False)
                conflist.append(
                    getConfigListEntry(_("DTS downmix"),
                                       self.settings.downmix_dts, None))

            if SystemInfo["CanDownmixAAC"]:
                self.settings.downmix_aac = ConfigOnOff(
                    default=config.av.downmix_aac.value)
                self.settings.downmix_aac.addNotifier(self.changeAACDownmix,
                                                      initial_call=False)
                conflist.append(
                    getConfigListEntry(_("AAC downmix"),
                                       self.settings.downmix_aac, None))

            if SystemInfo["CanAACTranscode"]:
                choice_list = [("off", _("off")), ("ac3", _("AC3")),
                               ("dts", _("DTS"))]
                self.settings.transcodeaac = ConfigSelection(
                    choices=choice_list, default="off")
                self.settings.transcodeaac.addNotifier(self.setAACTranscode,
                                                       initial_call=False)
                conflist.append(
                    getConfigListEntry(_("AAC transcoding"),
                                       self.settings.transcodeaac, None))

            if SystemInfo["CanAC3plusTranscode"]:
                choice_list = [("use_hdmi_caps", _("controlled by HDMI")),
                               ("force_ac3", _("always"))]
                self.settings.transcodeac3plus = ConfigSelection(
                    choices=choice_list, default="use_hdmi_caps")
                self.settings.transcodeac3plus.addNotifier(
                    self.setAC3plusTranscode, initial_call=False)
                conflist.append(
                    getConfigListEntry(_("AC3plus transcoding"),
                                       self.settings.transcodeac3plus, None))

            if SystemInfo["CanPcmMultichannel"]:
                self.settings.pcm_multichannel = ConfigOnOff(
                    default=config.av.pcm_multichannel.value)
                self.settings.pcm_multichannel.addNotifier(
                    self.changePCMMultichannel, initial_call=False)
                conflist.append(
                    getConfigListEntry(_("PCM Multichannel"),
                                       self.settings.pcm_multichannel, None))

            if n > 0:
                self.audioChannel = service.audioChannel()
                if self.audioChannel:
                    choicelist = [("0", _("left")), ("1", _("stereo")),
                                  ("2", _("right"))]
                    self.settings.channelmode = ConfigSelection(
                        choices=choicelist,
                        default=str(self.audioChannel.getCurrentChannel()))
                    self.settings.channelmode.addNotifier(self.changeMode,
                                                          initial_call=False)
                    conflist.append(
                        getConfigListEntry(_("Audio Channel"),
                                           self.settings.channelmode, None))
                selectedAudio = self.audioTracks.getCurrentTrack()
                for x in range(n):
                    number = str(x + 1)
                    i = audio.getTrackInfo(x)
                    languages = i.getLanguage().split('/')
                    description = i.getDescription() or ""
                    selected = ""
                    language = ""

                    if selectedAudio == x:
                        selected = "X"
                        selectedidx = x

                    cnt = 0
                    for lang in languages:
                        if cnt:
                            language += ' / '
                        if LanguageCodes.has_key(lang):
                            language += _(LanguageCodes[lang][0])
                        else:
                            language += lang
                        cnt += 1

                    streams.append(
                        (x, "", number, description, language, selected))

            else:
                conflist.append(('', ))

            if SystemInfo["Can3DSurround"]:
                choice_list = [("none", _("off")), ("hdmi", _("HDMI")),
                               ("spdif", _("SPDIF")), ("dac", _("DAC"))]
                self.settings.surround_3d = ConfigSelection(
                    choices=choice_list, default=config.av.surround_3d.value)
                self.settings.surround_3d.addNotifier(self.change3DSurround,
                                                      initial_call=False)
                conflist.append(
                    getConfigListEntry(_("3D Surround"),
                                       self.settings.surround_3d, None))

            if SystemInfo[
                    "Can3DSpeaker"] and config.av.surround_3d.value != "none":
                choice_list = [("center", _("center")), ("wide", _("wide")),
                               ("extrawide", _("extra wide"))]
                self.settings.surround_3d_speaker = ConfigSelection(
                    choices=choice_list,
                    default=config.av.surround_3d_speaker.value)
                self.settings.surround_3d_speaker.addNotifier(
                    self.change3DSurroundSpeaker, initial_call=False)
                conflist.append(
                    getConfigListEntry(_("3D Surround Speaker Position"),
                                       self.settings.surround_3d_speaker,
                                       None))

            if SystemInfo["CanAutoVolume"]:
                choice_list = [("none", _("off")), ("hdmi", _("HDMI")),
                               ("spdif", _("SPDIF")), ("dac", _("DAC"))]
                self.settings.autovolume = ConfigSelection(
                    choices=choice_list, default=config.av.autovolume.value)
                self.settings.autovolume.addNotifier(self.changeAutoVolume,
                                                     initial_call=False)
                conflist.append(
                    getConfigListEntry(_("Auto Volume Level"),
                                       self.settings.autovolume, None))

            from Components.PluginComponent import plugins
            from Plugins.Plugin import PluginDescriptor

            if hasattr(self.infobar, "runPlugin"):

                class PluginCaller:
                    def __init__(self, fnc, *args):
                        self.fnc = fnc
                        self.args = args

                    def __call__(self, *args, **kwargs):
                        self.fnc(*self.args)

                Plugins = [(p.name, PluginCaller(self.infobar.runPlugin, p))
                           for p in plugins.getPlugins(
                               where=PluginDescriptor.WHERE_AUDIOMENU)]
                if len(Plugins):
                    for x in Plugins:
                        if x[0] != 'AudioEffect':  # always make AudioEffect Blue button.
                            conflist.append(
                                getConfigListEntry(x[0], ConfigNothing(),
                                                   x[1]))

        elif self.settings.menupage.value == PAGE_SUBTITLES:

            self.setTitle(_("Subtitle selection"))

            idx = 0

            for x in subtitlelist:
                number = str(x[1])
                description = "?"
                language = ""
                selected = ""

                if self.selectedSubtitle and x[:4] == self.selectedSubtitle[:4]:
                    selected = "X"
                    selectedidx = idx

                try:
                    if x[4] != "und":
                        if LanguageCodes.has_key(x[4]):
                            language = _(LanguageCodes[x[4]][0])
                        else:
                            language = x[4]
                except:
                    language = ""

                if x[0] == 0:
                    description = "DVB"
                    number = "%x" % (x[1])

                elif x[0] == 1:
                    description = "teletext"
                    number = "%x%02x" % (x[3] and x[3] or 8, x[2])

                elif x[0] == 2:
                    types = ("unknown", "embedded", "SSA file", "ASS file",
                             "SRT file", "VOB file", "PGS file")
                    try:
                        description = types[x[2]]
                    except:
                        description = _("unknown") + ": %s" % x[2]
                    number = str(int(number) + 1)

                streams.append(
                    (x, "", number, description, language, selected))
                idx += 1

            if self.infobar.selected_subtitle and self.infobar.selected_subtitle != (
                    0, 0, 0, 0) and not ".DVDPlayer'>" in ` self.infobar `:
                conflist.append(
                    getConfigListEntry(_("Subtitle Quickmenu"),
                                       ConfigNothing(), None))

        if len(conflist) > 0 and conflist[0][0]:
            self["key_red"].setBoolean(True)
        if len(conflist) > 1 and conflist[1][0]:
            self["key_green"].setBoolean(True)
        if len(conflist) > 2 and conflist[2][0]:
            self["key_yellow"].setBoolean(True)
        if len(conflist) > 3 and conflist[3][0]:
            self["key_blue"].setBoolean(True)

        self["config"].list = conflist
        self["config"].l.setList(conflist)

        self["streams"].list = streams
        self["streams"].setIndex(selectedidx)
Ejemplo n.º 59
0
 def execButtonSetup(self, selected):
     if selected:
         selected = selected[1].split("/")
         if selected[0] == "Plugins":
             twinPlugins = []
             twinPaths = {}
             pluginlist = plugins.getPlugins(
                 PluginDescriptor.WHERE_EVENTINFO)
             pluginlist.sort(key=lambda p: p.name)
             for plugin in pluginlist:
                 if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.func_code.co_varnames:
                     if twinPaths.has_key(plugin.path[24:]):
                         twinPaths[plugin.path[24:]] += 1
                     else:
                         twinPaths[plugin.path[24:]] = 1
                     if plugin.path[24:] + "/" + str(twinPaths[
                             plugin.path[24:]]) == "/".join(selected):
                         self.runPlugin(plugin)
                         return
                     twinPlugins.append(plugin.name)
             pluginlist = plugins.getPlugins([
                 PluginDescriptor.WHERE_PLUGINMENU,
                 PluginDescriptor.WHERE_EXTENSIONSMENU
             ])
             pluginlist.sort(key=lambda p: p.name)
             for plugin in pluginlist:
                 if plugin.name not in twinPlugins and plugin.path:
                     if twinPaths.has_key(plugin.path[24:]):
                         twinPaths[plugin.path[24:]] += 1
                     else:
                         twinPaths[plugin.path[24:]] = 1
                     if plugin.path[24:] + "/" + str(twinPaths[
                             plugin.path[24:]]) == "/".join(selected):
                         self.runPlugin(plugin)
                         return
                     twinPlugins.append(plugin.name)
         elif selected[0] == "MenuPlugin":
             for plugin in plugins.getPluginsForMenu(selected[1]):
                 if plugin[2] == selected[2]:
                     self.runPlugin(plugin[1])
                     return
         elif selected[0] == "Infobar":
             if hasattr(self, selected[1]):
                 exec "self." + ".".join(selected[1:]) + "()"
             else:
                 return 0
         elif selected[0] == "Module":
             try:
                 exec "from " + selected[1] + " import *"
                 exec "self.session.open(" + ",".join(selected[2:]) + ")"
             except:
                 print "[ButtonSetup] error during executing module %s, screen %s" % (
                     selected[1], selected[2])
         elif selected[0] == "Setup":
             exec "from Screens.Setup import *"
             exec "self.session.open(Setup, \"" + selected[1] + "\")"
         elif selected[0].startswith("Zap"):
             if selected[0] == "ZapPanic":
                 self.servicelist.history = []
                 self.pipShown() and self.showPiP()
             self.servicelist.servicelist.setCurrent(
                 eServiceReference("/".join(selected[1:])))
             self.servicelist.zap(enable_pipzap=True)
             if hasattr(self, "lastservice"):
                 self.lastservice = eServiceReference("/".join(
                     selected[1:]))
                 self.close()
             else:
                 self.show()
             from Screens.MovieSelection import defaultMoviePath
             moviepath = defaultMoviePath()
             if moviepath:
                 config.movielist.last_videodir.value = moviepath
         elif selected[0] == "PPanel":
             ppanelFileName = '/etc/ppanels/' + selected[1] + ".xml"
             if os.path.isfile(ppanelFileName) and os.path.isdir(
                     '/usr/lib/enigma2/python/Plugins/Extensions/PPanel'):
                 from Plugins.Extensions.PPanel.ppanel import PPanel
                 self.session.open(PPanel,
                                   name=selected[1] + ' PPanel',
                                   node=None,
                                   filename=ppanelFileName,
                                   deletenode=None)
         elif selected[0] == "Shellscript":
             command = '/usr/script/' + selected[1] + ".sh"
             if os.path.isfile(command) and os.path.isdir(
                     '/usr/lib/enigma2/python/Plugins/Extensions/PPanel'):
                 from Plugins.Extensions.PPanel.ppanel import Execute
                 self.session.open(Execute, selected[1] + " shellscript",
                                   None, command)
             else:
                 from Screens.Console import Console
                 exec "self.session.open(Console,_(selected[1]),[command])"
         elif selected[0] == "EMC":
             try:
                 from Plugins.Extensions.EnhancedMovieCenter.plugin import showMoviesNew
                 from Screens.InfoBar import InfoBar
                 open(showMoviesNew(InfoBar.instance))
             except Exception as e:
                 print('[EMCPlayer] showMovies exception:\n' + str(e))
         elif selected[0] == "ScriptRunner":
             if os.path.isfile(
                     "/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/ScriptRunner.pyo"
             ):
                 from Plugins.Extensions.Infopanel.ScriptRunner import ScriptRunner
                 self.session.open(ScriptRunner)
         elif selected[0] == "QuickMenu":
             if os.path.isfile(
                     "/usr/lib/enigma2/python/Plugins/Extensions/Infopanel/QuickMenu.pyo"
             ):
                 from Plugins.Extensions.Infopanel.QuickMenu import QuickMenu
                 self.session.open(QuickMenu)
         elif selected[0] == "Kodi":
             if os.path.isfile(
                     "/usr/lib/enigma2/python/Plugins/Extensions/Kodi/plugin.pyo"
             ):
                 from Plugins.Extensions.Kodi.plugin import KodiMainScreen
                 self.session.open(KodiMainScreen)
Ejemplo n.º 60
0
	def msgPlugins(self):
		if self.config_ready is not None:
			for p in plugins.getPlugins(PluginDescriptor.WHERE_NETWORKCONFIG_READ):
				p(reason=self.config_ready)