コード例 #1
0
ファイル: Profile.py プロジェクト: Venom83/openNFR-gui
def profile(id):
	now = time.time() - profile_start
	if profile_file:
		profile_file.write("%7.3f\t%s\n" % (now, id))

		if id in profile_data:
			t = profile_data[id]
			if total_time:
				perc = t * (PERCENTAGE_END - PERCENTAGE_START) / total_time + PERCENTAGE_START
			else:
				perc = PERCENTAGE_START
			try:
				if getBoxType() in ("odinm7", "odinm6", "xp1000s"):
					f = open("/dev/dbox/oled0", "w")
					f.write("%d" % perc)
				elif getBoxType() in ("gb800se", "gb800solo"):
					f = open("/dev/dbox/oled0", "w")
					f.write("%d  \n" % perc)
				elif getBoxType() == "gb800seplus":
					f = open("/dev/mcu", "w")
					f.write("%d  \n" % perc)
				elif getBoxType() == "ebox5000":
					f = open("/proc/progress", "w")
					f.write("%d" % perc)
				else:
					f = open("/proc/progress", "w")
					f.write("%d \n" % perc)
				f.close()
			except IOError:
				pass
コード例 #2
0
ファイル: LcdPicon.py プロジェクト: postla/OpenNFR-E2
	def __init__(self):
		Renderer.__init__(self)
		self.PicLoad = ePicLoad()
		self.PicLoad.PictureData.get().append(self.updatePicon)
		self.piconsize = (0,0)
		self.pngname = ""
		self.lastPath = None
		if getBoxType() == 'vuultimo' or getMachineProcModel().startswith("ini-90"):
			pngname = findLcdPicon("lcd_picon_default")
		else:
			pngname = findLcdPicon("picon_default")
		self.defaultpngname = None
		if not pngname:
			if getBoxType() == 'vuultimo' or getMachineProcModel().startswith("ini-90"):
				tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png")
			else:
				tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png")
			if pathExists(tmp):
				pngname = tmp
			else:
				if getBoxType() == 'vuultimo' or getMachineProcModel().startswith("ini-90"):
					pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png")
				else:
					pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png")
		if os.path.getsize(pngname):
			self.defaultpngname = pngname
コード例 #3
0
def profile(id):
	now = time.time() - profile_start
	if profile_file:
		profile_file.write("%7.3f\t%s\n" % (now, id))

		if id in profile_data:
			t = profile_data[id]
			if total_time:
				perc = t * (PERCENTAGE_END - PERCENTAGE_START) / total_time + PERCENTAGE_START
			else:
				perc = PERCENTAGE_START
			try:
				if boxtype in ("classm", "axodin", "axodinc", "starsatlx", "evo", "genius", "galaxym6" ):
					f = open("/dev/dbox/oled0", "w")
					f.write("%d" % perc)
				elif getBoxType() in ('gb800solo', 'gb800se', 'gb800seplus'):
					f = open("/dev/mcu", "w")
					f.write("%d  \n" % perc)
				elif boxtype in ("mixosf5", "gi9196m"):
					f = open("/proc/progress", "w")
					f.write("%d" % perc)
				elif boxtype in ("xpeedlx3", "sezammarvel", "atemionemesis"):
					f = open("/proc/vfd", "w")
					f.write("Loading %d %%" % perc)
				elif getBoxType() in ('amikoalien', 'amikomini', 'amiko8900', 'sognorevolution', 'arguspingulux', 'arguspinguluxmini', 'sparkreloaded', 'sabsolo', 'sparklx', 'gis8120'):
					f = open("/proc/vfd", "w")
					f.write("%d \n" % perc)
				else:
					f = open("/proc/progress", "w")
					f.write("%d \n" % perc)
				f.close()
			except IOError:
				pass
コード例 #4
0
ファイル: LcdPicon.py プロジェクト: antivirtel/enigma2
	def __init__(self):
		Renderer.__init__(self)
		self.PicLoad = ePicLoad()
		self.PicLoad.PictureData.get().append(self.updatePicon)
		self.piconsize = (0,0)
		self.pngname = ""
		self.lastPath = None
		if getBoxType() in ('vuultimo', 'et10000', 'mutant2400', 'xpeedlx3', 'quadbox2400', 'sezammarvel', 'atemionemesis', 'mbultra', 'beyonwizt4', 'dm7080'):
			pngname = findLcdPicon("lcd_picon_default")
		else:
			pngname = findLcdPicon("picon_default")
		self.defaultpngname = None
		if not pngname:
			if getBoxType() in ('vuultimo', 'et10000', 'mutant2400', 'xpeedlx3', 'quadbox2400', 'sezammarvel', 'atemionemesis', 'mbultra', 'beyonwizt4', 'dm7080'):
				tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png")
			else:
				tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png")
			if pathExists(tmp):
				pngname = tmp
			else:
				if getBoxType() in ('vuultimo', 'et10000', 'mutant2400', 'xpeedlx3', 'quadbox2400', 'sezammarvel', 'atemionemesis', 'mbultra', 'beyonwizt4', 'dm7080'):
					pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png")
				else:
					pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png")
		if os.path.getsize(pngname):
			self.defaultpngname = pngname
コード例 #5
0
ファイル: About.py プロジェクト: kingvuplus/Enigma2
 def poster_resize(self):
         if getBoxType() in ('et4x00'):
                 model = "et4x00.jpg"
         elif getBoxType() in ('et5000', 'et5x00'):
                 model = "et5x00.jpg"
         elif getBoxType() in ('et6x00', 'et6000'):
                 model = "et6x00.jpg"
         elif getBoxType() in ('et6500'):
                 model = "et6500.jpg"
         elif getBoxType() in ('et7000'):
                 model = "et7000.jpg"
         elif getBoxType() in ('et7500'):
                 model = "et7500.jpg"
         elif getBoxType() in ('et8000'):
                 model = "et8000.jpg"
         elif getBoxType() in ('et8500', 'et8500s'):
                 model = "et8500.jpg"
         elif getBoxType() in ('et9000', 'et9x00', 'et9200', 'et9500'):
                 model = "et9x00.jpg"
         elif getBoxType() in ('et10000'):
                 model = "et10000.jpg"
         else:
                 model = None
                 
         poster_path = "/usr/share/enigma2/%s" % model        
         self["boxpic"].hide()
         sc = AVSwitch().getFramebufferScale()
         self.picload = ePicLoad()
         size = self["boxpic"].instance.size()
         self.picload.setPara((size.width(), size.height(), sc[0], sc[1], False, 1, "#00000000"))
         if self.picload.startDecode(poster_path, 0, 0, False) == 0:
                 ptr = self.picload.getData()
                 if ptr != None:
                         self["boxpic"].instance.setPixmap(ptr)
                         self["boxpic"].show()                                	
コード例 #6
0
ファイル: LcdPicon.py プロジェクト: sklnet/openbh-enigma2
	def __init__(self):
		Renderer.__init__(self)
		self.PicLoad = ePicLoad()
		self.PicLoad.PictureData.get().append(self.updatePicon)
		self.piconsize = (0,0)
		self.pngname = ""
		self.lastPath = None
		if getBoxType() in bw_lcd or config.lcd.picon_pack.value:
			pngname = findLcdPicon("lcd_picon_default")
		else:
			pngname = findLcdPicon("picon_default")
		self.defaultpngname = None
		if not pngname:
			if getBoxType() in bw_lcd or config.lcd.picon_pack.value:
				tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png")
			else:
				tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png")
			if pathExists(tmp):
				pngname = tmp
			else:
				if getBoxType() in bw_lcd or config.lcd.picon_pack.value:
					pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png")
				else:
					pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png")
		if os.path.getsize(pngname):
			self.defaultpngname = pngname
コード例 #7
0
ファイル: Profile.py プロジェクト: popazerty/e2-gui
def profile(id):
	now = time.time() - profile_start
	if profile_file:
		profile_file.write("%7.3f\t%s\n" % (now, id))

		if id in profile_data:
			t = profile_data[id]
			if total_time:
				perc = t * (PERCENTAGE_END - PERCENTAGE_START) / total_time + PERCENTAGE_START
			else:
				perc = PERCENTAGE_START
			try:
				if getBoxType() in ("classm", "axodin", "axodinc", "starsatlx", "evo", "genius", "galaxym6" ):
					f = open("/dev/dbox/oled0", "w")
					f.write("%d" % perc)
				elif getBoxType() in ('gb800solo', 'gb800se', 'gb800seplus'):
					f = open("/dev/mcu", "w")
					f.write("%d  \n" % perc)
				elif getBoxType() in ("mixosf5", "gi9196m"):
					f = open("/proc/progress", "w")
					f.write("%d" % perc)
				elif getMachineBuild() in ("inihdp", "inihdx"):
					f = open("/proc/vfd", "w")
					f.write("Loading %d%%" % perc)
				else:
					f = open("/proc/progress", "w")
					f.write("%d \n" % perc)
				f.close()
			except IOError:
				pass
コード例 #8
0
ファイル: About.py プロジェクト: kingvuplus/xx-n1
 def poster_resize(self):
     if getBoxType() in 'vusolo2':
         model = 'vusolo2.jpg'
     elif getBoxType() in 'sparkreloaded':
         model = 'sparkreloaded.jpg'
     elif getBoxType() in 'sparktriplex':
         model = 'sparktriplex.jpg'
     else:
         model = None
     poster_path = '/usr/share/enigma2/%s' % model
     self['boxpic'].hide()
     sc = AVSwitch().getFramebufferScale()
     self.picload = ePicLoad()
     size = self['boxpic'].instance.size()
     self.picload.setPara((size.width(),
      size.height(),
      sc[0],
      sc[1],
      False,
      1,
      '#00000000'))
     if self.picload.startDecode(poster_path, 0, 0, False) == 0:
         ptr = self.picload.getData()
         if ptr != None:
             self['boxpic'].instance.setPixmap(ptr)
             self['boxpic'].show()
コード例 #9
0
ファイル: LcdPicon.py プロジェクト: kingvuplus/eg-e2
 def __init__(self):
     Renderer.__init__(self)
     self.PicLoad = ePicLoad()
     self.PicLoad.PictureData.get().append(self.updatePicon)
     self.piconsize = (0, 0)
     self.pngname = ''
     self.lastPath = None
     if getBoxType() in ('vuultimo', 'et10000', 'mutant2400', 'quadbox2400') or getMachineBuild() in 'inihdp':
         pngname = findLcdPicon('lcd_picon_default')
     else:
         pngname = findLcdPicon('picon_default')
     self.defaultpngname = None
     if not pngname:
         if getBoxType() in ('vuultimo', 'et10000', 'mutant2400', 'quadbox2400') or getMachineBuild() in 'inihdp':
             tmp = resolveFilename(SCOPE_ACTIVE_SKIN, 'lcd_picon_default.png')
         else:
             tmp = resolveFilename(SCOPE_ACTIVE_SKIN, 'picon_default.png')
         if pathExists(tmp):
             pngname = tmp
         elif getBoxType() in ('vuultimo', 'et10000', 'mutant2400', 'quadbox2400') or getMachineBuild() in 'inihdp':
             pngname = resolveFilename(SCOPE_ACTIVE_SKIN, 'lcd_picon_default.png')
         else:
             pngname = resolveFilename(SCOPE_ACTIVE_SKIN, 'picon_default.png')
     if os.path.getsize(pngname):
         self.defaultpngname = pngname
     return
コード例 #10
0
 def run(self):
     if self.index == self.STATE_UPDATE:
         if config.misc.installwizard.hasnetwork.value:
             self.session.open(InstallWizardIpkgUpdater, self.index, _('Please wait (updating packages)'), IpkgComponent.CMD_UPDATE)
     elif self.index == self.STATE_CHOISE_CHANNELLIST and self.enabled.value:
         self.session.open(InstallWizardIpkgUpdater, self.index, _('Please wait (downloading channel list)'), IpkgComponent.CMD_REMOVE, {'package': 'enigma2-plugin-settings-' + self.channellist_type.value})
     elif self.index == self.STATE_CHOISE_SOFTCAM and self.enabled.value:
         from EGAMI.EGAMI_tools import preapreEmud
         preapreEmud()
         softcam_name = self.softcam_type.value
         if softcam_name == 'cccam':
             cmd = ';rm /tmp/Addon.tgz;wget -q http://enigma-spark.com/egami/mipsel/softcams_full_mipsel/cccam_230_egami_E2_sh.tar.gz -O /tmp/Addon.tgz'
         elif softcam_name == 'wicardd':
             cmd = ';rm /tmp/Addon.tgz;wget -q http://enigma-spark.com/egami/mipsel/softcams_full_mipsel/wicardd_118_egami_E2_sh.tar.gz -O /tmp/Addon.tgz'
             if getBoxType() in 'vusolo4k':
                 cmd = ';rm /tmp/Addon.tgz;wget -q http://enigma-spark.com/egami/armv7ahf/softcams_full_armv7ahf/wicardd_119_egami_E2_armv7ahf_sh.tar.gz -O /tmp/Addon.tgz'
         elif softcam_name == 'gbox':
             cmd = ';rm /tmp/Addon.tgz;wget -q http://enigma-spark.com/egami/egami/mipsel/softcams_full_mipsel/gbox_811K_egami_E2_sh.tar.gz -O /tmp/Addon.tgz'
         elif softcam_name == 'mgcamd':
             cmd = ';rm /tmp/Addon.tgz;wget -q http://enigma-spark.com/egami/egami/mipsel/softcams_full_mipsel/mgcamd_138c_egami_E2_sh.tar.gz -O /tmp/Addon.tgz'
         elif softcam_name == 'oscam':
             cmd = ';rm /tmp/Addon.tgz;wget -q http://enigma-spark.com/egami/egami/mipsel/softcams_full_mipsel/oscam_11214_egami_E2_sh.tar.gz -O /tmp/Addon.tgz'
             if getBoxType() in 'vusolo4k':
                 cmd = ';rm /tmp/Addon.tgz;wget -q http://enigma-spark.com/egami/armv7ahf/softcams_full_armv7ahf/oscam_11086_egami_E2_armv7ahf_sh.tar.gz -O /tmp/Addon.tgz'
             if getBoxType() in 'wetekplay':
                 cmd = ';rm /tmp/Addon.tgz;wget -q http://enigma-spark.com/egami/cortexa9hf/softcams_cfg_cortexa9hf/oscam_10943_egami_E2_cortexa9hf_sh.tar.gz -O /tmp/Addon.tgz'
         cmd += ';cd /; tar -xz -f /tmp/Addon.tgz ; rm /tmp/Addon.tgz'
         self.session.open(InstallWizardIpkgUpdater, self.index, _('Please wait (downloading softcam)'), IpkgComponent.CMD_INSTALL, {'package': cmd})
コード例 #11
0
ファイル: Profile.py プロジェクト: popazerty/beyonwiz-4.1
def profile(id):
	now = time.time() - profile_start
	if profile_file:
		profile_file.write("%7.3f\t%s\n" % (now, id))

		if id in profile_data:
			t = profile_data[id]
			if total_time:
				perc = t * (PERCENTAGE_END - PERCENTAGE_START) / total_time + PERCENTAGE_START
			else:
				perc = PERCENTAGE_START
			try:
				if getBoxType() in ("odinm7", "odinm6", "xp1000s"):
					f = open("/dev/dbox/oled0", "w")
					f.write("%d" % perc)
				elif getBoxType() in ("gb800se", "gb800solo"):
					f = open("/dev/dbox/oled0", "w")
					f.write("%d  \n" % perc)
				elif getBoxType() == "gb800seplus":
					f = open("/dev/mcu", "w")
					f.write("%d  \n" % perc)
				elif getBoxType() == "ebox5000":
					f = open("/proc/progress", "w")
					f.write("%d" % perc)
				elif getBoxType() in ('amiko8900', 'sognorevolution', 'arguspingulux', 'arguspinguluxmini', 'sparkreloaded', 'sabsolo', 'sparklx', 'gis8120'):
 					f = open("/proc/vfd", "w")
 					f.write("%d \n" % perc)
				else:
					f = open("/proc/progress", "w")
					f.write("%d \n" % perc)
				f.close()
			except IOError:
				pass
コード例 #12
0
ファイル: InputDevice.py プロジェクト: pizzelnet/dvbapp
	def setupConfigEntries(self,device):
		cmd = "config.inputDevices." + device + " = ConfigSubsection()"
		exec (cmd)
		if getBoxType() in ('elite', 'premium', 'premium+', 'ultra', 'dm800'):
			cmd = "config.inputDevices." + device + ".enabled = ConfigYesNo(default = True)"
		else:
			cmd = "config.inputDevices." + device + ".enabled = ConfigYesNo(default = False)"
		exec (cmd)
		cmd = "config.inputDevices." + device + ".enabled.addNotifier(self.inputDevicesEnabledChanged,config.inputDevices." + device + ".enabled)"
		exec (cmd)
		cmd = "config.inputDevices." + device + '.name = ConfigText(default="")'
		exec (cmd)
		cmd = "config.inputDevices." + device + ".name.addNotifier(self.inputDevicesNameChanged,config.inputDevices." + device + ".name)"
		exec (cmd)
		if boxtype in ('maram9', 'classm', 'axodin', 'axodinc', 'starsatlx', 'genius', 'evo', 'galaxym6'):
			cmd = "config.inputDevices." + device + ".repeat = ConfigSlider(default=400, increment = 10, limits=(0, 500))"
		elif getBoxType() in ('elite', 'premium', 'premium+', 'ultra'):
			cmd = "config.inputDevices." + device + ".repeat = ConfigSlider(default=80, increment = 10, limits=(0, 500))"
		else:
			cmd = "config.inputDevices." + device + ".repeat = ConfigSlider(default=100, increment = 10, limits=(0, 500))"
		exec (cmd)
		cmd = "config.inputDevices." + device + ".repeat.addNotifier(self.inputDevicesRepeatChanged,config.inputDevices." + device + ".repeat)"
		exec (cmd)
		if boxtype in ('maram9', 'classm', 'axodin', 'axodinc', 'starsatlx', 'genius', 'evo', 'galaxym6'):
			cmd = "config.inputDevices." + device + ".delay = ConfigSlider(default=200, increment = 100, limits=(0, 5000))"
		elif getBoxType() in ('elite', 'premium', 'premium+', 'ultra'):
			cmd = "config.inputDevices." + device + ".delay = ConfigSlider(default=800, increment = 100, limits=(0, 5000))"
		else:
			cmd = "config.inputDevices." + device + ".delay = ConfigSlider(default=700, increment = 100, limits=(0, 5000))"
		exec (cmd)
		cmd = "config.inputDevices." + device + ".delay.addNotifier(self.inputDevicesDelayChanged,config.inputDevices." + device + ".delay)"
		exec (cmd)
コード例 #13
0
ファイル: RollerCharLCD.py プロジェクト: kingvuplus/boom
 def __init__(self):
     Renderer.__init__(self)
     VariableText.__init__(self)
     if getBoxType() == 'vuduo' or getBoxType() == 'suntwin':
         self.stringlength = 16
     else:
         self.stringlength = 12
コード例 #14
0
ファイル: AVSwitch.py プロジェクト: BlackHole/enigma2-1
	def setMode(self, port, mode, rate, force = None):
		print "[VideoHardware] setMode - port: %s, mode: %s, rate: %s" % (port, mode, rate)

		# config.av.videoport.setValue(port)
		# we can ignore "port"
		self.current_mode = mode
		self.current_port = port
		modes = self.rates[mode][rate]

		mode_50 = modes.get(50)
		mode_60 = modes.get(60)
		if mode_50 is None or force == 60:
			mode_50 = mode_60
		if mode_60 is None or force == 50:
			mode_60 = mode_50

		if os.path.exists('/proc/stb/video/videomode_50hz') and getBoxType() not in ('gb800solo', 'gb800se', 'gb800ue'):
			f = open("/proc/stb/video/videomode_50hz", "w")
			f.write(mode_50)
			f.close()
		if os.path.exists('/proc/stb/video/videomode_60hz') and getBoxType() not in ('gb800solo', 'gb800se', 'gb800ue'):
			f = open("/proc/stb/video/videomode_60hz", "w")
			f.write(mode_60)
			f.close()
		try:
			set_mode = modes.get(int(rate[:2]))
		except: # not support 50Hz, 60Hz for 1080p
			set_mode = mode_50
		f = open("/proc/stb/video/videomode", "w")
		f.write(set_mode)
		f.close()
		map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
		self.setColorFormat(map[config.av.colorformat.value])
コード例 #15
0
ファイル: About.py プロジェクト: takitr/dvbapp
def getCPUSpeedString():
	if getBoxType() in ('wetekplay'):
		return "1.5 GHz"
	elif getBoxType() in ('azboxhd'):
		return "300 MHz"
	elif getBoxType() in ('azboxme'):
		return "667 MHz"
	elif getBoxType in ('azboxminime'):
		return "500 MHz"
	else:
		try:
			file = open('/proc/cpuinfo', 'r')
			lines = file.readlines()
			for x in lines:
				splitted = x.split(': ')
				if len(splitted) > 1:
					splitted[1] = splitted[1].replace('\n','')
					if splitted[0].startswith("cpu MHz"):
						mhz = float(splitted[1].split(' ')[0])
						if mhz and mhz >= 1000:
							mhz = "%s GHz" % str(round(mhz/1000,1))
						else:
							mhz = "%s MHz" % str(round(mhz,1))
			file.close()
			return mhz
		except IOError:
			return _("unavailable")
コード例 #16
0
ファイル: Wol.py プロジェクト: schleichdi2/OpenNfr_E2_Gui-5.3
def Init():
    if SystemInfo["WOL"] and not getBoxType() in ("gbquadplus", "gbquad", "gb800ueplus", "gb800seplus", "gbipbox"):

        def setWOLmode(value):
            iwol.setWolState(config.network.wol.value)

        iwol = WOL()
        config.network.wol = ConfigSelection([("disable", _("No")), ("enable", _("Yes"))], default="disable")
        config.network.wol.addNotifier(setWOLmode, initial_call=True)

    elif SystemInfo["WOL"] and getBoxType() in ("gbquadplus", "gbquad", "gb800ueplus", "gb800seplus", "gbipbox"):

        def setWOLmode(value):
            iwol.setWolState(config.network.wol.value)

        iwol = WOL()
        config.network.wol = ConfigSelection([("off", _("No")), ("on", _("Yes"))], default="off")
        config.network.wol.addNotifier(setWOLmode, initial_call=True)

    else:

        def doNothing():
            pass

        config.network.wol = ConfigNothing()
コード例 #17
0
ファイル: InfoBar.py プロジェクト: mcron/enigma2
	def showTvButton(self):
		if getBoxType().startswith('gb') or getBoxType() == 'odinm7':
			self.toogleTvRadio()
		elif getBoxType() == 'ventonhdx':
			self.showMovies()
		else:
			self.showTv()
コード例 #18
0
ファイル: plugin.py プロジェクト: Dima73/oe-alliance-plugins
def createTransCodingConfig(encoder):
	if fileExists(getProcPath(encoder ,"bitrate")):
		if getBoxType() in ('vusolo2') or getMachineBuild() in ('dags3', 'dags4'):
			choice = ConfigSelection(default = "400000", choices=[("-1", "Auto"), ("50000", "50 Kbits"), ("100000", "100 Kbits"), ("150000", "150 Kbits"), ("200000", "200 Kbits"), ("250000", "250 Kbits"), ("300000", "300 Kbits"), ("350000", "350 Kbits"), ("400000", "400 Kbits"), ("450000", "450 Kbits"), ("500000", "500 Kbits"), ("600000", "600 Kbits"), ("700000", "700 Kbits"), ("800000", "800 Kbits"), ("900000", "900 Kbits"), ("1000000", "1 Mbits")])
		elif getBoxType() in ('gbquad', 'gbquadplus'):
			choice = ConfigSelection(default = "-1", choices=[("-1", "Auto"), ("50000", "50 Kbits"), ("100000", "100 Kbits"), ("150000", "150 Kbits"), ("200000", "200 Kbits"), ("250000", "250 Kbits"), ("300000", "300 Kbits"), ("350000", "350 Kbits"), ("400000", "400 Kbits"), ("450000", "450 Kbits"), ("500000", "500 Kbits"), ("600000", "600 Kbits"), ("700000", "700 Kbits"), ("800000", "800 Kbits"), ("900000", "900 Kbits"), ("1000000", "1 Mbits")])
		else:
			choice = ConfigSelection(default = "2000000", choices=[("-1", "Auto"), ("100000", "100 Kbits"), ("150000", "150 Kbits"), ("200000", "200 Kbits"), ("250000", "250 Kbits"), ("300000", "300 Kbits"), ("350000", "350 Kbits"), ("400000", "400 Kbits"), ("450000", "450 Kbits"), ("500000", "500 Kbits"), ("750000", "750 Kbits"), ("1000000", "1 Mbits"), ("1500000", "1.5 Mbits"), ("2000000", "2 Mbits"), ("2500000", "2.5 Mbits"), ("3000000", "3 Mbits"), ("3500000", "3.5 Mbits"), ("4000000", "4 Mbits"), ("4500000", "4.5 Mbits"), ("5000000", "5 Mbits"), ("10000000", "10 Mbits")])
		config.plugins.transcodingsetup.encoder[int(encoder)].bitrate = choice

	if fileExists(getProcPath(encoder ,"framerate")):
		if getBoxType() in ('gbquad', 'gbquadplus'):
			choice = ConfigSelection(default = "-1", choices = [("-1", "Auto"), ("23976", "23.976 fps"), ("24000", "24 fps"), ("25000", "25 fps"), ("29970", "29.970 fps")])
		else:
			choice = ConfigSelection(default = "50000", choices = [("-1", "Auto"), ("23976", "23.976 fps"), ("24000", "24 fps"), ("25000", "25 fps"), ("29970", "29.970 fps"), ("30000", "30 fps"), ("50000", "50 fps"), ("59940", "59.940 fps"), ("60000", "60 fps")])
		config.plugins.transcodingsetup.encoder[int(encoder)].framerate = choice

	if checkSupportAdvanced():
		if (hasattr(config.plugins.transcodingsetup.encoder[int(encoder)], "bitrate") or hasattr(config.plugins.transcodingsetup.encoder[int(encoder)], "framerate")):
			choice = ConfigSelection(default = "Off", choices = [ ("On", _("On")), ("Off", _("Off")) ])
			config.plugins.transcodingsetup.encoder[int(encoder)].automode = choice

		if fileExists(getProcPath(encoder, "resolution")):
			resolution_choices = [("480p", _("480p")), ("576p", _("576p")), ("720p", _("720p")), ("320x240", _("320x240")), ("160x120", _("160x120"))]
			if getBoxType() in ("vusolo4k"):
				resolution_choices.insert(3, ("1080p", _("1080p")))
			choice = ConfigSelection(default = "480p", choices=resolution_choices)
			config.plugins.transcodingsetup.encoder[int(encoder)].resolution = choice

		if fileExists(getProcPath(encoder, "aspectratio")):
			choice = ConfigSelection(default = "2", choices = [ ("0", _("auto")), ("1", _("4x3")), ("2", _("16x9")) ])
			config.plugins.transcodingsetup.encoder[int(encoder)].aspectratio = choice

		if fileExists(getProcPath(encoder, "audiocodec")):
			choice = ConfigSelection(default = "aac", choices = [("mpg", _("mpg")), ("mp3", _("mp3")), ("aac", _("aac")), ("aac+", _("aac+")), ("aac+loas", _("aac+loas")), ("aac+adts", _("aac+adts")), ("ac3", _("ac3"))])
			config.plugins.transcodingsetup.encoder[int(encoder)].audiocodec = choice

		if fileExists(getProcPath(encoder, "videocodec")):
			choice = ConfigSelection(default = "h264", choices = [ ("h264", _("h264")) ])
			config.plugins.transcodingsetup.encoder[int(encoder)].videocodec = choice

		if fileExists(getProcPath(encoder, "gopframeb")):
			choice = ConfigInteger(default = 0, limits = (0, 60))
			config.plugins.transcodingsetup.encoder[int(encoder)].gopframeb = choice

		if fileExists(getProcPath(encoder, "gopframep")):
			choice = ConfigInteger(default = 29, limits = (0, 60))
			config.plugins.transcodingsetup.encoder[int(encoder)].gopframep = choice

		if fileExists(getProcPath(encoder, "level")):
			choice = ConfigSelection(default = "3.1", choices = [("1.0", _("1.0")), ("2.0", _("2.0")),
				("2.1", _("2.1")), ("2.2", _("2.2")), ("3.0", _("3.0")), ("3.1", _("3.1")),
				("3.2", _("3.2")), ("4.0", _("4.0")), ("4.1", _("4.1")), ("4.2", _("4.2")),
				("5.0", _("5.0")), ("low", _("low")), ("main", _("main")), ("high", _("high"))])
			config.plugins.transcodingsetup.encoder[int(encoder)].level = choice

		if fileExists(getProcPath(encoder, "profile")):
			choice = ConfigSelection(default = "baseline", choices = [("baseline", _("baseline")), ("simple", _("simple")), ("main", _("main")), ("high", _("high")), ("advanced simple", _("advancedsimple"))])
			config.plugins.transcodingsetup.encoder[int(encoder)].profile = choice
コード例 #19
0
ファイル: QuickMenu.py プロジェクト: jojo260/enigma2
 def Qsoftware(self):
     self.sublist = []
     self.sublist.append(
         QuickSubMenuEntryComponent(
             "Software Update",
             _("Online software update"),
             _("Check/Install online updates (you must have a working internet connection)"),
         )
     )
     if (
         not getBoxType().startswith("az")
         and not getBoxType().startswith("dm")
         and not getBrandOEM().startswith("cube")
     ):
         self.sublist.append(
             QuickSubMenuEntryComponent(
                 "Flash Online", _("Flash Online a new image"), _("Flash on the fly your your Receiver software.")
             )
         )
     self.sublist.append(
         QuickSubMenuEntryComponent(
             "Complete Backup",
             _("Backup your current image"),
             _("Backup your current image to HDD or USB. This will make a 1:1 copy of your box"),
         )
     )
     self.sublist.append(
         QuickSubMenuEntryComponent(
             "Backup Settings",
             _("Backup your current settings"),
             _("Backup your current settings. This includes E2-setup, channels, network and all selected files"),
         )
     )
     self.sublist.append(
         QuickSubMenuEntryComponent(
             "Restore Settings",
             _("Restore settings from a backup"),
             _(
                 "Restore your settings back from a backup. After restore the box will restart to activated the new settings"
             ),
         )
     )
     self.sublist.append(
         QuickSubMenuEntryComponent(
             "Select Backup files",
             _("Choose the files to backup"),
             _(
                 "Here you can select which files should be added to backupfile. (default: E2-setup, channels, network"
             ),
         )
     )
     self.sublist.append(
         QuickSubMenuEntryComponent(
             "Software Manager Setup",
             _("Manage your online update files"),
             _("Here you can select which files should be updated with a online update"),
         )
     )
     self["sublist"].l.setList(self.sublist)
コード例 #20
0
ファイル: plugin.py プロジェクト: R7UST/oe-alliance-plugins
	def revert(self):
		for count in range(fancontrol.getFanCount()):
			if not getBoxType().startswith('tm') or not getBoxType().startswith('vu'):
				fancontrol.getConfig(count).vlt.load()
			fancontrol.getConfig(count).pwm.load()
			if not getBoxType().startswith('tm') or not getBoxType().startswith('vu'):
				fancontrol.getConfig(count).vlt_standby.load()
			fancontrol.getConfig(count).pwm_standby.load()
		self.close()
コード例 #21
0
ファイル: VfdSymbols.py プロジェクト: henrylicious/e2
	def Recording(self):
		if fileExists("/proc/stb/lcd/symbol_circle"):
			recordings = len(NavigationInstance.instance.getRecordings(False,Components.RecordingConfig.recType(config.recording.show_rec_symbol_for_rec_types.getValue())))
			if recordings > 0:
				open("/proc/stb/lcd/symbol_circle", "w").write("3")
			else:
				open("/proc/stb/lcd/symbol_circle", "w").write("0")
		elif getBoxType() in ('mixosf5', 'mixoslumi', 'mixosf7', 'gi9196m', 'sf3038'):
			recordings = len(NavigationInstance.instance.getRecordings(False,Components.RecordingConfig.recType(config.recording.show_rec_symbol_for_rec_types.getValue())))
			if recordings > 0:
				open("/proc/stb/lcd/symbol_recording", "w").write("1")
			else:
				open("/proc/stb/lcd/symbol_recording", "w").write("0")
		elif getBoxType() in ('ixussone', 'ixusszero', 'wetekplay'):
			recordings = len(NavigationInstance.instance.getRecordings(False,Components.RecordingConfig.recType(config.recording.show_rec_symbol_for_rec_types.getValue())))
			self.blink = not self.blink
			if recordings > 0:
				if self.blink:
					open("/proc/stb/lcd/powerled", "w").write("1")
					self.led = "1"
				else:
					open("/proc/stb/lcd/powerled", "w").write("0")
					self.led = "0"
			elif self.led == "1":
				open("/proc/stb/lcd/powerled", "w").write("0")
		elif getBoxType() in ('mbmicro'):
			recordings = len(NavigationInstance.instance.getRecordings(False,Components.RecordingConfig.recType(config.recording.show_rec_symbol_for_rec_types.getValue())))
			self.blink = not self.blink
			if recordings > 0:
				if self.blink:
					open("/proc/stb/lcd/powerled", "w").write("0")
					self.led = "1"
				else:
					open("/proc/stb/lcd/powerled", "w").write("1")
					self.led = "0"
			elif self.led == "1":
				open("/proc/stb/lcd/powerled", "w").write("1")

		else:
			if not fileExists("/proc/stb/lcd/symbol_recording") or not fileExists("/proc/stb/lcd/symbol_record_1") or not fileExists("/proc/stb/lcd/symbol_record_2"):
				return
	
			recordings = len(NavigationInstance.instance.getRecordings(False,Components.RecordingConfig.recType(config.recording.show_rec_symbol_for_rec_types.getValue())))
		
			if recordings > 0:
				open("/proc/stb/lcd/symbol_recording", "w").write("1")
				if recordings == 1:
					open("/proc/stb/lcd/symbol_record_1", "w").write("1")
					open("/proc/stb/lcd/symbol_record_2", "w").write("0")
				elif recordings >= 2:
					open("/proc/stb/lcd/symbol_record_1", "w").write("1")
					open("/proc/stb/lcd/symbol_record_2", "w").write("1")
			else:
				open("/proc/stb/lcd/symbol_recording", "w").write("0")
				open("/proc/stb/lcd/symbol_record_1", "w").write("0")
				open("/proc/stb/lcd/symbol_record_2", "w").write("0")
コード例 #22
0
ファイル: VfdSymbols.py プロジェクト: gigirock/stbgui
	def Recording(self):
		if fileExists("/proc/stb/lcd/symbol_circle"):
			recordings = len(NavigationInstance.instance.getRecordings())
			if recordings > 0:
				open("/proc/stb/lcd/symbol_circle", "w").write("3")
			else:
				open("/proc/stb/lcd/symbol_circle", "w").write("0")
		elif getBoxType() in ('dummy'):
			recordings = len(NavigationInstance.instance.getRecordings())
			if recordings > 0:
				open("/proc/stb/lcd/symbol_recording", "w").write("1")
			else:
				open("/proc/stb/lcd/symbol_recording", "w").write("0")
		elif getBoxType() in ('dummy'):
			recordings = len(NavigationInstance.instance.getRecordings())
			self.blink = not self.blink
			if recordings > 0:
				if self.blink:
					open("/proc/stb/lcd/powerled", "w").write("1")
					self.led = "1"
				else:
					open("/proc/stb/lcd/powerled", "w").write("0")
					self.led = "0"
			elif self.led == "1":
				open("/proc/stb/lcd/powerled", "w").write("0")
		elif getBoxType() in ('dummy'):
			recordings = len(NavigationInstance.instance.getRecordings())
			self.blink = not self.blink
			if recordings > 0:
				if self.blink:
					open("/proc/stb/lcd/powerled", "w").write("0")
					self.led = "1"
				else:
					open("/proc/stb/lcd/powerled", "w").write("1")
					self.led = "0"
			elif self.led == "1":
				open("/proc/stb/lcd/powerled", "w").write("1")

		else:
			if not fileExists("/proc/stb/lcd/symbol_recording") or not fileExists("/proc/stb/lcd/symbol_record_1") or not fileExists("/proc/stb/lcd/symbol_record_2"):
				return
	
			recordings = len(NavigationInstance.instance.getRecordings())
		
			if recordings > 0:
				open("/proc/stb/lcd/symbol_recording", "w").write("1")
				if recordings == 1:
					open("/proc/stb/lcd/symbol_record_1", "w").write("1")
					open("/proc/stb/lcd/symbol_record_2", "w").write("0")
				elif recordings >= 2:
					open("/proc/stb/lcd/symbol_record_1", "w").write("1")
					open("/proc/stb/lcd/symbol_record_2", "w").write("1")
			else:
				open("/proc/stb/lcd/symbol_recording", "w").write("0")
				open("/proc/stb/lcd/symbol_record_1", "w").write("0")
				open("/proc/stb/lcd/symbol_record_2", "w").write("0")
コード例 #23
0
ファイル: About.py プロジェクト: MCelliotG/enigma2-2
	def populate(self):
		self["lab1"] = StaticText(_("Virtuosso Image Xtreme"))
		self["lab2"] = StaticText(_("By Team ViX"))
		model = None
		AboutText = ""
		self["lab3"] = StaticText(_("Support at") + " www.world-of-satellite.com")

		AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName())

		if path.exists('/proc/stb/info/chipset'):
			AboutText += _("Chipset:\tBCM%s\n") % about.getChipSetString()

		AboutText += _("CPU:\t%s\n") % about.getCPUString()
		AboutText += _("CPU speed:\t%s\n") % about.getCPUSpeedString()
		AboutText += _("Cores:\t%s\n") % about.getCpuCoresString()
		imageSubBuild = ""
		if getImageType() != 'release':
			imageSubBuild = ".%s" % getImageDevBuild()
		AboutText += _("Build:\t%s.%s%s (%s)\n") % (getImageVersion(), getImageBuild(), imageSubBuild, getImageType().title())
		AboutText += _("Skin name:\t%s\n") % config.skin.primary_skin.value[0:-9]

		string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))
		AboutText += _("Drivers:\t%s\n") % driversdate
		AboutText += _("Kernel:\t%s\n") % about.getKernelVersionString()

		AboutText += _("GStreamer:\t%s\n") % about.getGStreamerVersionString().replace("GStreamer ","")
		AboutText += _("Python:\t%s\n") % about.getPythonVersionString()

		AboutText += _("Installed:\t%s\n") % about.getFlashDateString()
		AboutText += _("Last update:\t%s\n\n") % getEnigmaVersionString()

		fp_version = getFPVersion()
		if fp_version is None:
			fp_version = ""
		elif fp_version != 0:
			fp_version = _("Frontprocessor version: %d") % fp_version
			AboutText += fp_version + "\n"

		tempinfo = ""
		if path.exists('/proc/stb/sensors/temp0/value') and getBoxType() not in ('gbquad'):
			f = open('/proc/stb/sensors/temp0/value', 'r')
			tempinfo = f.read()
			f.close()
		elif path.exists('/proc/stb/fp/temp_sensor') and getBoxType() not in ('gbquad'):
			f = open('/proc/stb/fp/temp_sensor', 'r')
			tempinfo = f.read()
			f.close()
		if tempinfo and int(tempinfo.replace('\n', '')) > 0:
			mark = str('\xc2\xb0')
			AboutText += _("System temperature: %s%sC\n\n") % (tempinfo.replace('\n', ''), mark)

		self["AboutScrollLabel"] = ScrollLabel(AboutText)
コード例 #24
0
ファイル: VfdSymbols.py プロジェクト: gmonti1/enigma2
	def Recording(self):
		if fileExists("/proc/stb/lcd/symbol_circle"):
			recordings = len(NavigationInstance.instance.getRecordings())
			if recordings > 0:
				open("/proc/stb/lcd/symbol_circle", "w").write("3")
			else:
				open("/proc/stb/lcd/symbol_circle", "w").write("0")
		elif getBoxType() in ('mixosf5', 'mixoslumi', 'mixosf7', 'gi9196m', 'sf3038'):
			recordings = len(NavigationInstance.instance.getRecordings())
			if recordings > 0:
				open("/proc/stb/lcd/symbol_recording", "w").write("1")
			else:
				open("/proc/stb/lcd/symbol_recording", "w").write("0")
		elif getBoxType() in ('ixussone', 'ixusszero'):
			recordings = len(NavigationInstance.instance.getRecordings())
			self.blink = not self.blink
			if recordings > 0:
				if self.blink:
					open("/proc/stb/lcd/powerled", "w").write("1")
					self.led = "1"
				else:
					open("/proc/stb/lcd/powerled", "w").write("0")
					self.led = "0"
			elif self.led == "1":
				open("/proc/stb/lcd/powerled", "w").write("0")
		elif getBoxType() in ('nano', 'nanoc'):
			recordings = len(NavigationInstance.instance.getRecordings())
			self.blink = not self.blink
			if recordings > 0:
				if self.blink:
					open("/proc/stb/lcd/powerled", "w").write("0")
					self.led = "1"
				else:
					open("/proc/stb/lcd/powerled", "w").write("1")
					self.led = "0"
			elif self.led == "1":
				open("/proc/stb/lcd/powerled", "w").write("1")

		else:
			if not fileExists("/proc/stb/lcd/symbol_recording") or not fileExists("/proc/stb/lcd/symbol_record_1") or not fileExists("/proc/stb/lcd/symbol_record_2"):
				return
	
			recordings = len(NavigationInstance.instance.getRecordings())
		
			if recordings > 0:
				open("/proc/stb/lcd/symbol_recording", "w").write("1")
				if recordings == 1:
					open("/proc/stb/lcd/symbol_record_1", "w").write("1")
					open("/proc/stb/lcd/symbol_record_2", "w").write("0")
				elif recordings >= 2:
					open("/proc/stb/lcd/symbol_record_1", "w").write("1")
					open("/proc/stb/lcd/symbol_record_2", "w").write("1")
			else:
				open("/proc/stb/lcd/symbol_recording", "w").write("0")
				open("/proc/stb/lcd/symbol_record_1", "w").write("0")
				open("/proc/stb/lcd/symbol_record_2", "w").write("0")
コード例 #25
0
ファイル: About.py プロジェクト: AmikoSH4/enigma2
	def populate(self):
		self["lab1"] = StaticText(_("Virtuosso Image Xtreme"))
		self["lab2"] = StaticText(_("By Team ViX"))
		model = None
		AboutText = ""
		self["lab3"] = StaticText(_("Support at") + " www.world-of-satellite.com")
		if getMachineBrand() == 'Vu+':
			self["lab3"] = StaticText(_("Support at") + " www.vuplus-support.com")
		elif getMachineBrand() == 'Xtrend':
			self["lab3"] = StaticText(_("Support at") + " www.xtrend-support.com")
		elif getMachineBrand() == 'Odin':
			self["lab3"] = StaticText(_("Support at") + " www.odin-support.com")

		AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName())

		if path.exists('/proc/stb/info/chipset'):
			AboutText += _("Chipset:\tBCM%s") % about.getChipSetString() + "\n"

		AboutText += _("CPU:\t%s") % about.getCPUString() + "\n"
		AboutText += _("Cores:\t%s") % about.getCpuCoresString() + "\n"

		AboutText += _("Version:\t%s") % getImageVersion() + "\n"
		AboutText += _("Build:\t%s") % getImageBuild() + "\n"
		AboutText += _("Kernel:\t%s") % about.getKernelVersionString() + "\n"

		string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))
		AboutText += _("Drivers:\t%s") % driversdate + "\n"

		AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n\n"

		fp_version = getFPVersion()
		if fp_version is None:
			fp_version = ""
		elif fp_version != 0:
			fp_version = _("Frontprocessor version: %d") % fp_version
			AboutText += fp_version + "\n"

		tempinfo = ""
		if path.exists('/proc/stb/sensors/temp0/value') and getBoxType() not in ('gbquad'):
			f = open('/proc/stb/sensors/temp0/value', 'r')
			tempinfo = f.read()
			f.close()
		elif path.exists('/proc/stb/fp/temp_sensor') and getBoxType() not in ('gbquad'):
			f = open('/proc/stb/fp/temp_sensor', 'r')
			tempinfo = f.read()
			f.close()
		if tempinfo and int(tempinfo.replace('\n', '')) > 0:
			mark = str('\xc2\xb0')
			AboutText += _("System temperature: %s") % tempinfo.replace('\n', '') + mark + "C\n\n"

		self["AboutScrollLabel"] = ScrollLabel(AboutText)
コード例 #26
0
ファイル: InputDevice.py プロジェクト: pe-tardo/dvbapp
	def setupConfigEntries(self,device):
		cmd = "config.inputDevices." + device + " = ConfigSubsection()"
		exec (cmd)
		if getBoxType() == 'dm800' or getBoxType() == 'azboxhd':
			cmd = "config.inputDevices." + device + ".enabled = ConfigYesNo(default = True)"
		else:
			cmd = "config.inputDevices." + device + ".enabled = ConfigYesNo(default = False)"
		exec (cmd)
		cmd = "config.inputDevices." + device + ".enabled.addNotifier(self.inputDevicesEnabledChanged,config.inputDevices." + device + ".enabled)"
		exec (cmd)
		cmd = "config.inputDevices." + device + '.name = ConfigText(default="")'
		exec (cmd)
		cmd = "config.inputDevices." + device + ".name.addNotifier(self.inputDevicesNameChanged,config.inputDevices." + device + ".name)"
		exec (cmd)
		if getBoxType() == 'odinm9' or getBoxType() == 'odinm7' or getBoxType() == 'odinm6':
			cmd = "config.inputDevices." + device + ".repeat = ConfigSlider(default=400, increment = 10, limits=(0, 500))"
		elif getBoxType() == 'azboxhd':
			cmd = "config.inputDevices." + device + ".repeat = ConfigSlider(default=150, increment = 10, limits=(0, 500))"
		else:
			cmd = "config.inputDevices." + device + ".repeat = ConfigSlider(default=100, increment = 10, limits=(0, 500))"
		exec (cmd)
		cmd = "config.inputDevices." + device + ".repeat.addNotifier(self.inputDevicesRepeatChanged,config.inputDevices." + device + ".repeat)"
		exec (cmd)
		if getBoxType() == 'odinm9' or getBoxType() == 'odinm7' or getBoxType() == 'odinm6':
			cmd = "config.inputDevices." + device + ".delay = ConfigSlider(default=200, increment = 100, limits=(0, 5000))"
		else:
			cmd = "config.inputDevices." + device + ".delay = ConfigSlider(default=700, increment = 100, limits=(0, 5000))"
		exec (cmd)
		cmd = "config.inputDevices." + device + ".delay.addNotifier(self.inputDevicesDelayChanged,config.inputDevices." + device + ".delay)"
		exec (cmd)
コード例 #27
0
ファイル: plugin.py プロジェクト: sklnet/opennfr-enigma2
def checkkernel():
    mycheck = 0
    boxname = getBoxType()
    print "boxtype=", boxname  
    if not fileExists('/media/usb'):
        os.system('mkdir /media/usb')
    if getBoxType() in ('sparktriplex', 'sparkone', 'sparkreloaded', 'arguspingulux', 'axodin', 'starsatlx', 'sf8', 'odinm7', 'odinm6', 'evoe3hd', 'xp1000', 'xp1000mk', 'uniboxhd1','uniboxhd2', 'uniboxhd3', 'uniboxhde', 'ini-1000de', 'xpeedlx2', 'xpeedlx1', 'atemio5x00', 'ini-9000de', 'xpeedlx3', 'ini-8000am', 'atemionemesis', 'iqonios300hd', 'vusolo', 'vuduo', 'vuuno', 'vuultimo', 'vusolo2', 'vuduo2', 'mutant2400', 'quadbox2400',):
       mycheck = 1
    else:
        mycheck = 0
    return mycheck
コード例 #28
0
ファイル: AVSwitch.py プロジェクト: openhdf/enigma2-wetek
    def setMode(self, port, mode, rate, force=None):
        print "[VideoMode] setMode - port: %s, mode: %s, rate: %s" % (port, mode, rate)

        # config.av.videoport.setValue(port)
        # we can ignore "port"
        self.current_mode = mode
        self.current_port = port
        modes = self.rates[mode][rate]

        mode_50 = modes.get(50)
        mode_60 = modes.get(60)
        if mode_50 is None or force == 60:
            mode_50 = mode_60
        if mode_60 is None or force == 50:
            mode_60 = mode_50

        mode_etc = None
        if os.path.exists("/proc/stb/video/videomode_50hz") and getBoxType() not in ("gb800solo", "gb800se", "gb800ue"):
            try:
                f = open("/proc/stb/video/videomode_50hz", "w")
                f.write(mode_50)
                f.close()
            except IOError:
                print "setting videomode_50hz failed."

        if os.path.exists("/proc/stb/video/videomode_60hz") and getBoxType() not in ("gb800solo", "gb800se", "gb800ue"):
            try:
                f = open("/proc/stb/video/videomode_60hz", "w")
                f.write(mode_60)
                f.close()
            except IOError:
                print "setting videomode failed."
        try:
            mode_etc = modes.get(int(rate[:2]))
            f = open("/proc/stb/video/videomode", "w")
            f.write(mode_etc)
            f.close()
        except:  # not support 50Hz, 60Hz for 1080p
            try:
                # fallback if no possibility to setup 50/60 hz mode
                f = open("/proc/stb/video/videomode", "w")
                f.write(mode_50)
                f.close()
            except IOError:
                print "setting videomode failed."

        map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
        self.setColorFormat(map[config.av.colorformat.value])

        if about.getCPUString().startswith("STx"):
            # call setResolution() with -1,-1 to read the new scrren dimensions without changing the framebuffer resolution
            from enigma import gMainDC

            gMainDC.getInstance().setResolution(-1, -1)
コード例 #29
0
ファイル: LcdPicon.py プロジェクト: n3wb13/OpenNfrGui-5.0-1
def onMountpointRemoved(mountpoint):
	global searchPaths
	if getBoxType() == 'vuultimo' or getBoxType() == 'quadbox2400' or getMachineProcModel().startswith("ini-90") or getMachineProcModel().startswith("ini-80"):
		path = os.path.join(mountpoint, 'usr/share/enigma2/piconlcd') + '/'
	else:
		path = os.path.join(mountpoint, 'picon') + '/'
	try:
		searchPaths.remove(path)
		print "[LcdPicon] removed path:", path
	except:
		pass
コード例 #30
0
ファイル: AVSwitch.py プロジェクト: nicorobot/enigma2
	def setColorFormat(configElement):
		if config.av.videoport and config.av.videoport.value in ("YPbPr", "Scart-YPbPr"):
			iAVSwitch.setColorFormat(3)
		else:
			if getBoxType() == 'et6x00':
				map = {"cvbs": 3, "rgb": 3, "svideo": 2, "yuv": 3}	
			elif getBoxType() == 'gbquad' or getBoxType() == 'gbquadplus' or getBoxType().startswith('et'):
				map = {"cvbs": 0, "rgb": 3, "svideo": 2, "yuv": 3}
			else:
				map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
			iAVSwitch.setColorFormat(map[configElement.value])
コード例 #31
0
	pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU)
	for p in pluginlist:
		redSelection.append((p.name, _(p.name)))
	if getBoxType() == "dm800":
		config.plugins.infopanel_redpanel.selection = ConfigSelection(redSelection, default='0')
		config.plugins.infopanel_redpanel.selectionLong = ConfigSelection(redSelection, default='1')
	else:
		config.plugins.infopanel_redpanel.selection = ConfigSelection(redSelection, default='1')
		config.plugins.infopanel_redpanel.selectionLong = ConfigSelection(redSelection, default='2')
timer = eTimer()
timer.timeout.get().append(timerEvent)
timer.startLongTimer(1)

choicelist = [('0',_("Audio Selection")),('1',_("Default (Timeshift)")), ('2',_("Toggle Pillarbox <> Pan&Scan")),('3',_("Teletext"))]
config.plugins.infopanel_yellowkey = ConfigSubsection()
if getBoxType() == "dm800":
	config.plugins.infopanel_yellowkey.list = ConfigSelection(default='1', choices = choicelist)
	config.plugins.infopanel_yellowkey.listLong = ConfigSelection(default='1', choices = choicelist)
else:
	config.plugins.infopanel_yellowkey.list = ConfigSelection(default='0', choices = choicelist)
	config.plugins.infopanel_yellowkey.listLong = ConfigSelection(default='0', choices = choicelist)
config.plugins.showinfopanelextensions = ConfigYesNo(default=False)
config.plugins.infopanel_frozencheck = ConfigSubsection()
config.plugins.infopanel_frozencheck.list = ConfigSelection([('0',_("Off")),('1',_("1 min.")), ('5',_("5 min.")),('10',_("10 min.")),('15',_("15 min.")),('30',_("30 min."))])
	
if os.path.isfile("/usr/lib/enigma2/python/Plugins/Extensions/MultiQuickButton/plugin.pyo") is True:
	try:
		from Plugins.Extensions.MultiQuickButton.plugin import *
	except:
		pass
コード例 #32
0
def InitLcd():
    if getBoxType() in ('et4x00', 'et5x00', 'et6x00', 'gb800se', 'gb800solo',
                        'iqonios300hd', 'mbmicro', 'sf128', 'sf138',
                        'tmsingle', 'tmnano2super', 'tmnanose', 'tmnanoseplus',
                        'tmnanosem2', 'tmnanosem2plus', 'tmnanosecombo',
                        'vusolo'):
        detected = False
    else:
        detected = eDBoxLCD.getInstance().detected()

    ilcd = LCD()

    SystemInfo["Display"] = detected
    config.lcd = ConfigSubsection()

    if fileExists("/proc/stb/lcd/mode"):
        f = open("/proc/stb/lcd/mode", "r")
        can_lcdmodechecking = f.read().strip().split(" ")
        print 'LCDMiniTV', can_lcdmodechecking
        f.close()
    else:
        can_lcdmodechecking = False

    if SystemInfo["PowerLed"]:

        def setPowerLEDstate(configElement):
            if fileExists("/proc/stb/power/powerled"):
                f = open("/proc/stb/power/powerled", "w")
                f.write(configElement.value)
                f.close()

        config.lcd.powerled = ConfigSelection(default="on",
                                              choices=[("off", _("Off")),
                                                       ("on", _("On"))])
        config.lcd.powerled.addNotifier(setPowerLEDstate)

    if SystemInfo["StandbyLED"]:

        def setPowerLEDstanbystate(configElement):
            if fileExists("/proc/stb/power/standbyled"):
                f = open("/proc/stb/power/standbyled", "w")
                f.write(configElement.value)
                f.close()

        config.lcd.standbyLED = ConfigSelection(default="on",
                                                choices=[("off", _("Off")),
                                                         ("on", _("On"))])
        config.lcd.standbyLED.addNotifier(setPowerLEDstanbystate)

    if SystemInfo["SuspendLED"]:

        def setPowerLEDdeepstanbystate(configElement):
            if fileExists("/proc/stb/power/suspendled"):
                f = open("/proc/stb/power/suspendled", "w")
                f.write(configElement.value)
                f.close()

        config.lcd.suspendLED = ConfigSelection(default="on",
                                                choices=[("off", _("Off")),
                                                         ("on", _("On"))])
        config.lcd.suspendLED.addNotifier(setPowerLEDdeepstanbystate)

    if SystemInfo["LedPowerColor"]:

        def setLedPowerColor(configElement):
            f = open("/proc/stb/fp/ledpowercolor", "w")
            f.write(configElement.value)
            f.close()

        config.lcd.ledpowercolor = ConfigSelection(default="1",
                                                   choices=[("0", _("off")),
                                                            ("1", _("blue")),
                                                            ("2", _("red")),
                                                            ("3", _("violet"))
                                                            ])
        config.lcd.ledpowercolor.addNotifier(setLedPowerColor)

    if SystemInfo["LedStandbyColor"]:

        def setLedStandbyColor(configElement):
            f = open("/proc/stb/fp/ledstandbycolor", "w")
            f.write(configElement.value)
            f.close()

        config.lcd.ledstandbycolor = ConfigSelection(default="3",
                                                     choices=[("0", _("off")),
                                                              ("1", _("blue")),
                                                              ("2", _("red")),
                                                              ("3",
                                                               _("violet"))])
        config.lcd.ledstandbycolor.addNotifier(setLedStandbyColor)

    if SystemInfo["LedSuspendColor"]:

        def setLedSuspendColor(configElement):
            f = open("/proc/stb/fp/ledsuspendledcolor", "w")
            f.write(configElement.value)
            f.close()

        config.lcd.ledsuspendcolor = ConfigSelection(default="2",
                                                     choices=[("0", _("off")),
                                                              ("1", _("blue")),
                                                              ("2", _("red")),
                                                              ("3",
                                                               _("violet"))])
        config.lcd.ledsuspendcolor.addNotifier(setLedSuspendColor)

    if SystemInfo["Power24x7On"]:

        def setPower24x7On(configElement):
            f = open("/proc/stb/fp/power4x7on", "w")
            f.write(configElement.value)
            f.close()

        config.lcd.power24x7on = ConfigSelection(default="on",
                                                 choices=[("off", _("Off")),
                                                          ("on", _("On"))])
        config.lcd.power24x7on.addNotifier(setPower24x7On)

    if SystemInfo["Power24x7Standby"]:

        def setPower24x7Standby(configElement):
            f = open("/proc/stb/fp/power4x7standby", "w")
            f.write(configElement.value)
            f.close()

        config.lcd.power24x7standby = ConfigSelection(default="off",
                                                      choices=[
                                                          ("off", _("Off")),
                                                          ("on", _("On"))
                                                      ])
        config.lcd.power24x7standby.addNotifier(setPower24x7Standby)

    if SystemInfo["Power24x7Suspend"]:

        def setPower24x7Suspend(configElement):
            f = open("/proc/stb/fp/power4x7suspend", "w")
            f.write(configElement.value)
            f.close()

        config.lcd.power24x7suspend = ConfigSelection(default="off",
                                                      choices=[
                                                          ("off", _("Off")),
                                                          ("on", _("On"))
                                                      ])
        config.lcd.power24x7suspend.addNotifier(setPower24x7Suspend)

    if SystemInfo["LEDButtons"]:

        def setLEDnormalstate(configElement):
            ilcd.setLEDNormalState(configElement.value)

        def setLEDdeepstandby(configElement):
            ilcd.setLEDDeepStandbyState(configElement.value)

        def setLEDblinkingtime(configElement):
            ilcd.setLEDBlinkingTime(configElement.value)

        config.lcd.ledblinkingtime = ConfigSlider(default=5,
                                                  increment=1,
                                                  limits=(0, 15))
        config.lcd.ledblinkingtime.addNotifier(setLEDblinkingtime)
        config.lcd.ledbrightnessdeepstandby = ConfigSlider(default=1,
                                                           increment=1,
                                                           limits=(0, 15))
        config.lcd.ledbrightnessdeepstandby.addNotifier(setLEDnormalstate)
        config.lcd.ledbrightnessdeepstandby.addNotifier(setLEDdeepstandby)
        config.lcd.ledbrightnessdeepstandby.apply = lambda: setLEDdeepstandby(
            config.lcd.ledbrightnessdeepstandby)
        config.lcd.ledbrightnessstandby = ConfigSlider(default=1,
                                                       increment=1,
                                                       limits=(0, 15))
        config.lcd.ledbrightnessstandby.addNotifier(setLEDnormalstate)
        config.lcd.ledbrightnessstandby.apply = lambda: setLEDnormalstate(
            config.lcd.ledbrightnessstandby)
        config.lcd.ledbrightness = ConfigSlider(default=3,
                                                increment=1,
                                                limits=(0, 15))
        config.lcd.ledbrightness.addNotifier(setLEDnormalstate)
        config.lcd.ledbrightness.apply = lambda: setLEDnormalstate(
            config.lcd.ledbrightness)
        config.lcd.ledbrightness.callNotifiersOnSaveAndCancel = True

    if detected:
        config.lcd.scroll_speed = ConfigSelection(default="300",
                                                  choices=[("500", _("slow")),
                                                           ("300",
                                                            _("normal")),
                                                           ("100", _("fast"))])
        config.lcd.scroll_delay = ConfigSelection(
            default="10000",
            choices=[("10000", "10 " + _("seconds")),
                     ("20000", "20 " + _("seconds")),
                     ("30000", "30 " + _("seconds")),
                     ("60000", "1 " + _("minute")),
                     ("300000", "5 " + _("minutes")),
                     ("noscrolling", _("off"))])

        def setLCDbright(configElement):
            ilcd.setBright(configElement.value)

        def setLCDstandbybright(configElement):
            ilcd.setStandbyBright(configElement.value)

        def setLCDdimbright(configElement):
            ilcd.setDimBright(configElement.value)

        def setLCDdimdelay(configElement):
            ilcd.setDimDelay(configElement.value)

        def setLCDcontrast(configElement):
            ilcd.setContrast(configElement.value)

        def setLCDinverted(configElement):
            ilcd.setInverted(configElement.value)

        def setLCDflipped(configElement):
            ilcd.setFlipped(configElement.value)

        def setLCDmode(configElement):
            ilcd.setMode(configElement.value)

        def setLCDpower(configElement):
            ilcd.setPower(configElement.value)

        def setLCDminitvmode(configElement):
            ilcd.setLCDMiniTVMode(configElement.value)

        def setLCDminitvpipmode(configElement):
            ilcd.setLCDMiniTVPIPMode(configElement.value)

        def setLCDminitvfps(configElement):
            ilcd.setLCDMiniTVFPS(configElement.value)

        standby_default = 0

        if not ilcd.isOled():
            config.lcd.contrast = ConfigSlider(default=5, limits=(0, 20))
            config.lcd.contrast.addNotifier(setLCDcontrast)
        else:
            config.lcd.contrast = ConfigNothing()
            standby_default = 1

        config.lcd.standby = ConfigSlider(default=standby_default,
                                          limits=(0, 10))
        config.lcd.standby.addNotifier(setLCDbright)
        config.lcd.standby.apply = lambda: setLCDbright(config.lcd.standby)

        config.lcd.bright = ConfigSlider(default=5, limits=(0, 10))
        config.lcd.bright.addNotifier(setLCDbright)
        config.lcd.bright.apply = lambda: setLCDbright(config.lcd.bright)
        config.lcd.bright.callNotifiersOnSaveAndCancel = True

        config.lcd.dimbright = ConfigSlider(default=standby_default,
                                            limits=(0, 10))
        config.lcd.dimbright.addNotifier(setLCDdimbright)
        config.lcd.dimbright.apply = lambda: setLCDdimbright(config.lcd.
                                                             dimbright)
        config.lcd.dimdelay = ConfigSelection(default="0",
                                              choices=[
                                                  ("5", "5 " + _("seconds")),
                                                  ("10", "10 " + _("seconds")),
                                                  ("15", "15 " + _("seconds")),
                                                  ("20", "20 " + _("seconds")),
                                                  ("30", "30 " + _("seconds")),
                                                  ("60", "1 " + _("minute")),
                                                  ("120", "2 " + _("minutes")),
                                                  ("300", "5 " + _("minutes")),
                                                  ("0", _("off"))
                                              ])
        config.lcd.dimdelay.addNotifier(setLCDdimdelay)

        config.lcd.invert = ConfigYesNo(default=False)
        config.lcd.invert.addNotifier(setLCDinverted)

        def PiconPackChanged(configElement):
            configElement.save()

        config.lcd.picon_pack = ConfigYesNo(default=False)
        config.lcd.picon_pack.addNotifier(PiconPackChanged)

        config.lcd.flip = ConfigYesNo(default=False)
        config.lcd.flip.addNotifier(setLCDflipped)

        if SystemInfo["LcdPowerOn"]:
            config.lcd.power = ConfigSelection([("0", _("Off")),
                                                ("1", _("On"))], "1")
            config.lcd.power.addNotifier(setLCDpower)
        else:
            config.lcd.power = ConfigNothing()

        if SystemInfo["LcdLiveTV"]:

            def lcdLiveTvChanged(configElement):
                setLCDLiveTv(configElement.value)
                configElement.save()

            config.lcd.showTv = ConfigYesNo(default=False)
            config.lcd.showTv.addNotifier(lcdLiveTvChanged)

            if "live_enable" in SystemInfo["LcdLiveTV"]:
                config.misc.standbyCounter.addNotifier(
                    standbyCounterChangedLCDLiveTV, initial_call=False)

        if SystemInfo["LCDMiniTV"] and getBoxType() not in ('gbquad4k',
                                                            'gbue4k'):
            config.lcd.minitvmode = ConfigSelection(
                [("0", _("normal")), ("1", _("MiniTV")), ("2", _("OSD")),
                 ("3", _("MiniTV with OSD"))], "0")
            config.lcd.minitvmode.addNotifier(setLCDminitvmode)
            config.lcd.minitvpipmode = ConfigSelection(
                [("0", _("off")), ("5", _("PIP")),
                 ("7", _("PIP with OSD"))], "0")
            config.lcd.minitvpipmode.addNotifier(setLCDminitvpipmode)
            config.lcd.minitvfps = ConfigSlider(default=30, limits=(0, 30))
            config.lcd.minitvfps.addNotifier(setLCDminitvfps)
        elif can_lcdmodechecking and getBoxType() in ('gbquad4k', 'gbue4k'):
            #  (0:normal, 1:video0, 2:fb, 3:vide0+fb, 4:video1, 5:vide0+video1, 6:video1+fb, 7:video0+video1+fb)
            config.lcd.minitvmode = ConfigSelection(
                default="0",
                choices=[("0", _("normal")),
                         ("1", _("MiniTV") + _(" - video0")),
                         ("3", _("MiniTV with OSD") + _(" - video0")),
                         ("2", _("OSD")), ("4", _("MiniTV") + _(" - video1")),
                         ("6", _("MiniTV with OSD") + _(" - video1")),
                         ("5", _("MiniTV") + _(" - video0+video1")),
                         ("7", _("MiniTV with OSD") + _(" - video0+video1"))])
            config.lcd.minitvmode.addNotifier(setLCDminitvmode)
            config.lcd.minitvpipmode = ConfigSelection(default="0",
                                                       choices=[
                                                           ("0", _("off")),
                                                           ("4", _("PIP")),
                                                           ("6",
                                                            _("PIP with OSD"))
                                                       ])
            config.lcd.minitvpipmode.addNotifier(setLCDminitvpipmode)
            config.lcd.minitvfps = ConfigSlider(default=30, limits=(0, 30))
            config.lcd.minitvfps.addNotifier(setLCDminitvfps)
        else:
            config.lcd.minitvmode = ConfigNothing()
            config.lcd.minitvpipmode = ConfigNothing()
            config.lcd.minitvfps = ConfigNothing()

        if SystemInfo["VFD_scroll_repeats"] and getDisplayType() not in (
                '7segment'):

            def scroll_repeats(el):
                open(SystemInfo["VFD_scroll_repeats"], "w").write(el.value)

            choicelist = [("0", _("None")), ("1", _("1X")), ("2", _("2X")),
                          ("3", _("3X")), ("4", _("4X")),
                          ("500", _("Continues"))]
            config.usage.vfd_scroll_repeats = ConfigSelection(
                default="3", choices=choicelist)
            config.usage.vfd_scroll_repeats.addNotifier(
                scroll_repeats, immediate_feedback=False)

        if SystemInfo["VFD_scroll_delay"] and getDisplayType() not in (
                '7segment'):

            def scroll_delay(el):
                open(SystemInfo["VFD_scroll_delay"], "w").write(str(el.value))

            config.usage.vfd_scroll_delay = ConfigSlider(default=150,
                                                         increment=10,
                                                         limits=(0, 500))
            config.usage.vfd_scroll_delay.addNotifier(scroll_delay,
                                                      immediate_feedback=False)

        if SystemInfo["VFD_initial_scroll_delay"] and getDisplayType() not in (
                '7segment'):

            def initial_scroll_delay(el):
                open(SystemInfo["VFD_initial_scroll_delay"],
                     "w").write(el.value)

            choicelist = [("10000", "10 " + _("seconds")),
                          ("20000", "20 " + _("seconds")),
                          ("30000", "30 " + _("seconds")),
                          ("0", _("no delay"))]
            config.usage.vfd_initial_scroll_delay = ConfigSelection(
                default="1000", choices=choicelist)
            config.usage.vfd_initial_scroll_delay.addNotifier(
                initial_scroll_delay, immediate_feedback=False)

        if SystemInfo["VFD_final_scroll_delay"] and getDisplayType() not in (
                '7segment'):

            def final_scroll_delay(el):
                open(SystemInfo["VFD_final_scroll_delay"], "w").write(el.value)

            choicelist = [("10000", "10 " + _("seconds")),
                          ("20000", "20 " + _("seconds")),
                          ("30000", "30 " + _("seconds")),
                          ("0", _("no delay"))]
            config.usage.vfd_final_scroll_delay = ConfigSelection(
                default="1000", choices=choicelist)
            config.usage.vfd_final_scroll_delay.addNotifier(
                final_scroll_delay, immediate_feedback=False)

        if fileExists("/proc/stb/lcd/show_symbols"):
            config.lcd.mode = ConfigSelection([("0", _("no")),
                                               ("1", _("yes"))], "1")
            config.lcd.mode.addNotifier(setLCDmode)
        else:
            config.lcd.mode = ConfigNothing()

    else:

        def doNothing():
            pass

        config.lcd.contrast = ConfigNothing()
        config.lcd.bright = ConfigNothing()
        config.lcd.standby = ConfigNothing()
        config.lcd.bright.apply = lambda: doNothing()
        config.lcd.standby.apply = lambda: doNothing()
        config.lcd.mode = ConfigNothing()
        config.lcd.power = ConfigNothing()
        config.lcd.ledbrightness = ConfigNothing()
        config.lcd.ledbrightness.apply = lambda: doNothing()
        config.lcd.ledbrightnessstandby = ConfigNothing()
        config.lcd.ledbrightnessstandby.apply = lambda: doNothing()
        config.lcd.ledbrightnessdeepstandby = ConfigNothing()
        config.lcd.ledbrightnessdeepstandby.apply = lambda: doNothing()
        config.lcd.ledblinkingtime = ConfigNothing()
        config.lcd.picon_pack = ConfigNothing()

    config.misc.standbyCounter.addNotifier(standbyCounterChanged,
                                           initial_call=False)
コード例 #33
0
    def __init__(self, wakeupData=None):
        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
        self.isRecordTimerImageStandard = False
        for p in plugins.getPlugins(PluginDescriptor.WHERE_RECORDTIMER):
            self.RecordTimer = p()
            if self.RecordTimer:
                break
        if not self.RecordTimer:
            self.RecordTimer = RecordTimer.RecordTimer()
            self.isRecordTimerImageStandard = True

        self.PowerTimer = None
        self.PowerTimer = PowerTimer.PowerTimer()
        self.__wasTimerWakeup = False
        self.__wasRecTimerWakeup = False
        self.__wasPowerTimerWakeup = False

        #wakeup data
        try:
            self.wakeuptime, self.timertime, self.wakeuptyp, self.getstandby, self.recordtime, self.forcerecord = [
                int(n) for n in wakeupData.split(',')
            ]
        except:
            print "=" * 100
            print "[NAVIGATION] ERROR: can't read wakeup data"
            self.wakeuptime, self.timertime, self.wakeuptyp, self.getstandby, self.recordtime, self.forcerecord = -1, -1, 0, 0, -1, 0
        #print ctime(self.wakeuptime), ctime(self.timertime), self.wakeuptyp, self.getstandby, ctime(self.recordtime), self.forcerecord
        now = time()
        self.wakeupwindow_plus = self.timertime + 300
        self.wakeupwindow_minus = self.wakeuptime - (
            config.workaround.wakeupwindow.value * 60)
        self.syncCount = 0

        wasTimerWakeup, wasTimerWakeup_failure = getFPWasTimerWakeup(True)
        #TODO: verify wakeup-state for boxes where only after shutdown removed the wakeup-state (for boxes where "/proc/stb/fp/was_timer_wakeup" is not writable (clearFPWasTimerWakeup() in StbHardware.py has no effect -> after x hours and restart/reboot is wasTimerWakeup = True)

        print "=" * 100
        if self.wakeuptime > 0:
            print "[NAVIGATION] wakeup time from deep-standby expected: *** %s ***" % (
                ctime(self.wakeuptime))
            print "[NAVIGATION] timer wakeup detection window: %s - %s" % (
                ctime(self.wakeupwindow_minus), ctime(self.wakeupwindow_plus))
            print "-" * 100
        thisBox = getBoxType()
        if not config.workaround.deeprecord.value and (
                wasTimerWakeup_failure or thisBox in
            ('ixussone', 'uniboxhd1', 'uniboxhd2', 'uniboxhd3', 'sezam5000hd',
             'mbtwin', 'beyonwizt3', 'et8000') or getBrandOEM()
                in ('ebox', 'azbox', 'xp', 'ini', 'fulan', 'entwopia')
                or getMachineBuild() in ('dags7335', 'dags7356', 'dags7362')):
            print "[NAVIGATION] FORCED DEEPSTANDBY-WORKAROUND FOR THIS BOXTYPE (%s)" % thisBox
            config.workaround.deeprecord.setValue(True)
            config.workaround.deeprecord.save()
            config.save()

        if config.workaround.deeprecord.value:  #work-around for boxes where driver not sent was_timer_wakeup signal to e2
            wasTimerWakeup = False
            print "[NAVIGATION] starting deepstandby-workaround"
            if now <= 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"
                print "~" * 100
            elif now >= self.wakeupwindow_minus and now <= self.wakeupwindow_plus:  # if there is a recording sheduled, set the wasTimerWakeup flag
                wasTimerWakeup = True
                f = open("/tmp/was_timer_wakeup_workaround.txt", "w")
                file = f.write(str(wasTimerWakeup))
                f.close()

        print "[NAVIGATION] was timer wakeup = %s" % wasTimerWakeup
        print "[NAVIGATION] current time is %s" % ctime(now)

        if wasTimerWakeup:
            self.__wasTimerWakeup = True
            print "-" * 100
            if self.wakeuptime > 0:
                print "[NAVIGATION] wakeup time was %s" % ctime(
                    self.wakeuptime)
            else:
                print "[NAVIGATION] wakeup time was not set"
            if now <= 31536000:
                self.timesynctimer = eTimer()
                self.timesynctimer.callback.append(self.TimeSynctimer)
                self.timesynctimer.start(5000, True)
                print "[NAVIGATION] wait for time sync"
                print "~" * 100
            else:
                self.wakeupCheck()
        else:
            if now > 31536000:
                if self.timertime > 0:
                    print "[NAVIGATION] next '%s' starts at %s" % (
                        {
                            0: "record-timer",
                            1: "zap-timer",
                            2: "power-timer",
                            3: "plugin-timer"
                        }[self.wakeuptyp], ctime(self.timertime))
                else:
                    print "[NAVIGATION] no next timers"
                print "=" * 100
コード例 #34
0
ファイル: HardwareInfo.py プロジェクト: VytenisP/enigma2-3
 def has_hdmi(self):
     return getBrandOEM() in (
         'xtrend', 'gigablue', 'dags', 'ixuss', 'odin', 'vuplus', 'ini',
         'ebox', 'ceryon') or (getBoxType() in ('dm7020hd', 'dm800se',
                                                'dm500hd', 'dm8000')
                               and HardwareInfo.device_version is not None)
コード例 #35
0
ファイル: ImageBackup.py プロジェクト: mike-99/enigma2
	def __init__(self, session, args = 0):
		Screen.__init__(self, session)
		self.session = session
		self.selection = 0
		self.MODEL = getBoxType()
		self.OEM = getBrandOEM()
		self.MACHINEBUILD = getMachineBuild()
		self.MACHINENAME = getMachineName()
		self.MACHINEBRAND = getMachineBrand()
		self.IMAGEFOLDER = getImageFolder()
		self.UBINIZE_ARGS = getMachineUBINIZE()
		self.MKUBIFS_ARGS = getMachineMKUBIFS()
		self.MTDKERNEL = getMachineMtdKernel()
		self.MTDROOTFS = getMachineMtdRoot()
		self.ROOTFSBIN = getMachineRootFile()
		self.KERNELBIN = getMachineKernelFile()
		self.ROOTFSTYPE = getImageFileSystem().strip()

		if self.MACHINEBUILD in ("hd51","vs1500","h7","8100s"):
			self.MTDBOOT = "mmcblk0p1"
			self.EMMCIMG = "disk.img"
		elif self.MACHINEBUILD in ("xc7439","osmio4k"):
			self.MTDBOOT = "mmcblk1p1"
			self.EMMCIMG = "emmc.img"
		elif self.MACHINEBUILD in ("gbmv200","cc1","sf8008","ustym4kpr"):
			self.MTDBOOT = "none"
			self.EMMCIMG = "usb_update.bin"
		elif self.MACHINEBUILD in ("h9combo","v8plus","multibox","hd60","hd61"):
			self.MTDBOOT = "none"
			self.EMMCIMG = "rootfs.fastboot.gz"
		else:
			self.MTDBOOT = "none"
			self.EMMCIMG = "none"

		print "[FULL BACKUP] BOX MACHINEBUILD = >%s<" %self.MACHINEBUILD
		print "[FULL BACKUP] BOX MACHINENAME = >%s<" %self.MACHINENAME
		print "[FULL BACKUP] BOX MACHINEBRAND = >%s<" %self.MACHINEBRAND
		print "[FULL BACKUP] BOX MODEL = >%s<" %self.MODEL
		print "[FULL BACKUP] OEM MODEL = >%s<" %self.OEM
		print "[FULL BACKUP] IMAGEFOLDER = >%s<" %self.IMAGEFOLDER
		print "[FULL BACKUP] UBINIZE = >%s<" %self.UBINIZE_ARGS
		print "[FULL BACKUP] MKUBIFS = >%s<" %self.MKUBIFS_ARGS
		print "[FULL BACKUP] MTDBOOT = >%s<" %self.MTDBOOT
		print "[FULL BACKUP] MTDKERNEL = >%s<" %self.MTDKERNEL
		print "[FULL BACKUP] MTDROOTFS = >%s<" %self.MTDROOTFS
		print "[FULL BACKUP] ROOTFSBIN = >%s<" %self.ROOTFSBIN
		print "[FULL BACKUP] KERNELBIN = >%s<" %self.KERNELBIN
		print "[FULL BACKUP] ROOTFSTYPE = >%s<" %self.ROOTFSTYPE
		print "[FULL BACKUP] EMMCIMG = >%s<" %self.EMMCIMG

		self.error_files = ''
		self.list = self.list_files("/boot")
		self["key_green"] = StaticText("USB")
		self["key_red"] = StaticText("HDD")
		self["key_blue"] = StaticText(_("Exit"))
		if SystemInfo["HaveMultiBoot"]:
			self["key_yellow"] = StaticText(_("STARTUP"))
			self["info-multi"] = Label(_("You can select with yellow the OnlineFlash Image\n or select Recovery to create a USB Disk Image for clean Install."))
			self.read_current_multiboot()
		else:
			self["key_yellow"] = StaticText("")
			self["info-multi"] = Label(" ")
		self["info-usb"] = Label(_("USB = Do you want to make a back-up on USB?\nThis will take between 3 and 15 minutes depending on the used filesystem and is fully automatic.\nMake sure you first insert a USB flash drive before you select USB."))
		self["info-hdd"] = Label(_("HDD = Do you want to make a USB-back-up image on HDD? \nThis only takes 1 or 10 minutes and is fully automatic."))
		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], 
		{
			"blue": self.quit,
			"yellow": self.yellow,
			"green": self.green,
			"red": self.red,
			"cancel": self.quit,
		}, -2)
		self.onShown.append(self.show_Errors)
コード例 #36
0
ファイル: AVSwitch.py プロジェクト: popazerty/e2_sh4
def InitAVSwitch():
    config.av.yuvenabled = ConfigBoolean(default=True)
    colorformat_choices = {
        "cvbs": _("CVBS"),
        "rgb": _("RGB"),
        "svideo": _("S-Video")
    }
    # when YUV is not enabled, don't let the user select it
    if config.av.yuvenabled.value:
        colorformat_choices["yuv"] = _("YPbPr")

    config.av.autores = ConfigSelection(choices={
        "disabled": _("Disabled"),
        "all": _("All resolutions"),
        "hd": _("only HD")
    },
                                        default="disabled")
    choicelist = []
    for i in range(5, 16):
        choicelist.append(
            ("%d" % i, ngettext("%d second", "%d seconds", i) % i))
    config.av.autores_label_timeout = ConfigSelection(
        default="5", choices=[("0", _("Not Shown"))] + choicelist)
    config.av.autores_delay = ConfigSelectionNumber(min=0,
                                                    max=15000,
                                                    stepwidth=500,
                                                    default=500,
                                                    wraparound=True)
    config.av.autores_deinterlace = ConfigYesNo(default=False)
    config.av.autores_sd = ConfigSelection(choices={
        "720p": _("720p"),
        "1080i": _("1080i")
    },
                                           default="720p")
    config.av.autores_480p24 = ConfigSelection(choices={
        "480p24": _("480p 24Hz"),
        "720p24": _("720p 24Hz"),
        "1080p24": _("1080p 24Hz")
    },
                                               default="1080p24")
    config.av.autores_720p24 = ConfigSelection(choices={
        "720p24": _("720p 24Hz"),
        "1080p24": _("1080p 24Hz")
    },
                                               default="1080p24")
    config.av.autores_1080p24 = ConfigSelection(choices={
        "1080p24": _("1080p 24Hz"),
        "1080p25": _("1080p 25Hz")
    },
                                                default="1080p24")
    config.av.autores_1080p25 = ConfigSelection(choices={
        "1080p25": _("1080p 25Hz"),
        "1080p50": _("1080p 50Hz")
    },
                                                default="1080p25")
    config.av.autores_1080p30 = ConfigSelection(choices={
        "1080p30": _("1080p 30Hz"),
        "1080p60": _("1080p 60Hz")
    },
                                                default="1080p30")
    config.av.colorformat = ConfigSelection(choices=colorformat_choices,
                                            default="rgb")
    config.av.aspectratio = ConfigSelection(choices={
        "4_3_letterbox":
        _("4:3 Letterbox"),
        "4_3_panscan":
        _("4:3 PanScan"),
        "16_9":
        _("16:9"),
        "16_9_always":
        _("16:9 always"),
        "16_10_letterbox":
        _("16:10 Letterbox"),
        "16_10_panscan":
        _("16:10 PanScan"),
        "16_9_letterbox":
        _("16:9 Letterbox")
    },
                                            default="16_9")
    config.av.aspect = ConfigSelection(choices={
        "4:3": _("4:3"),
        "16:9": _("16:9"),
        "16:10": _("16:10"),
        "auto": _("Automatic")
    },
                                       default="16:9")
    policy2_choices = {
        # TRANSLATORS: (aspect ratio policy: black bars on top/bottom) in doubt, keep english term.
        "letterbox": _("Letterbox"),
        # TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term
        "panscan": _("Pan&scan"),
        # TRANSLATORS: (aspect ratio policy: display as fullscreen, even if this breaks the aspect)
        "scale": _("Just scale")
    }
    if os.path.exists("/proc/stb/video/policy2_choices"):
        f = open("/proc/stb/video/policy2_choices")
        if "auto" in f.readline():
            # TRANSLATORS: (aspect ratio policy: always try to display as fullscreen, when there is no content (black bars) on left/right, even if this breaks the aspect.
            policy2_choices.update({"auto": _("Auto")})
        f.close()
    config.av.policy_169 = ConfigSelection(choices=policy2_choices,
                                           default="letterbox")
    policy_choices = {
        # TRANSLATORS: (aspect ratio policy: black bars on left/right) in doubt, keep english term.
        "panscan": _("Pillarbox"),
        # TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term
        "letterbox": _("Pan&scan"),
        # TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching the left/right)
        # "nonlinear": _("Nonlinear"),
        # TRANSLATORS: (aspect ratio policy: display as fullscreen, even if this breaks the aspect)
        "bestfit": _("Just scale")
    }
    if os.path.exists("/proc/stb/video/policy_choices"):
        f = open("/proc/stb/video/policy_choices")
        if "auto" in f.readline():
            # TRANSLATORS: (aspect ratio policy: always try to display as fullscreen, when there is no content (black bars) on left/right, even if this breaks the aspect.
            policy_choices.update({"auto": _("Auto")})
        f.close()
    config.av.policy_43 = ConfigSelection(choices=policy_choices,
                                          default="panscan")
    config.av.tvsystem = ConfigSelection(choices={
        "pal": _("PAL"),
        "ntsc": _("NTSC"),
        "multinorm": _("multinorm")
    },
                                         default="pal")
    config.av.wss = ConfigEnableDisable(default=True)
    config.av.generalAC3delay = ConfigSelectionNumber(-1000,
                                                      1000,
                                                      5,
                                                      default=0)
    config.av.generalPCMdelay = ConfigSelectionNumber(-1000,
                                                      1000,
                                                      5,
                                                      default=0)
    config.av.vcrswitch = ConfigEnableDisable(default=False)

    config.av.aspect.setValue('16:9')
    config.av.aspect.addNotifier(iAVSwitch.setAspect)
    config.av.wss.addNotifier(iAVSwitch.setWss)
    config.av.policy_43.addNotifier(iAVSwitch.setPolicy43)
    config.av.policy_169.addNotifier(iAVSwitch.setPolicy169)

    def setColorFormat(configElement):
        if config.av.videoport and config.av.videoport.value in (
                "YPbPr", "Scart-YPbPr"):
            iAVSwitch.setColorFormat(3)
        else:
            map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
            iAVSwitch.setColorFormat(map[configElement.value])

    config.av.colorformat.addNotifier(setColorFormat)

    def setAspectRatio(configElement):
        map = {
            "4_3_letterbox": 0,
            "4_3_panscan": 1,
            "16_9": 2,
            "16_9_always": 3,
            "16_10_letterbox": 4,
            "16_10_panscan": 5,
            "16_9_letterbox": 6
        }
        iAVSwitch.setAspectRatio(map[configElement.value])

    iAVSwitch.setInput("ENCODER")  # init on startup
    SystemInfo["ScartSwitch"] = eAVSwitch.getInstance().haveScartSwitch()

    if os.path.exists("/proc/stb/hdmi/bypass_edid_checking"):
        f = open("/proc/stb/hdmi/bypass_edid_checking", "r")
        can_edidchecking = f.read().strip().split(" ")
        f.close()
    else:
        can_edidchecking = False

    SystemInfo["Canedidchecking"] = can_edidchecking

    if can_edidchecking:

        def setEDIDBypass(configElement):
            try:
                f = open("/proc/stb/hdmi/bypass_edid_checking", "w")
                f.write(configElement.value)
                f.close()
            except:
                pass

        config.av.bypass_edid_checking = ConfigSelection(choices={
            "00000000": _("off"),
            "00000001": _("on")
        },
                                                         default="00000001")
        config.av.bypass_edid_checking.addNotifier(setEDIDBypass)
    else:
        config.av.bypass_edid_checking = ConfigNothing()

    if os.path.exists("/proc/stb/audio/3d_surround_choices"):
        f = open("/proc/stb/audio/3d_surround_choices", "r")
        can_3dsurround = f.read().strip().split(" ")
        f.close()
    else:
        can_3dsurround = False

    SystemInfo["Can3DSurround"] = can_3dsurround

    if can_3dsurround:

        def set3DSurround(configElement):
            f = open("/proc/stb/audio/3d_surround", "w")
            f.write(configElement.value)
            f.close()

        choice_list = [("none", _("off")), ("hdmi", _("HDMI")),
                       ("spdif", _("SPDIF")), ("dac", _("DAC"))]
        config.av.surround_3d = ConfigSelection(choices=choice_list,
                                                default="none")
        config.av.surround_3d.addNotifier(set3DSurround)
    else:
        config.av.surround_3d = ConfigNothing()

    if os.path.exists("/proc/stb/audio/3d_surround_speaker_position_choices"):
        f = open("/proc/stb/audio/3d_surround_speaker_position_choices", "r")
        can_3dsurround_speaker = f.read().strip().split(" ")
        f.close()
    else:
        can_3dsurround_speaker = False

    SystemInfo["Can3DSpeaker"] = can_3dsurround_speaker

    if can_3dsurround_speaker:

        def set3DSurroundSpeaker(configElement):
            f = open("/proc/stb/audio/3d_surround_speaker_position", "w")
            f.write(configElement.value)
            f.close()

        choice_list = [("center", _("center")), ("wide", _("wide")),
                       ("extrawide", _("extra wide"))]
        config.av.surround_3d_speaker = ConfigSelection(choices=choice_list,
                                                        default="center")
        config.av.surround_3d_speaker.addNotifier(set3DSurroundSpeaker)
    else:
        config.av.surround_3d_speaker = ConfigNothing()

    if os.path.exists("/proc/stb/audio/avl_choices"):
        f = open("/proc/stb/audio/avl_choices", "r")
        can_autovolume = f.read().strip().split(" ")
        f.close()
    else:
        can_autovolume = False

    SystemInfo["CanAutoVolume"] = can_autovolume

    if can_autovolume:

        def setAutoVolume(configElement):
            f = open("/proc/stb/audio/avl", "w")
            f.write(configElement.value)
            f.close()

        choice_list = [("none", _("off")), ("hdmi", _("HDMI")),
                       ("spdif", _("SPDIF")), ("dac", _("DAC"))]
        config.av.autovolume = ConfigSelection(choices=choice_list,
                                               default="none")
        config.av.autovolume.addNotifier(setAutoVolume)
    else:
        config.av.autovolume = ConfigNothing()

    try:
        can_pcm_multichannel = os.access("/proc/stb/audio/multichannel_pcm",
                                         os.W_OK)
    except:
        can_pcm_multichannel = False

    SystemInfo["supportPcmMultichannel"] = can_pcm_multichannel
    if can_pcm_multichannel:

        def setPCMMultichannel(configElement):
            open("/proc/stb/audio/multichannel_pcm",
                 "w").write(configElement.value and "enable" or "disable")

        config.av.pcm_multichannel = ConfigYesNo(default=False)
        config.av.pcm_multichannel.addNotifier(setPCMMultichannel)

    try:
        f = open("/proc/stb/audio/ac3_choices", "r")
        file = f.read()[:-1]
        f.close()
        can_downmix_ac3 = "downmix" in file
    except:
        can_downmix_ac3 = False

    SystemInfo["CanDownmixAC3"] = can_downmix_ac3
    if can_downmix_ac3:

        def setAC3Downmix(configElement):
            f = open("/proc/stb/audio/ac3", "w")
            f.write(configElement.value and "downmix" or "passthrough")
            f.close()
            if SystemInfo.get("supportPcmMultichannel",
                              False) and not configElement.value:
                SystemInfo["CanPcmMultichannel"] = True
            else:
                SystemInfo["CanPcmMultichannel"] = False
                if can_pcm_multichannel:
                    config.av.pcm_multichannel.setValue(False)

        config.av.downmix_ac3 = ConfigYesNo(default=True)
        config.av.downmix_ac3.addNotifier(setAC3Downmix)

    try:
        f = open("/proc/stb/audio/aac_choices", "r")
        file = f.read()[:-1]
        f.close()
        can_downmix_aac = "downmix" in file
    except:
        can_downmix_aac = False

    SystemInfo["CanDownmixAAC"] = can_downmix_aac
    if can_downmix_aac:

        def setAACDownmix(configElement):
            f = open("/proc/stb/audio/aac", "w")
            f.write(configElement.value and "downmix" or "passthrough")
            f.close()

        config.av.downmix_aac = ConfigYesNo(default=True)
        config.av.downmix_aac.addNotifier(setAACDownmix)

    if os.path.exists("/proc/stb/audio/aac_transcode_choices"):
        f = open("/proc/stb/audio/aac_transcode_choices", "r")
        can_aactranscode = f.read().strip().split(" ")
        f.close()
    else:
        can_aactranscode = False

    SystemInfo["CanAACTranscode"] = can_aactranscode

    if can_aactranscode:

        def setAACTranscode(configElement):
            f = open("/proc/stb/audio/aac_transcode", "w")
            f.write(configElement.value)
            f.close()

        choice_list = [("off", _("off")), ("ac3", _("AC3")), ("dts", _("DTS"))]
        config.av.transcodeaac = ConfigSelection(choices=choice_list,
                                                 default="off")
        config.av.transcodeaac.addNotifier(setAACTranscode)
    else:
        config.av.transcodeaac = ConfigNothing()

    if os.path.exists("/proc/stb/vmpeg/0/pep_scaler_sharpness"):

        def setScaler_sharpness(config):
            myval = int(config.value)
            try:
                print "[VideoMode] setting scaler_sharpness to: %0.8X" % myval
                f = open("/proc/stb/vmpeg/0/pep_scaler_sharpness", "w")
                f.write("%0.8X" % myval)
                f.close()
                f = open("/proc/stb/vmpeg/0/pep_apply", "w")
                f.write("1")
                f.close()
            except IOError:
                print "couldn't write pep_scaler_sharpness"

        if getBoxType() in ('gbquad', 'gbquadplus'):
            config.av.scaler_sharpness = ConfigSlider(default=5,
                                                      limits=(0, 26))
        else:
            config.av.scaler_sharpness = ConfigSlider(default=13,
                                                      limits=(0, 26))
        config.av.scaler_sharpness.addNotifier(setScaler_sharpness)
    else:
        config.av.scaler_sharpness = NoSave(ConfigNothing())

    config.av.edid_override = ConfigYesNo(default=False)

    iAVSwitch.setConfiguredMode()
コード例 #37
0
	SystemInfo["CI%dRelevantPidsRoutingSupport" % cislot] = fileCheck("/proc/stb/tsmux/ci%d_relevant_pids_routing"  % cislot)

SystemInfo["NumVideoDecoders"] = getNumVideoDecoders()
SystemInfo["Udev"] = not fileExists("/dev/.devfsd")
SystemInfo["PIPAvailable"] = getMachineBuild() not in ("i55plus") and SystemInfo["NumVideoDecoders"] > 1
SystemInfo["CanMeasureFrontendInputPower"] = eDVBResourceManager.getInstance().canMeasureFrontendInputPower()
SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output()
SystemInfo["FrontpanelDisplay"] = fileExists("/dev/dbox/oled0") or fileExists("/dev/dbox/lcd0")
SystemInfo["7segment"] = getDisplayType() in ('7segment')
SystemInfo["ConfigDisplay"] = SystemInfo["FrontpanelDisplay"] and getDisplayType() not in ('7segment')
SystemInfo["LCDSKINSetup"] = pathExists("/usr/share/enigma2/display") and not SystemInfo["7segment"]
SystemInfo["ZapMode"] = fileCheck("/proc/stb/video/zapmode") or fileCheck("/proc/stb/video/zapping_mode")
SystemInfo["NumFrontpanelLEDs"] = countFrontpanelLEDs()
SystemInfo["OledDisplay"] = fileExists("/dev/dbox/oled0")
SystemInfo["LcdDisplay"] = fileExists("/dev/dbox/lcd0")
SystemInfo["DisplayLED"] = getBoxType() in ('gb800se', 'gb800solo', 'gbx1', 'gbx2', 'gbx3', 'gbx3h')
SystemInfo["LEDButtons"] = getBoxType() == 'vuultimo'
SystemInfo["DeepstandbySupport"] = HardwareInfo().has_deepstandby()
SystemInfo["Fan"] = fileCheck("/proc/stb/fp/fan")
SystemInfo["FanPWM"] = SystemInfo["Fan"] and fileCheck("/proc/stb/fp/fan_pwm")
SystemInfo["PowerLed"] = fileExists("/proc/stb/power/powerled")
SystemInfo["StandbyLED"] = fileCheck("/proc/stb/power/standbyled")
SystemInfo["SuspendLED"] = fileCheck("/proc/stb/power/suspendled")
SystemInfo["LedPowerColor"] = fileExists("/proc/stb/fp/ledpowercolor")
SystemInfo["LedStandbyColor"] = fileExists("/proc/stb/fp/ledstandbycolor")
SystemInfo["LedSuspendColor"] = fileExists("/proc/stb/fp/ledsuspendledcolor")
SystemInfo["Power24x7On"] = fileExists("/proc/stb/fp/power4x7on")
SystemInfo["Power24x7Standby"] = fileExists("/proc/stb/fp/power4x7standby")
SystemInfo["Power24x7Suspend"] = fileExists("/proc/stb/fp/power4x7suspend")
SystemInfo["WakeOnLAN"] = getBoxType() not in ('et8000', 'et10000') and fileCheck("/proc/stb/power/wol") or fileCheck("/proc/stb/fp/wol")
SystemInfo["HDMICEC"] = (fileExists("/dev/hdmi_cec") or fileExists("/dev/misc/hdmi_cec0")) and fileExists("/usr/lib/enigma2/python/Plugins/SystemPlugins/HdmiCEC/plugin.pyo")
コード例 #38
0
		def wakeOnLANChanged(configElement):
			if getBoxType() in ('et7000', 'et7500', 'gbx1', 'gbx3', 'et10000', 'gbquadplus', 'gbquad', 'gb800ueplus', 'gb800seplus', 'gbultraue', 'gbultrase', 'gbipbox', 'quadbox2400', 'mutant2400', 'et7x00', 'et8500', 'et8500s'):
				open(SystemInfo["WakeOnLAN"], "w").write(configElement.value and "on" or "off")
			else:
				open(SystemInfo["WakeOnLAN"], "w").write(configElement.value and "enable" or "disable")	
コード例 #39
0
ファイル: VideoEnhancement.py プロジェクト: TwolDE2/ATV65
    def createConfig(self, *args):
        config.pep = ConfigSubsection()
        config.pep.configsteps = NoSave(
            ConfigSelection(choices=[1, 5, 10, 25], default=1))

        if os_path.exists("/proc/stb/vmpeg/0/pep_contrast"):

            def setContrast(config):
                myval = int(config.value * 256)
                try:
                    print("--> setting contrast to: %0.8X" % myval)
                    f = open("/proc/stb/vmpeg/0/pep_contrast", "w")
                    f.write("%0.8X\n" % myval)
                    f.close()
                except OSError:
                    print("couldn't write pep_contrast.")

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.contrast = ConfigSlider(default=128, limits=(0, 255))
            config.pep.contrast.addNotifier(setContrast)
        else:
            config.pep.contrast = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/vmpeg/0/pep_saturation"):

            def setSaturation(config):
                myval = int(config.value * 256)
                try:
                    print("--> setting saturation to: %0.8X" % myval)
                    f = open("/proc/stb/vmpeg/0/pep_saturation", "w")
                    f.write("%0.8X\n" % myval)
                    f.close()
                except OSError:
                    print("couldn't write pep_saturaion.")

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.saturation = ConfigSlider(default=128, limits=(0, 255))
            config.pep.saturation.addNotifier(setSaturation)
        else:
            config.pep.saturation = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/vmpeg/0/pep_hue"):

            def setHue(config):
                myval = int(config.value * 256)
                try:
                    print("--> setting hue to: %0.8X" % myval)
                    f = open("/proc/stb/vmpeg/0/pep_hue", "w")
                    f.write("%0.8X\n" % myval)
                    f.close()
                except OSError:
                    print("couldn't write pep_hue.")

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.hue = ConfigSlider(default=128, limits=(0, 255))
            config.pep.hue.addNotifier(setHue)
        else:
            config.pep.hue = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/vmpeg/0/pep_brightness"):

            def setBrightness(config):
                myval = int(config.value * 256)
                try:
                    print("--> setting brightness to: %0.8X" % myval)
                    f = open("/proc/stb/vmpeg/0/pep_brightness", "w")
                    f.write("%0.8X\n" % myval)
                    f.close()
                except OSError:
                    print("couldn't write pep_brightness.")

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.brightness = ConfigSlider(default=128, limits=(0, 255))
            config.pep.brightness.addNotifier(setBrightness)
        else:
            config.pep.brightness = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/vmpeg/0/pep_block_noise_reduction"):

            def setBlock_noise_reduction(config):
                myval = int(config.value)
                try:
                    print("--> setting block_noise_reduction to: %0.8X" %
                          myval)
                    f = open("/proc/stb/vmpeg/0/pep_block_noise_reduction",
                             "w")
                    f.write("%0.8X\n" % myval)
                    f.close()
                except OSError:
                    print("couldn't write pep_block_noise_reduction.")

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.block_noise_reduction = ConfigSlider(default=0,
                                                            limits=(0, 5))
            config.pep.block_noise_reduction.addNotifier(
                setBlock_noise_reduction)
        else:
            config.pep.block_noise_reduction = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/vmpeg/0/pep_mosquito_noise_reduction"):

            def setMosquito_noise_reduction(config):
                myval = int(config.value)
                try:
                    print("--> setting mosquito_noise_reduction to: %0.8X" %
                          myval)
                    f = open("/proc/stb/vmpeg/0/pep_mosquito_noise_reduction",
                             "w")
                    f.write("%0.8X\n" % myval)
                    f.close()
                except OSError:
                    print("couldn't write pep_mosquito_noise_reduction.")

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.mosquito_noise_reduction = ConfigSlider(default=0,
                                                               limits=(0, 5))
            config.pep.mosquito_noise_reduction.addNotifier(
                setMosquito_noise_reduction)
        else:
            config.pep.mosquito_noise_reduction = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/vmpeg/0/pep_digital_contour_removal"):

            def setDigital_contour_removal(config):
                myval = int(config.value)
                try:
                    print("--> setting digital_contour_removal to: %0.8X" %
                          myval)
                    f = open("/proc/stb/vmpeg/0/pep_digital_contour_removal",
                             "w")
                    f.write("%0.8X\n" % myval)
                    f.close()
                except OSError:
                    print("couldn't write pep_digital_contour_removal.")

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.digital_contour_removal = ConfigSlider(default=0,
                                                              limits=(0, 5))
            config.pep.digital_contour_removal.addNotifier(
                setDigital_contour_removal)
        else:
            config.pep.digital_contour_removal = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/vmpeg/0/pep_split"):

            def setSplitMode(config):
                try:
                    print("--> setting splitmode to:", str(config.value))
                    f = open("/proc/stb/vmpeg/0/pep_split", "w")
                    f.write(str(config.value))
                    f.close()
                except OSError:
                    print("couldn't write pep_split.")

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.split = ConfigSelection(choices={
                "off": _("Off"),
                "left": _("Left"),
                "right": _("Right")
            },
                                               default="off")
            config.pep.split.addNotifier(setSplitMode)
        else:
            config.pep.split = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/vmpeg/0/pep_sharpness"):

            def setSharpness(config):
                myval = int(config.value * 256)
                try:
                    print("--> setting sharpness to: %0.8X" % myval)
                    f = open("/proc/stb/vmpeg/0/pep_sharpness", "w")
                    f.write("%0.8X\n" % myval)
                    f.close()
                except OSError:
                    print("couldn't write pep_sharpness.")

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            if getBoxType() in ('gbquad', 'gbquadplus'):
                config.pep.sharpness = ConfigSlider(default=256,
                                                    limits=(0, 256))
            else:
                config.pep.sharpness = ConfigSlider(default=0, limits=(0, 256))
            config.pep.sharpness.addNotifier(setSharpness)
        else:
            config.pep.sharpness = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/vmpeg/0/pep_auto_flesh"):

            def setAutoflesh(config):
                myval = int(config.value)
                try:
                    print("--> setting auto_flesh to: %0.8X" % myval)
                    f = open("/proc/stb/vmpeg/0/pep_auto_flesh", "w")
                    f.write("%0.8X\n" % myval)
                    f.close()
                except OSError:
                    print("couldn't write pep_auto_flesh.")

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.auto_flesh = ConfigSlider(default=0, limits=(0, 4))
            config.pep.auto_flesh.addNotifier(setAutoflesh)
        else:
            config.pep.auto_flesh = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/vmpeg/0/pep_green_boost"):

            def setGreenboost(config):
                myval = int(config.value)
                try:
                    print("--> setting green_boost to: %0.8X" % myval)
                    f = open("/proc/stb/vmpeg/0/pep_green_boost", "w")
                    f.write("%0.8X\n" % myval)
                    f.close()
                except OSError:
                    print("couldn't write pep_green_boost.")

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.green_boost = ConfigSlider(default=0, limits=(0, 4))
            config.pep.green_boost.addNotifier(setGreenboost)
        else:
            config.pep.green_boost = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/vmpeg/0/pep_blue_boost"):

            def setBlueboost(config):
                myval = int(config.value)
                try:
                    print("--> setting blue_boost to: %0.8X" % myval)
                    f = open("/proc/stb/vmpeg/0/pep_blue_boost", "w")
                    f.write("%0.8X\n" % myval)
                    f.close()
                except OSError:
                    print("couldn't write pep_blue_boost.")

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.blue_boost = ConfigSlider(default=0, limits=(0, 4))
            config.pep.blue_boost.addNotifier(setBlueboost)
        else:
            config.pep.blue_boost = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/vmpeg/0/pep_dynamic_contrast"):

            def setDynamic_contrast(config):
                myval = int(config.value)
                try:
                    print("--> setting dynamic_contrast to: %0.8X" % myval)
                    f = open("/proc/stb/vmpeg/0/pep_dynamic_contrast", "w")
                    f.write("%0.8X\n" % myval)
                    f.close()
                except OSError:
                    print("couldn't write pep_dynamic_contrast.")

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            if getBoxType() in ('gbquad', 'gbquadplus'):
                config.pep.dynamic_contrast = ConfigSlider(default=3,
                                                           limits=(0, 255))
            else:
                config.pep.dynamic_contrast = ConfigSlider(default=0,
                                                           limits=(0, 255))
            config.pep.dynamic_contrast.addNotifier(setDynamic_contrast)
        else:
            config.pep.dynamic_contrast = NoSave(ConfigNothing())

        try:
            x = config.av.scaler_sharpness.value
        except KeyError:
            if os_path.exists("/proc/stb/vmpeg/0/pep_scaler_sharpness"):

                def setScaler_sharpness(config):
                    myval = int(config.value)
                    try:
                        print("--> setting scaler_sharpness to: %0.8X" % myval)
                        f = open("/proc/stb/vmpeg/0/pep_scaler_sharpness", "w")
                        f.write("%0.8X\n" % myval)
                        f.close()
                    except OSError:
                        print("couldn't write pep_scaler_sharpness.")

                    if not VideoEnhancement.firstRun:
                        self.setConfiguredValues()

                config.av.scaler_sharpness = ConfigSlider(default=13,
                                                          limits=(0, 26))
                config.av.scaler_sharpness.addNotifier(setScaler_sharpness)
            else:
                config.av.scaler_sharpness = NoSave(ConfigNothing())

        if os_path.exists(
                "/proc/stb/video/hdmi_colorspace") and os_path.exists(
                    "/proc/stb/video/hdmi_colorspace_choices"):

            def setColour_space(config):
                myval = config.value
                try:
                    print("--> setting color_soace to:", myval)
                    f = open("/proc/stb/video/hdmi_colorspace", "w")
                    f.write(myval)
                    f.close()
                except OSError:
                    print("couldn't write color_soace.")

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            file = open("/proc/stb/video/hdmi_colorspace_choices", "r")
            modes = file.readline().split()
            file.close()
            config.pep.color_space = ConfigSelection(modes, modes[0])
            config.pep.color_space.addNotifier(setColour_space)
        else:
            config.pep.color_space = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/vmpeg/0/pep_scaler_vertical_dejagging"):

            def setScaler_vertical_dejagging(configElement):
                myval = configElement.value and "enable" or "disable"
                try:
                    print("--> setting scaler_vertical_dejagging to: %s" %
                          myval)
                    open("/proc/stb/vmpeg/0/pep_scaler_vertical_dejagging",
                         "w").write(myval)
                except OSError:
                    print("couldn't write pep_scaler_vertical_dejagging.")

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.scaler_vertical_dejagging = ConfigBoolean(
                default=False,
                descriptions={
                    False: _("Disabled"),
                    True: _("Enabled")
                })
            config.pep.scaler_vertical_dejagging.addNotifier(
                setScaler_vertical_dejagging)
        else:
            config.pep.scaler_vertical_dejagging = NoSave(ConfigNothing())

        if os_path.exists("/proc/stb/vmpeg/0/smooth"):

            def setSmooth(configElement):
                myval = configElement.value and "enable" or "disable"
                try:
                    print("--> setting smooth to: %s" % myval)
                    open("/proc/stb/vmpeg/0/smooth", "w").write(myval)
                except OSError:
                    print("couldn't write smooth.")

                if not VideoEnhancement.firstRun:
                    self.setConfiguredValues()

            config.pep.smooth = ConfigBoolean(default=False,
                                              descriptions={
                                                  False: _("Disabled"),
                                                  True: _("Enabled")
                                              })
            config.pep.smooth.addNotifier(setSmooth)
        else:
            config.pep.smooth = NoSave(ConfigNothing())

        if VideoEnhancement.firstRun:
            self.setConfiguredValues()

        VideoEnhancement.firstRun = False
コード例 #40
0
 def set3DZnorm(configElement):
     if SystemInfo["CanChange3DOsd"] and getBoxType() not in ('spycat'):
         print '[UserInterfacePositioner] Setting 3D depth:', configElement.value
         f = open("/proc/stb/fb/znorm", "w")
         f.write('%d' % int(configElement.value))
         f.close()
コード例 #41
0
 def selectionChanged(self):
     if getBoxType().startswith('azbox'):
         pass
     else:
         self["status"].setText(self["config"].getCurrent()[2])
コード例 #42
0
if os.path.isfile("/usr/lib/enigma2/python/enigma.zip"):
	sys.path.append("/usr/lib/enigma2/python/enigma.zip")

from Tools.Profile import profile, profile_final
profile("PYTHON_START")

import Tools.RedirectOutput
import enigma
from boxbranding import getBoxType, getBrandOEM
import eConsoleImpl
import eBaseImpl
enigma.eTimer = eBaseImpl.eTimer
enigma.eSocketNotifier = eBaseImpl.eSocketNotifier
enigma.eConsoleAppContainer = eConsoleImpl.eConsoleAppContainer
boxtype = getBoxType()

from traceback import print_exc
profile("SimpleSummary")
from Screens import InfoBar
from Screens.SimpleSummary import SimpleSummary

from sys import stdout, exc_info

profile("Bouquets")
enigma.eDVBDB.getInstance().reloadBouquets()

profile("ParentalControl")
import Components.ParentalControl
Components.ParentalControl.InitParentalControl()
コード例 #43
0
ファイル: AVSwitch.py プロジェクト: popazerty/e2_sh4
class AVSwitch:
    rates = {}  # high-level, use selectable modes.
    modes = {}  # a list of (high-level) modes for a certain port.

    rates["PAL"] = {
        "50Hz": {
            50: "pal"
        },
        "60Hz": {
            60: "pal60"
        },
        "multi": {
            50: "pal",
            60: "pal60"
        }
    }

    rates["NTSC"] = {"60Hz": {60: "ntsc"}}

    rates["Multi"] = {"multi": {50: "pal", 60: "ntsc"}}

    rates["480i"] = {"60Hz": {60: "480i"}}

    rates["576i"] = {"50Hz": {50: "576i"}}

    rates["480p"] = {"60Hz": {60: "480p"}}

    rates["576p"] = {"50Hz": {50: "576p"}}

    rates["720p"] = {
        "50Hz": {
            50: "720p50"
        },
        "60Hz": {
            60: "720p"
        },
        "multi": {
            50: "720p50",
            60: "720p"
        }
    }

    rates["1080i"] = {
        "50Hz": {
            50: "1080i50"
        },
        "60Hz": {
            60: "1080i"
        },
        "multi": {
            50: "1080i50",
            60: "1080i"
        }
    }

    rates["1080p"] = {
        "50Hz": {
            50: "1080p50"
        },
        "60Hz": {
            60: "1080p"
        },
        "multi": {
            50: "1080p50",
            60: "1080p"
        }
    }

    rates["PC"] = {
        "1024x768": {
            60: "1024x768"
        },  # not possible on DM7025
        "800x600": {
            60: "800x600"
        },  # also not possible
        "720x480": {
            60: "720x480"
        },
        "720x576": {
            60: "720x576"
        },
        "1280x720": {
            60: "1280x720"
        },
        "1280x720 multi": {
            50: "1280x720_50",
            60: "1280x720"
        },
        "1920x1080": {
            60: "1920x1080"
        },
        "1920x1080 multi": {
            50: "1920x1080",
            60: "1920x1080_50"
        },
        "1280x1024": {
            60: "1280x1024"
        },
        "1366x768": {
            60: "1366x768"
        },
        "1366x768 multi": {
            50: "1366x768",
            60: "1366x768_50"
        },
        "1280x768": {
            60: "1280x768"
        },
        "640x480": {
            60: "640x480"
        }
    }

    modes["Scart"] = ["PAL", "NTSC", "Multi"]
    # modes["DVI-PC"] = ["PC"]

    if hw_type in ('elite', 'premium', 'premium+', 'ultra', "me", "minime"):
        config.av.edid_override = True

    if (about.getChipSetString()
            in ('7241', '7358', '7362', '7346', '7356', '7424', '7425', '7435',
                'pnx8493', '7162',
                '7111')) or (hw_type in ('elite', 'premium', 'premium+',
                                         'ultra', "me", "minime")):
        modes["HDMI"] = [
            "720p", "1080p", "1080i", "576p", "576i", "480p", "480i"
        ]
        widescreen_modes = {"720p", "1080p", "1080i"}
    else:
        modes["HDMI"] = ["720p", "1080i", "576p", "576i", "480p", "480i"]
        widescreen_modes = {"720p", "1080i"}

    modes["YPbPr"] = modes["HDMI"]
    if getBrandOEM() == 'vuplus':
        modes["Scart-YPbPr"] = modes["HDMI"]

    # if modes.has_key("DVI-PC") and not getModeList("DVI-PC"):
    # 	print "remove DVI-PC because of not existing modes"
    # 	del modes["DVI-PC"]
    if modes.has_key("YPbPr") and getBoxType() in (
            'et4x00', 'xp1000', 'tm2t', 'tmsingle', 'odimm7', 'vusolo2',
            'tmnano', 'tmnano2super', 'iqonios300hd', 'e3hd', 'dm500hdv2',
            'dm500hd', 'dm800', 'ebox7358', 'eboxlumi', 'ebox5100',
            'ixusszero', 'optimussos1', 'enfinity', 'uniboxhd1'):
        del modes["YPbPr"]
    if modes.has_key("Scart") and getBoxType() in ('gbquad', 'et5x00',
                                                   'ixussone', 'et6x00',
                                                   'tmnano', 'tmnano2t',
                                                   'tmnano2super'):
        del modes["Scart"]

    def __init__(self):
        self.last_modes_preferred = []
        self.on_hotplug = CList()
        self.current_mode = None
        self.current_port = None

        self.readAvailableModes()

        self.createConfig()
        self.readPreferredModes()

    def readAvailableModes(self):
        try:
            f = open("/proc/stb/video/videomode_choices")
            modes = f.read()[:-1]
            f.close()
        except IOError:
            print "couldn't read available videomodes."
            self.modes_available = []
            return
        self.modes_available = modes.split(' ')

    def readPreferredModes(self):
        try:
            f = open("/proc/stb/video/videomode_preferred")
            modes = f.read()[:-1]
            f.close()
            self.modes_preferred = modes.split(' ')
        except IOError:
            print "reading preferred modes failed, using all modes"
            self.modes_preferred = self.modes_available

        if self.modes_preferred != self.last_modes_preferred:
            self.last_modes_preferred = self.modes_preferred
            self.on_hotplug("HDMI")  # must be HDMI

    # check if a high-level mode with a given rate is available.
    def isModeAvailable(self, port, mode, rate):
        rate = self.rates[mode][rate]
        for mode in rate.values():
            if mode not in self.modes_available:
                return False
        return True

    def isWidescreenMode(self, port, mode):
        return mode in self.widescreen_modes

    def setMode(self, port, mode, rate, force=None):
        print "[VideoMode] setMode - port: %s, mode: %s, rate: %s" % (
            port, mode, rate)

        # config.av.videoport.setValue(port)
        # we can ignore "port"
        self.current_mode = mode
        self.current_port = port
        modes = self.rates[mode][rate]

        mode_50 = modes.get(50)
        mode_60 = modes.get(60)
        if mode_50 is None or force == 60:
            mode_50 = mode_60
        if mode_60 is None or force == 50:
            mode_60 = mode_50

        if os.path.exists('/proc/stb/video/videomode_50hz') and getBoxType(
        ) not in ('gb800solo', 'gb800se', 'gb800ue'):
            f = open("/proc/stb/video/videomode_50hz", "w")
            f.write(mode_50)
            f.close()
        if os.path.exists('/proc/stb/video/videomode_60hz') and getBoxType(
        ) not in ('gb800solo', 'gb800se', 'gb800ue'):
            f = open("/proc/stb/video/videomode_60hz", "w")
            f.write(mode_60)
            f.close()
        try:
            set_mode = modes.get(int(rate[:2]))
        except:  # not support 50Hz, 60Hz for 1080p
            set_mode = mode_50
        f = open("/proc/stb/video/videomode", "w")
        f.write(set_mode)
        f.close()
        map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
        self.setColorFormat(map[config.av.colorformat.value])

    def saveMode(self, port, mode, rate):
        config.av.videoport.setValue(port)
        config.av.videoport.save()
        if port in config.av.videomode:
            config.av.videomode[port].setValue(mode)
            config.av.videomode[port].save()
        if mode in config.av.videorate:
            config.av.videorate[mode].setValue(rate)
            config.av.videorate[mode].save()

    def isPortAvailable(self, port):
        # fixme
        return True

    def isPortUsed(self, port):
        if port == "HDMI":
            self.readPreferredModes()
            return len(self.modes_preferred) != 0
        else:
            return True

    def getPortList(self):
        return [port for port in self.modes if self.isPortAvailable(port)]

    # get a list with all modes, with all rates, for a given port.
    def getModeList(self, port):
        res = []
        for mode in self.modes[port]:
            # list all rates which are completely valid
            rates = [
                rate for rate in self.rates[mode]
                if self.isModeAvailable(port, mode, rate)
            ]

            # if at least one rate is ok, add this mode
            if len(rates):
                res.append((mode, rates))
        return res

    def createConfig(self, *args):
        hw_type = HardwareInfo().get_device_name()
        has_hdmi = HardwareInfo().has_hdmi()
        lst = []

        config.av.videomode = ConfigSubDict()
        config.av.videorate = ConfigSubDict()

        # create list of output ports
        portlist = self.getPortList()
        for port in portlist:
            descr = port
            if 'HDMI' in port:
                lst.insert(0, (port, descr))
            else:
                lst.append((port, descr))

            modes = self.getModeList(port)
            if len(modes):
                config.av.videomode[port] = ConfigSelection(
                    choices=[mode for (mode, rates) in modes])
            for (mode, rates) in modes:
                config.av.videorate[mode] = ConfigSelection(choices=rates)
        config.av.videoport = ConfigSelection(choices=lst)

    def setInput(self, input):
        INPUT = {"ENCODER": 0, "SCART": 1, "AUX": 2}
        eAVSwitch.getInstance().setInput(INPUT[input])

    def setColorFormat(self, value):
        if not self.current_port:
            self.current_port = config.av.videoport.value
        if self.current_port in ("YPbPr", "Scart-YPbPr"):
            eAVSwitch.getInstance().setColorFormat(3)
        else:
            eAVSwitch.getInstance().setColorFormat(value)

    def setConfiguredMode(self):
        port = config.av.videoport.value
        if port not in config.av.videomode:
            print "current port not available, not setting videomode"
            return

        mode = config.av.videomode[port].value

        if mode not in config.av.videorate:
            print "current mode not available, not setting videomode"
            return

        rate = config.av.videorate[mode].value
        self.setMode(port, mode, rate)

    def setAspect(self, cfgelement):
        print "[VideoMode] setting aspect: %s" % cfgelement.value
        f = open("/proc/stb/video/aspect", "w")
        f.write(cfgelement.value)
        f.close()

    def setWss(self, cfgelement):
        if not cfgelement.value:
            wss = "auto(4:3_off)"
        else:
            wss = "auto"
        print "[VideoMode] setting wss: %s" % wss
        f = open("/proc/stb/denc/0/wss", "w")
        f.write(wss)
        f.close()

    def setPolicy43(self, cfgelement):
        print "[VideoMode] setting policy: %s" % cfgelement.value
        f = open("/proc/stb/video/policy", "w")
        f.write(cfgelement.value)
        f.close()

    def setPolicy169(self, cfgelement):
        if os.path.exists("/proc/stb/video/policy2"):
            print "[VideoMode] setting policy2: %s" % cfgelement.value
            f = open("/proc/stb/video/policy2", "w")
            f.write(cfgelement.value)
            f.close()

    def getOutputAspect(self):
        ret = (16, 9)
        port = config.av.videoport.value
        if port not in config.av.videomode:
            print "current port not available in getOutputAspect!!! force 16:9"
        else:
            mode = config.av.videomode[port].value
            force_widescreen = self.isWidescreenMode(port, mode)
            is_widescreen = force_widescreen or config.av.aspect.value in (
                "16:9", "16:10")
            is_auto = config.av.aspect.value == "auto"
            if is_widescreen:
                if force_widescreen:
                    pass
                else:
                    aspect = {
                        "16:9": "16:9",
                        "16:10": "16:10"
                    }[config.av.aspect.value]
                    if aspect == "16:10":
                        ret = (16, 10)
            elif is_auto:
                try:
                    aspect_str = open("/proc/stb/vmpeg/0/aspect", "r").read()
                    if aspect_str == "1":  # 4:3
                        ret = (4, 3)
                except IOError:
                    pass
            else:  # 4:3
                ret = (4, 3)
        return ret

    def getFramebufferScale(self):
        aspect = self.getOutputAspect()
        fb_size = getDesktop(0).size()
        return aspect[0] * fb_size.height(), aspect[1] * fb_size.width()

    def getAspectRatioSetting(self):
        valstr = config.av.aspectratio.value
        if valstr == "4_3_letterbox":
            val = 0
        elif valstr == "4_3_panscan":
            val = 1
        elif valstr == "16_9":
            val = 2
        elif valstr == "16_9_always":
            val = 3
        elif valstr == "16_10_letterbox":
            val = 4
        elif valstr == "16_10_panscan":
            val = 5
        elif valstr == "16_9_letterbox":
            val = 6
        return val
コード例 #44
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)

	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)

	if getBoxType() == 'odinm9' or getBoxType() == 'maram9' or getBoxType() == 'ventonhdx' or getBoxType() == 'ebox5000' or getBoxType() == 'ebox7358' or getBoxType() == 'eboxlumi' or getBoxType() == 'ixussone' or getBoxType() == 'ixusszero' or getBoxType() == 'ini-1000ru' or getBoxType() == 'ini-1000sv':
		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 getBoxType() == 'odinm7' or getBoxType() == 'odinm6' or getBoxType() == 'xp1000s':
		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)

	config.usage.shutdownOK.setValue(False)
	config.usage.shutdownOK.save()
	configfile.save()

	runReactor()

	print "normal shutdown"
	config.misc.startCounter.save()
	config.usage.shutdownOK.setValue(True)
	config.usage.shutdownOK.save()

	profile("wakeup")

	from time import time, strftime, localtime
	from Tools.StbHardware import setFPWakeuptime, getFPWakeuptime, setRTCtime
	#get currentTime
	nowTime = time()
	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)

	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:
		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:
			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:
		from time import strftime
		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 config.workaround.deeprecord.value:
				wptime = startTime[0] - 240 # 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
コード例 #45
0
    while fileExists("/proc/stb/fp/led%d_pattern" % leds):
        leds += 1

    return leds


SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output()
SystemInfo["ZapMode"] = fileCheck("/proc/stb/video/zapmode") or fileCheck(
    "/proc/stb/video/zapping_mode")
SystemInfo["NumFrontpanelLEDs"] = countFrontpanelLEDs()
SystemInfo["FrontpanelDisplay"] = fileExists("/dev/dbox/oled0") or fileExists(
    "/dev/dbox/lcd0")
SystemInfo["OledDisplay"] = fileExists("/dev/dbox/oled0")
SystemInfo["LcdDisplay"] = fileExists("/dev/dbox/lcd0")
SystemInfo["VfdDisplay"] = getBoxType() not in (
    'vuultimo', 'xpeedlx3', 'et10000', 'mutant2400', 'quadbox2400',
    'atemionemesis') and fileExists("/dev/dbox/oled0")
SystemInfo["DeepstandbySupport"] = HardwareInfo().has_deepstandby()
SystemInfo["Fan"] = fileCheck("/proc/stb/fp/fan")
SystemInfo["FanPWM"] = SystemInfo["Fan"] and fileCheck("/proc/stb/fp/fan_pwm")
SystemInfo["StandbyPowerLed"] = fileExists("/proc/stb/power/standbyled")
if getBoxType() in ('gbquad', 'gbquadplus', 'gb800ueplus', 'gb800seplus',
                    'gbipbox'):
    SystemInfo["WOL"] = False
else:
    SystemInfo["WOL"] = fileCheck("/proc/stb/power/wol") or fileCheck(
        "/proc/stb/fp/wol")
SystemInfo["HDMICEC"] = (
    fileExists("/dev/hdmi_cec")
    or fileExists("/dev/misc/hdmi_cec0")) and fileExists(
コード例 #46
0
ファイル: About.py プロジェクト: mariosbbs/enigma2-1
	def populate(self):
		def netspeed():
			netspeed=""
			for line in popen('ethtool eth0 |grep Speed','r'):
				line = line.strip().split(":")
				line =line[1].replace(' ','')
				netspeed += line
				return str(netspeed)
		def netspeed_eth1():
			netspeed=""
			for line in popen('ethtool eth1 |grep Speed','r'):
				line = line.strip().split(":")
				line =line[1].replace(' ','')
				netspeed += line
				return str(netspeed)
		def netspeed_ra0():
			netspeed=""
			for line in popen('iwconfig ra0 | grep Bit | cut -c 20-30','r'):
				line = line.strip()
				netspeed += line
				return str(netspeed)
		def netspeed_wlan0():
			netspeed=""
			for line in popen('iwconfig wlan0 | grep Bit | cut -c 20-30','r'):
				line = line.strip()
				netspeed += line
				return str(netspeed)
		def netspeed_wlan1():
			netspeed=""
			for line in popen('iwconfig wlan1 | grep Bit | cut -c 20-30','r'):
				line = line.strip()
				netspeed += line
				return str(netspeed)
		def freeflash():
			freeflash=""
			for line in popen("df -mh / | grep -v '^Filesystem' | awk '{print $4}'",'r'):
				line = line.strip()
				freeflash += line
				return str(freeflash)
		self["lab1"] = StaticText(_("openHDF"))
		self["lab2"] = StaticText(_("Support at") + " www.HDFreaks.cc")
		model = None
		AboutText = ""
		self["lab2"] = StaticText(_("Support @") + " www.hdfreaks.cc")
		AboutText += _("Model:\t%s %s - OEM Model: %s\n") % (getMachineBrand(), getMachineName(), getBrandOEM())

		if path.exists('/proc/stb/info/chipset'):
			AboutText += _("Chipset:\t%s") % about.getChipSetString() + "\n"

		cmd = 'cat /proc/cpuinfo | grep "cpu MHz" -m 1 | awk -F ": " ' + "'{print $2}'"
		cmd2 = 'cat /proc/cpuinfo | grep "BogoMIPS" -m 1 | awk -F ": " ' + "'{print $2}'"
		try:
			res = popen(cmd).read()
			res2 = popen(cmd2).read()
		except:
			res = ""
			res2 = ""
		cpuMHz = ""

		bootloader = ""
		if path.exists('/sys/firmware/devicetree/base/bolt/tag'):
			f = open('/sys/firmware/devicetree/base/bolt/tag', 'r')
			bootloader = f.readline().replace('\x00', '').replace('\n', '')
			f.close()
		BootLoaderVersion = 0
		try:
			if bootloader:
				AboutText += _("Bootloader:\t%s\n") % (bootloader)
				BootLoaderVersion = int(bootloader[1:])
		except:
			BootLoaderVersion = 0

		if getMachineBuild() in ('vusolo4k','gbx34k'):
			cpuMHz = "   (1,5 GHz)"
		elif getMachineBuild() in ('u41','u42'):
			cpuMHz = "   (1,0 GHz)"
		elif getMachineBuild() in ('vuuno4k','dm900','gb7252','dags7252'):
			cpuMHz = "   (1,7 GHz)"
		elif getMachineBuild() in ('formuler1tc','formuler1','triplex'):
			cpuMHz = "   (1,3 GHz)"
		elif getMachineBuild() in ('u5','u51','u52','u53','u5pvr','h9','sf8008','sf8008s','sf8008t','hd60',"hd61",'i55plus'):
			cpuMHz = "   (1,6 GHz)"
		elif getMachineBuild() in ('sf5008','et13000','et1x000','hd52','hd51','sf4008','vs1500','h7','osmio4k','osmio4kplus','osmini4k'):
			try:
				import binascii
				f = open('/sys/firmware/devicetree/base/cpus/cpu@0/clock-frequency', 'rb')
				clockfrequency = f.read()
				f.close()
				cpuMHz = "%s MHz" % str(round(int(binascii.hexlify(clockfrequency), 16)/1000000,1))
			except:
				cpuMHz = "1,7 GHz"
		else:
			if path.exists('/proc/cpuinfo'):
				f = open('/proc/cpuinfo', 'r')
				temp = f.readlines()
				f.close()
				try:
					for lines in temp:
						lisp = lines.split(': ')
						if lisp[0].startswith('cpu MHz'):
							#cpuMHz = "   (" +  lisp[1].replace('\n', '') + " MHz)"
							cpuMHz = "   (" +  str(int(float(lisp[1].replace('\n', '')))) + " MHz)"
							break
				except:
					pass

		bogoMIPS = ""
		if res:
			cpuMHz = "" + res.replace("\n", "") + " MHz"
		if res2:
			bogoMIPS = "" + res2.replace("\n", "")

		if getMachineBuild() in ('vusolo4k','hd51','hd52','sf4008','dm900','h7','gb7252','8100s'):
			AboutText += _("CPU:\t%s") % about.getCPUString() + cpuMHz + "\n"
		else:
			AboutText += _("CPU:\t%s") % about.getCPUString() + " " + cpuMHz + "\n"
		dMIPS = 0
		if getMachineBuild() in ('vusolo4k'):
			dMIPS = "10.500"
		elif getMachineBuild() in ('hd52','hd51','sf4008','dm900','h7','gb7252','8100s'):
			dMIPS = "12.000"
		if getMachineBuild() in ('vusolo4k','hd51','hd52','sf4008','dm900','h7','gb7252','8100s'):
			AboutText += _("DMIPS:\t") + dMIPS + "\n"
		else:
			AboutText += _("BogoMIPS:\t%s") % bogoMIPS + "\n"

		tempinfo = ""
		if path.exists('/proc/stb/sensors/temp0/value'):
			f = open('/proc/stb/sensors/temp0/value', 'r')
			tempinfo = f.read()
			f.close()
		elif path.exists('/proc/stb/fp/temp_sensor'):
			f = open('/proc/stb/fp/temp_sensor', 'r')
			tempinfo = f.read()
			f.close()
		elif path.exists('/proc/stb/sensors/temp/value'):
			f = open('/proc/stb/sensors/temp/value', 'r')
			tempinfo = f.read()
			f.close()
		elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'):
			if getBoxType() in ('mutant51', 'ax51', 'zgemmah7', 'e4hdultra'):
				tempinfo = ""
			else:
				f = open('/sys/devices/virtual/thermal/thermal_zone0/temp', 'r')
				tempinfo = f.read()
				tempinfo = tempinfo[:-4]
				f.close()
		if tempinfo and int(tempinfo.replace('\n', '')) > 0:
			mark = str('\xc2\xb0')
			AboutText += _("System Temp:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n"

		tempinfo = ""
		if path.exists('/proc/stb/fp/temp_sensor_avs'):
			f = open('/proc/stb/fp/temp_sensor_avs', 'r')
			tempinfo = f.read()
			f.close()
		elif path.exists('/proc/stb/power/avs'):
			f = open('/proc/stb/power/avs', 'r')
			tempinfo = f.read()
			f.close()
		elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'):
			try:
				f = open('/sys/devices/virtual/thermal/thermal_zone0/temp', 'r')
				tempinfo = f.read()
				tempinfo = tempinfo[:-4]
				f.close()
			except:
				tempinfo = ""
		elif path.exists('/proc/hisi/msp/pm_cpu'):
			try:
				for line in open('/proc/hisi/msp/pm_cpu').readlines():
					line = [x.strip() for x in line.strip().split(":")]
					if line[0] in ("Tsensor"):
						temp = line[1].split("=")
						temp = line[1].split(" ")
						tempinfo = temp[2]
			except:
				tempinfo = ""
		if tempinfo and int(tempinfo.replace('\n', '')) > 0:
			mark = str('\xc2\xb0')
			AboutText += _("CPU Temp:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n"

		AboutText += _("Cores:\t%s") % about.getCpuCoresString() + "\n"
		AboutText += _("HDF Version:\tV%s") % getImageVersion() + " Build #" + getImageBuild() + " based on " + getOEVersion() + "\n"
		AboutText += _("Kernel (Box):\t%s") % about.getKernelVersionString() + " (" + getBoxType() + ")" + "\n"

		if path.isfile("/etc/issue"):
			version = open("/etc/issue").readlines()[-2].upper().strip()[:-6]
			if path.isfile("/etc/image-version"):
				build = self.searchString("/etc/image-version", "^build=")
				version = "%s #%s" % (version,build)
			AboutText += _("Image:\t%s") % version + "\n"

		imagestarted = ""
		bootname = ''
		if path.exists('/boot/bootname'):
			f = open('/boot/bootname', 'r')
			bootname = f.readline().split('=')[1]
			f.close()
		if SystemInfo["HasRootSubdir"]:
			image = find_rootfssubdir("STARTUP")
			AboutText += _("Selected Image:\t%s") % "STARTUP_" + image[-1:] + bootname + "\n"
		elif getMachineBuild() in ('gbmv200','cc1','sf8008','ustym4kpro','beyonwizv2',"viper4k"):
			if path.exists('/boot/STARTUP'):
				f = open('/boot/STARTUP', 'r')
				f.seek(5)
				image = f.read(4)
				if image == "emmc":
					image = "1"
				elif image == "usb0":
					f.seek(13)
					image = f.read(1)
					if image == "1":
						image = "2"
					elif image == "3":
						image = "3"
					elif image == "5":
						image = "4"
					elif image == "7":
						image = "5"
				f.close()
				if bootname: bootname = "   (%s)" %bootname 
				AboutText += _("Partition:\t%s") % "STARTUP_" + image + bootname + "\n"
			else:
				f = open('/boot/STARTUP', 'r')
				f.seek(22)
				image = f.read(1)
				f.close()
				if bootname: bootname = "   (%s)" %bootname
				AboutText += _("Partition:\t%s") % "STARTUP_" + image + bootname + "\n"

		if SystemInfo["HaveMultiBoot"]:
			MyFlashDate = about.getFlashDateString()
			if path.isfile("/etc/filesystems"):
				AboutText += _("Flashed:\t%s") % MyFlashDate + "\n"
				#AboutText += _("Flashed:\tMultiboot active\n")
		else:
			AboutText += _("Flashed:\t%s\n") % about.getFlashDateString()

		string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))
		gstcmd = 'opkg list-installed | grep "gstreamer1.0 -" | cut -c 16-32'
		gstcmd2 = os.system(gstcmd)
		#return (gstcmd2)
		AboutText += _("Drivers:\t%s") % driversdate + "\n"
		AboutText += _("GStreamer:\t%s") % about.getGStreamerVersionString() + "\n"
		AboutText += _("Python:\t%s\n") % about.getPythonVersionString()
		AboutText += _("Free Flash:\t%s\n") % freeflash()
		AboutText += _("Skin:\t%s (%s x %s)\n") % (config.skin.primary_skin.value.split('/')[0], getDesktop(0).size().width(), getDesktop(0).size().height())
		AboutText += _("Last update:\t%s") % getEnigmaVersionString() + " to Build #" + getImageBuild() + "\n"
		AboutText += _("E2 (re)starts:\t%s\n") % config.misc.startCounter.value
		AboutText += _("Uptime") + ":\t" + about.getBoxUptime() + "\n"
		if SystemInfo["WakeOnLAN"]:
			if fileCheck("/proc/stb/power/wol"):
				WOLmode = open("/proc/stb/power/wol").read()[:-1]
			if fileCheck("/proc/stb/fp/wol"):
				WOLmode = open("/proc/stb/fp/wol").read()[:-1]
			AboutText += _("WakeOnLAN:\t%s\n") % WOLmode
		AboutText += _("Network:")
		eth0 = about.getIfConfig('eth0')
		eth1 = about.getIfConfig('eth1')
		ra0 = about.getIfConfig('ra0')
		wlan0 = about.getIfConfig('wlan0')
		wlan1 = about.getIfConfig('wlan1')
		if eth0.has_key('addr'):
			for x in about.GetIPsFromNetworkInterfaces():
				AboutText += "\t" + x[0] + ": " + x[1] + " (" + netspeed() + ")\n"
		elif eth1.has_key('addr'):
			for x in about.GetIPsFromNetworkInterfaces():
				AboutText += "\t" + x[0] + ": " + x[1] + " (" + netspeed_eth1() + ")\n"
		elif ra0.has_key('addr'):
			for x in about.GetIPsFromNetworkInterfaces():
				AboutText += "\t" + x[0] + ": " + x[1] + " (~" + netspeed_ra0() + ")\n"
		elif wlan0.has_key('addr'):
			for x in about.GetIPsFromNetworkInterfaces():
				AboutText += "\t" + x[0] + ": " + x[1] + " (~" + netspeed_wlan0() + ")\n"
		elif wlan1.has_key('addr'):
			for x in about.GetIPsFromNetworkInterfaces():
				AboutText += "\t" + x[0] + ": " + x[1] + " (~" + netspeed_wlan1() + ")\n"
		else:
			for x in about.GetIPsFromNetworkInterfaces():
				AboutText += "\t" + x[0] + ": " + x[1] + "\n"

		fp_version = getFPVersion()
		if fp_version is None:
			fp_version = ""
		elif fp_version != 0:
			fp_version = _("Frontprocessor:\tVersion %s") % fp_version
			AboutText += fp_version + "\n"

		AboutLcdText = AboutText.replace('\t', ' ')

		self["AboutScrollLabel"] = ScrollLabel(AboutText)
コード例 #47
0
ファイル: plugin.py プロジェクト: margy82/oe-alliance-plugins
def createTransCodingConfig(encoder):
    if fileExists(getProcPath(encoder, "bitrate")):
        if getBoxType() == "vusolo2":
            choice = ConfigSelection(default="400000",
                                     choices=[("-1", "Auto"),
                                              ("50000", "50 Kbits"),
                                              ("100000", "100 Kbits"),
                                              ("150000", "150 Kbits"),
                                              ("200000", "200 Kbits"),
                                              ("250000", "250 Kbits"),
                                              ("300000", "300 Kbits"),
                                              ("350000", "350 Kbits"),
                                              ("400000", "400 Kbits"),
                                              ("450000", "450 Kbits"),
                                              ("500000", "500 Kbits"),
                                              ("600000", "600 Kbits"),
                                              ("700000", "700 Kbits"),
                                              ("800000", "800 Kbits"),
                                              ("900000", "900 Kbits"),
                                              ("1000000", "1 Mbits")])
        else:
            choice = ConfigSelection(default="2000000",
                                     choices=[("-1", "Auto"),
                                              ("100000", "100 Kbits"),
                                              ("150000", "150 Kbits"),
                                              ("200000", "200 Kbits"),
                                              ("250000", "250 Kbits"),
                                              ("300000", "300 Kbits"),
                                              ("350000", "350 Kbits"),
                                              ("400000", "400 Kbits"),
                                              ("450000", "450 Kbits"),
                                              ("500000", "500 Kbits"),
                                              ("750000", "750 Kbits"),
                                              ("1000000", "1 Mbits"),
                                              ("1500000", "1.5 Mbits"),
                                              ("2000000", "2 Mbits"),
                                              ("2500000", "2.5 Mbits"),
                                              ("3000000", "3 Mbits"),
                                              ("3500000", "3.5 Mbits"),
                                              ("4000000", "4 Mbits"),
                                              ("4500000", "4.5 Mbits"),
                                              ("5000000", "5 Mbits"),
                                              ("10000000", "10 Mbits")])
        config.plugins.transcodingsetup.encoder[int(encoder)].bitrate = choice

    if fileExists(getProcPath(encoder, "framerate")):
        choice = ConfigSelection(default="50000",
                                 choices=[("-1", "Auto"),
                                          ("23976", "23.976 fps"),
                                          ("24000", "24 fps"),
                                          ("25000", "25 fps"),
                                          ("29970", "29.970 fps"),
                                          ("30000", "30 fps"),
                                          ("50000", "50 fps"),
                                          ("59940", "59.940 fps"),
                                          ("60000", "60 fps")])
        config.plugins.transcodingsetup.encoder[int(
            encoder)].framerate = choice

    if checkSupportAdvanced():
        if (hasattr(config.plugins.transcodingsetup.encoder[int(encoder)],
                    "bitrate") or hasattr(
                        config.plugins.transcodingsetup.encoder[int(encoder)],
                        "framerate")):
            choice = ConfigSelection(default="Off",
                                     choices=[("On", _("On")),
                                              ("Off", _("Off"))])
            config.plugins.transcodingsetup.encoder[int(
                encoder)].automode = choice

        if fileExists(getProcPath(encoder, "resolution")):
            choice = ConfigSelection(default="480p",
                                     choices=[("480p", _("480p")),
                                              ("576p", _("576p")),
                                              ("720p", _("720p")),
                                              ("320x240", _("320x240")),
                                              ("160x120", _("160x120"))])
            config.plugins.transcodingsetup.encoder[int(
                encoder)].resolution = choice

        if fileExists(getProcPath(encoder, "aspectratio")):
            choice = ConfigSelection(default="2",
                                     choices=[("0", _("auto")),
                                              ("1", _("4x3")),
                                              ("2", _("16x9"))])
            config.plugins.transcodingsetup.encoder[int(
                encoder)].aspectratio = choice

        if fileExists(getProcPath(encoder, "audiocodec")):
            choice = ConfigSelection(default="aac",
                                     choices=[("mpg", _("mpg")),
                                              ("mp3", _("mp3")),
                                              ("aac", _("aac")),
                                              ("aac+", _("aac+")),
                                              ("aac+loas", _("aac+loas")),
                                              ("aac+adts", _("aac+adts")),
                                              ("ac3", _("ac3"))])
            config.plugins.transcodingsetup.encoder[int(
                encoder)].audiocodec = choice

        if fileExists(getProcPath(encoder, "videocodec")):
            choice = ConfigSelection(default="h264",
                                     choices=[("h264", _("h264"))])
            config.plugins.transcodingsetup.encoder[int(
                encoder)].videocodec = choice

        if fileExists(getProcPath(encoder, "gopframeb")):
            choice = ConfigInteger(default=0, limits=(0, 60))
            config.plugins.transcodingsetup.encoder[int(
                encoder)].gopframeb = choice

        if fileExists(getProcPath(encoder, "gopframep")):
            choice = ConfigInteger(default=29, limits=(0, 60))
            config.plugins.transcodingsetup.encoder[int(
                encoder)].gopframep = choice

        if fileExists(getProcPath(encoder, "level")):
            choice = ConfigSelection(default="3.1",
                                     choices=[("1.0", _("1.0")),
                                              ("2.0", _("2.0")),
                                              ("2.1", _("2.1")),
                                              ("2.2", _("2.2")),
                                              ("3.0", _("3.0")),
                                              ("3.1", _("3.1")),
                                              ("3.2", _("3.2")),
                                              ("4.0", _("4.0")),
                                              ("4.1", _("4.1")),
                                              ("4.2", _("4.2")),
                                              ("5.0", _("5.0")),
                                              ("low", _("low")),
                                              ("main", _("main")),
                                              ("high", _("high"))])
            config.plugins.transcodingsetup.encoder[int(
                encoder)].level = choice

        if fileExists(getProcPath(encoder, "profile")):
            choice = ConfigSelection(default="baseline",
                                     choices=[("baseline", _("baseline")),
                                              ("simple", _("simple")),
                                              ("main", _("main")),
                                              ("high", _("high")),
                                              ("advanced simple",
                                               _("advancedsimple"))])
            config.plugins.transcodingsetup.encoder[int(
                encoder)].profile = choice
コード例 #48
0
	def __init__(self, session):
		Screen.__init__(self, session)
		self.setTitle(_("About"))
		hddsplit = skin.parameters.get("AboutHddSplit", 0)

		AboutText = _("Model: %s %s") % (getMachineBrand(), getMachineName()) + "\n"
		AboutText += _("Image: ") + about.getImageTypeString() + "\n"
		AboutText += _("Kernel version: ") + about.getKernelVersionString() + "\n"
		if path.exists('/proc/stb/info/chipset'):
			AboutText += _("Chipset: %s") % about.getChipSetString() + "\n"
		AboutText += _("CPU: %s") % about.getCPUString() + "\n"
		AboutText += _("Version: %s") % getImageVersion() + "\n"
		imagestarted = ""
		bootname = ''
		if path.exists('/boot/bootname'):
			f = open('/boot/bootname', 'r')
			bootname = f.readline().split('=')[1]
			f.close()
		if getMachineBuild() in ('cc1','sf8008'):
			if path.exists('/boot/STARTUP'):
				f = open('/boot/STARTUP', 'r')
				f.seek(5)
				image = f.read(4)
				if image == "emmc":
					image = "1"
				elif image == "usb0":
					f.seek(13)
					image = f.read(1)
					if image == "1":
						image = "2"
					elif image == "3":
						image = "3"
					elif image == "5":
						image = "4"
					elif image == "7":
						image = "5"
				f.close()
				if bootname: bootname = "   (%s)" %bootname 
				AboutText += _("Selected Image:\t%s") % "STARTUP_" + image + bootname + "\n"
		if path.exists('/boot/STARTUP'):
			f = open('/boot/STARTUP', 'r')
			f.seek(22)
			image = f.read(1)
			f.close()
			if bootname: bootname = "   (%s)" %bootname
			AboutText += _("Image started:\t%s") % "STARTUP_" + image + bootname + "\n"
		AboutText += _("Build: %s") % getImageBuild() + "\n"
		if path.exists('/proc/stb/info/release') and getBoxType() in ('et7000', 'et7500', 'et8500'):
			realdriverdate = open("/proc/stb/info/release", 'r')
			for line in realdriverdate:
				tmp = line.strip()
				AboutText += _("Drivers: %s") % tmp + "\n"
			realdriverdate.close()
		else:
			string = getDriverDate()
			year = string[0:4]
			month = string[4:6]
			day = string[6:8]
			driversdate = '-'.join((year, month, day))
			AboutText += _("Drivers: %s") % driversdate + "\n"
		EnigmaVersion = "Enigma: " + about.getEnigmaVersionString()
		self["EnigmaVersion"] = StaticText(EnigmaVersion)
		AboutText += EnigmaVersion + "\n"
		AboutText += _("Enigma (re)starts: %d\n") % config.misc.startCounter.value

		GStreamerVersion = "GStreamer: " + about.getGStreamerVersionString().replace("GStreamer","")
		self["GStreamerVersion"] = StaticText(GStreamerVersion)
		AboutText += GStreamerVersion + "\n"

		ImageVersion = _("Last upgrade: ") + about.getImageVersionString()
		self["ImageVersion"] = StaticText(ImageVersion)
		AboutText += ImageVersion + "\n"

		AboutText += _("Python version: ") + about.getPythonVersionString() + "\n" + "\n"

		AboutText += _("Enigma (re)starts: %d\n") % config.misc.startCounter.value

		fp_version = getFPVersion()
		if fp_version is None:
			fp_version = ""
		else:
			fp_version = _("Frontprocessor version: %s") % fp_version
			AboutText += fp_version + "\n"

		self["FPVersion"] = StaticText(fp_version)
		
		skinWidth = getDesktop(0).size().width()
		skinHeight = getDesktop(0).size().height()
		AboutText += _("Skin Name: %s") % config.skin.primary_skin.value[0:-9] + _("  (%s x %s)") % (skinWidth, skinHeight) + "\n"

		if path.exists('/etc/enigma2/EtRcType'):
			rfp = open('/etc/enigma2/EtRcType', "r")
			Remote = rfp.read()
			rfp.close
			AboutText += _("Remote control type") + _(": ") + Remote + "\n"
		else:
			AboutText += _("Remote control type") + _(": ") + iRcTypeControl.getBoxType() + "\n"

		if path.exists('/proc/stb/ir/rc/type'):
			fp = open('/proc/stb/ir/rc/type', "r")
			RcID = fp.read()
			fp.close
			AboutText += _("Remote control ID") + _(": ") + RcID

		AboutText += _('Skin & Resolution: %s (%sx%s)\n') % (config.skin.primary_skin.value[0:-9], getDesktop(0).size().width(), getDesktop(0).size().height())

		self["TunerHeader"] = StaticText(_("Detected NIMs:"))
		AboutText += "\n" + _("Detected NIMs:") + "\n"

		nims = nimmanager.nimListCompressed()
		for count in range(len(nims)):
			if count < 4:
				self["Tuner" + str(count)] = StaticText(nims[count])
			else:
				self["Tuner" + str(count)] = StaticText("")
			AboutText += nims[count] + "\n"

		self["HDDHeader"] = StaticText(_("Detected HDD:"))
		AboutText += "\n" + _("Detected HDD:") + "\n"

		hddlist = harddiskmanager.HDDList()
		hddinfo = ""
		if hddlist:
			formatstring = hddsplit and "%s:%s, %.1f %sB %s" or "%s\n(%s, %.1f %sB %s)"
			for count in range(len(hddlist)):
				if hddinfo:
					hddinfo += "\n"
				hdd = hddlist[count][1]
				if int(hdd.free()) > 1024:
					hddinfo += formatstring % (hdd.model(), hdd.capacity(), hdd.free()/1024.0, "G", _("free"))
				else:
					hddinfo += formatstring % (hdd.model(), hdd.capacity(), hdd.free(), "M", _("free"))
		else:
			hddinfo = _("none")
		self["hddA"] = StaticText(hddinfo)
		AboutText += hddinfo + "\n\n" + _("Network Info:")
		for x in about.GetIPsFromNetworkInterfaces():
			AboutText += "\n" + x[0] + ": " + x[1]

		self["AboutScrollLabel"] = ScrollLabel(AboutText)
		self["key_green"] = Button(_("Troubleshoot"))
		self["key_red"] = Button(_("Latest Commits"))
		self["key_yellow"] = Button(_("Memory Info"))
		self["key_blue"] = Button(_("%s ") % getMachineName() + _("picture"))

		self["actions"] = ActionMap(["ColorActions", "SetupActions", "DirectionActions", "ChannelSelectEPGActions"],
			{
				"cancel": self.close,
				"ok": self.close,
				"info": self.showTranslationInfo,
				"red": self.showCommits,
				"green": self.showTroubleshoot,
				"yellow": self.showMemoryInfo,
				"blue": self.showModelPic,
				"up": self["AboutScrollLabel"].pageUp,
				"down": self["AboutScrollLabel"].pageDown
			})
コード例 #49
0
try:
    name = skin_user_skinname()
    if name is not None:
        addSkin(name, SCOPE_CONFIG)
    else:
        addSkin('skin_user.xml', SCOPE_CONFIG)
except (SkinError, IOError, AssertionError), err:
    print "not loading user skin: ", err

# some boxes lie about their dimensions
addSkin('skin_box.xml')
# add optional discrete second infobar
addSkin('skin_second_infobar.xml')

# Only one of these is present, compliments of AM_CONDITIONAL
if getBoxType() == 'gbquad' or getBoxType() == 'gbquadplus' or getBoxType(
) == 'gb800ue' or getBoxType() == 'gb800ueplus':
    config.skin.lcdskin = ConfigText(default="skin_lcd_default.xml")
else:
    config.skin.lcdskin = ConfigNothing()

display_skin_id = 1
if fileExists('/usr/share/enigma2/lcd_skin/skin_lcd_default.xml'):
    if fileExists(resolveFilename(SCOPE_CONFIG, config.skin.lcdskin.value)):
        addSkin(config.skin.lcdskin.value, SCOPE_CONFIG)
    else:
        addSkin('lcd_skin/' + config.skin.lcdskin.value)

addSkin('skin_display.xml')
if addSkin('skin_display96.xml'):
    # Color OLED
コード例 #50
0
def getInfo(session=None, need_fullinfo=False):
    # TODO: get webif versione somewhere!
    info = {}
    global STATICBOXINFO

    if not (STATICBOXINFO is None or need_fullinfo):
        return STATICBOXINFO

    info['brand'] = getMachineBrand()
    info['model'] = getMachineName()
    info['boxtype'] = getBoxType()
    info['machinebuild'] = getMachineBuild()
    try:  # temporary due OE-A
        info['lcd'] = getLcd()
    except:  # nosec # noqa: E722
        info['lcd'] = 0
    try:  # temporary due OE-A
        info['grabpip'] = getGrabPip()
    except:  # nosec # noqa: E722
        info['grabpip'] = 0

    chipset = "unknown"
    if fileExists("/etc/.box"):
        f = open("/etc/.box", 'r')
        model = f.readline().strip().lower()
        f.close()
        if model.startswith("ufs") or model.startswith("ufc"):
            if model in ("ufs910", "ufs922", "ufc960"):
                chipset = "SH4 @266MHz"
            else:
                chipset = "SH4 @450MHz"
        elif model in ("topf", "tf7700hdpvr"):
            chipset = "SH4 @266MHz"
        elif model.startswith("azbox"):
            f = open("/proc/stb/info/model", 'r')
            model = f.readline().strip().lower()
            f.close()
            if model == "me":
                chipset = "SIGMA 8655"
            elif model == "minime":
                chipset = "SIGMA 8653"
            else:
                chipset = "SIGMA 8634"
        elif model.startswith("spark"):
            if model == "spark7162":
                chipset = "SH4 @540MHz"
            else:
                chipset = "SH4 @450MHz"
    elif fileExists("/proc/stb/info/azmodel"):
        f = open("/proc/stb/info/model", 'r')
        model = f.readline().strip().lower()
        f.close()
        if model == "me":
            chipset = "SIGMA 8655"
        elif model == "minime":
            chipset = "SIGMA 8653"
        else:
            chipset = "SIGMA 8634"
    elif fileExists("/proc/stb/info/model"):
        f = open("/proc/stb/info/model", 'r')
        model = f.readline().strip().lower()
        f.close()
        if model == "tf7700hdpvr":
            chipset = "SH4 @266MHz"
        elif model == "nbox":
            chipset = "STi7100 @266MHz"
        elif model == "arivalink200":
            chipset = "STi7109 @266MHz"
        elif model in ("adb2850", "adb2849", "dsi87"):
            chipset = "STi7111 @450MHz"
        elif model in ("sagemcom88", "esi88"):
            chipset = "STi7105 @450MHz"
        elif model.startswith("spark"):
            if model == "spark7162":
                chipset = "STi7162 @540MHz"
            else:
                chipset = "STi7111 @450MHz"
        elif model == "dm800":
            chipset = "bcm7401"
        elif model in ("dm800se", "dm500hd", "dm7020hd", "dm800sev2",
                       "dm500hdv2", "dm7020hdv2"):
            chipset = "bcm7405"
        elif model == "dm8000":
            chipset = "bcm7400"
        elif model in ("dm820", "dm7080"):
            chipset = "bcm7435"
        elif model in ("dm520", "dm525"):
            chipset = "bcm73625"
        elif model in ("dm900", "dm920"):
            chipset = "bcm7252S"

    if fileExists("/proc/stb/info/chipset"):
        f = open("/proc/stb/info/chipset", 'r')
        chipset = f.readline().strip()
        f.close()

    info['chipset'] = chipset

    memFree = 0
    for line in open("/proc/meminfo", 'r'):
        parts = line.split(':')
        key = parts[0].strip()
        if key == "MemTotal":
            info['mem1'] = parts[1].strip().replace("kB", _("kB"))
        elif key in ("MemFree", "Buffers", "Cached"):
            memFree += int(parts[1].strip().split(' ', 1)[0])
    info['mem2'] = "%s %s" % (memFree, _("kB"))
    info['mem3'] = _("%s free / %s total") % (info['mem2'], info['mem1'])

    try:
        f = open("/proc/uptime", "r")
        uptime = int(float(f.readline().split(' ', 2)[0].strip()))
        f.close()
        uptimetext = ''
        if uptime > 86400:
            d = uptime / 86400
            uptime = uptime % 86400
            uptimetext += '%dd ' % d
        uptimetext += "%d:%.2d" % (uptime / 3600, (uptime % 3600) / 60)
    except:  # nosec # noqa: E722
        uptimetext = "?"
    info['uptime'] = uptimetext

    info["webifver"] = OPENWEBIFVER
    info['imagedistro'] = getImageDistro()
    info['friendlyimagedistro'] = getFriendlyImageDistro()
    info['oever'] = getOEVersion()
    info['imagever'] = getImageVersion()
    ib = getImageBuild()
    if ib:
        info['imagever'] = info['imagever'] + "." + ib
    info['enigmaver'] = getEnigmaVersionString()
    info['driverdate'] = getDriverDate()
    info['kernelver'] = about.getKernelVersionString()

    try:
        from Tools.StbHardware import getFPVersion
    except ImportError:
        from Tools.DreamboxHardware import getFPVersion

    try:
        info['fp_version'] = getFPVersion()
    except:  # nosec # noqa: E722
        info['fp_version'] = None

    friendlychipsetdescription = _("Chipset")
    friendlychipsettext = info['chipset'].replace("bcm", "Broadcom ")
    if friendlychipsettext in ("7335", "7356", "7362", "73625", "7424", "7425",
                               "7429"):
        friendlychipsettext = "Broadcom " + friendlychipsettext
    if not (info['fp_version'] is None or info['fp_version'] == 0):
        friendlychipsetdescription = friendlychipsetdescription + " (" + _(
            "Front processor version") + ")"
        friendlychipsettext = friendlychipsettext + " (" + str(
            info['fp_version']) + ")"

    info['friendlychipsetdescription'] = friendlychipsetdescription
    info['friendlychipsettext'] = friendlychipsettext
    info['tuners'] = []
    for i in list(range(0, nimmanager.getSlotCount())):
        print(
            "[OpenWebif] -D- tuner '%d' '%s' '%s'" %
            (i, nimmanager.getNimName(i), nimmanager.getNim(i).getSlotName()))
        info['tuners'].append({
            "name":
            nimmanager.getNim(i).getSlotName(),
            "type":
            nimmanager.getNimName(i) + " (" +
            nimmanager.getNim(i).getFriendlyType() + ")",
            "rec":
            "",
            "live":
            ""
        })

    info['ifaces'] = []
    ifaces = iNetwork.getConfiguredAdapters()
    for iface in ifaces:
        info['ifaces'].append({
            "name":
            iNetwork.getAdapterName(iface),
            "friendlynic":
            getFriendlyNICChipSet(iface),
            "linkspeed":
            getLinkSpeed(iface),
            "mac":
            iNetwork.getAdapterAttribute(iface, "mac"),
            "dhcp":
            iNetwork.getAdapterAttribute(iface, "dhcp"),
            "ipv4method":
            getIPv4Method(iface),
            "ip":
            formatIp(iNetwork.getAdapterAttribute(iface, "ip")),
            "mask":
            formatIp(iNetwork.getAdapterAttribute(iface, "netmask")),
            "v4prefix":
            sum([
                bin(int(x)).count('1') for x in formatIp(
                    iNetwork.getAdapterAttribute(iface, "netmask")).split('.')
            ]),
            "gw":
            formatIp(iNetwork.getAdapterAttribute(iface, "gateway")),
            "ipv6":
            getAdapterIPv6(iface)['addr'],
            "ipmethod":
            getIPMethod(iface),
            "firstpublic":
            getAdapterIPv6(iface)['firstpublic']
        })

    info['hdd'] = []
    for hdd in harddiskmanager.hdd:
        dev = hdd.findMount()
        if dev:
            stat = os.statvfs(dev)
            free = stat.f_bavail * stat.f_frsize / 1048576.
        else:
            free = -1

        if free <= 1024:
            free = "%i %s" % (free, _("MB"))
        else:
            free = free / 1024.
            free = "%.1f %s" % (free, _("GB"))

        size = hdd.diskSize() * 1000000 / 1048576.
        if size > 1048576:
            size = "%.1f %s" % ((size / 1048576.), _("TB"))
        elif size > 1024:
            size = "%.1f %s" % ((size / 1024.), _("GB"))
        else:
            size = "%d %s" % (size, _("MB"))

        iecsize = hdd.diskSize()
        # Harddisks > 1000 decimal Gigabytes are labelled in TB
        if iecsize > 1000000:
            iecsize = (iecsize + 50000) // float(100000) / 10
            # Omit decimal fraction if it is 0
            if (iecsize % 1 > 0):
                iecsize = "%.1f %s" % (iecsize, _("TB"))
            else:
                iecsize = "%d %s" % (iecsize, _("TB"))
        # Round harddisk sizes beyond ~300GB to full tens: 320, 500, 640, 750GB
        elif iecsize > 300000:
            iecsize = "%d %s" % (((iecsize + 5000) // 10000 * 10), _("GB"))
        # ... be more precise for media < ~300GB (Sticks, SSDs, CF, MMC, ...): 1, 2, 4, 8, 16 ... 256GB
        elif iecsize > 1000:
            iecsize = "%d %s" % (((iecsize + 500) // 1000), _("GB"))
        else:
            iecsize = "%d %s" % (iecsize, _("MB"))

        info['hdd'].append({
            "model":
            hdd.model(),
            "capacity":
            size,
            "labelled_capacity":
            iecsize,
            "free":
            free,
            "mount":
            dev,
            "friendlycapacity":
            _("%s free / %s total") % (free, size + ' ("' + iecsize + '")')
        })

    info['shares'] = []
    autofiles = ('/etc/auto.network', '/etc/auto.network_vti')
    for autofs in autofiles:
        if fileExists(autofs):
            method = "autofs"
            for line in open(autofs).readlines():
                if not line.startswith('#'):
                    # Replace escaped spaces that can appear inside credentials with underscores
                    # Not elegant but we wouldn't want to expose credentials on the OWIF anyways
                    tmpline = line.replace("\ ", "_")
                    tmp = tmpline.split()
                    if not len(tmp) == 3:
                        continue
                    name = tmp[0].strip()
                    type = "unknown"
                    if "cifs" in tmp[1]:
                        # Linux still defaults to SMBv1
                        type = "SMBv1.0"
                        settings = tmp[1].split(",")
                        for setting in settings:
                            if setting.startswith("vers="):
                                type = setting.replace("vers=", "SMBv")
                    elif "nfs" in tmp[1]:
                        type = "NFS"

                    # Default is r/w
                    mode = _("r/w")
                    settings = tmp[1].split(",")
                    for setting in settings:
                        if setting == "ro":
                            mode = _("r/o")

                    uri = tmp[2]
                    parts = []
                    parts = tmp[2].split(':')
                    if parts[0] == "":
                        server = uri.split('/')[2]
                        uri = uri.strip()[1:]
                    else:
                        server = parts[0]

                    ipaddress = None
                    if server:
                        # Will fail on literal IPs
                        try:
                            # Try IPv6 first, as will Linux
                            if has_ipv6:
                                tmpaddress = None
                                tmpaddress = getaddrinfo(server, 0, AF_INET6)
                                if tmpaddress:
                                    ipaddress = "[" + list(
                                        tmpaddress)[0][4][0] + "]"
                            # Use IPv4 if IPv6 fails or is not present
                            if ipaddress is None:
                                tmpaddress = None
                                tmpaddress = getaddrinfo(server, 0, AF_INET)
                                if tmpaddress:
                                    ipaddress = list(tmpaddress)[0][4][0]
                        except:  # nosec # noqa: E722
                            pass

                    friendlyaddress = server
                    if ipaddress is not None and not ipaddress == server:
                        friendlyaddress = server + " (" + ipaddress + ")"
                    info['shares'].append({
                        "name": name,
                        "method": method,
                        "type": type,
                        "mode": mode,
                        "path": uri,
                        "host": server,
                        "ipaddress": ipaddress,
                        "friendlyaddress": friendlyaddress
                    })
    # TODO: fstab

    info['transcoding'] = TRANSCODING

    info['EX'] = ''

    if session:
        try:
            #  gets all current stream clients for images using eStreamServer
            #  TODO: get tuner info for streams
            info['streams'] = GetStreamInfo()

            recs = NavigationInstance.instance.getRecordings()
            if recs:
                #  only one stream
                s_name = ''
                if len(info['streams']) == 1:
                    sinfo = info['streams'][0]
                    s_name = sinfo["name"] + ' (' + sinfo["ip"] + ')'
                    print("[OpenWebif] -D- s_name '%s'" % s_name)

                serviceNames = {}
                for timer in NavigationInstance.instance.RecordTimer.timer_list:
                    if timer.isRunning() and not timer.justplay:
                        timer_rs = timer.record_service
                        feinfo = timer_rs and hasattr(
                            timer_rs,
                            "frontendInfo") and timer_rs.frontendInfo()
                        fedata = feinfo and hasattr(
                            feinfo,
                            "getFrontendData") and feinfo.getFrontendData()
                        tuner_num = fedata and "tuner_number" in fedata and fedata.get(
                            "tuner_number")
                        if tuner_num is not None:
                            if tuner_num in serviceNames:  # this tuner is recording more than one timer
                                serviceNames[tuner_num] += ", " + removeBad(
                                    timer.service_ref.getServiceName())
                            else:
                                serviceNames[tuner_num] = removeBad(
                                    timer.service_ref.getServiceName())
                        print("[OpenWebif] -D- timer '%s'" %
                              timer.service_ref.getServiceName())

                print("[OpenWebif] -D- recs count '%d'" % len(recs))

                for rec in recs:
                    feinfo = rec.frontendInfo()
                    frontendData = feinfo and feinfo.getAll(True)
                    if frontendData is not None:
                        cur_info = feinfo.getTransponderData(True)
                        if cur_info:
                            nr = frontendData['tuner_number']
                            if nr in serviceNames:
                                info['tuners'][nr]['rec'] = getOrbitalText(
                                    cur_info) + ' / ' + serviceNames[nr]
                            else:
                                info['tuners'][nr]['rec'] = getOrbitalText(
                                    cur_info) + ' / ' + s_name

            service = session.nav.getCurrentService()
            if service is not None:
                sname = service.info().getName()
                feinfo = service.frontendInfo()
                frontendData = feinfo and feinfo.getAll(True)
                if frontendData is not None:
                    cur_info = feinfo.getTransponderData(True)
                    if cur_info:
                        nr = frontendData['tuner_number']
                        info['tuners'][nr]['live'] = getOrbitalText(
                            cur_info) + ' / ' + sname
        except Exception as error:
            info['EX'] = error

    info['timerpipzap'] = False
    info['timerautoadjust'] = False

    try:
        timer = RecordTimerEntry(ServiceReference("1:0:1:0:0:0:0:0:0:0"), 0, 0,
                                 '', '', 0)
        if hasattr(timer, "pipzap"):
            info['timerpipzap'] = True
        if hasattr(timer, "autoadjust"):
            info['timerautoadjust'] = True
    except Exception as error:
        print("[OpenWebif] -D- RecordTimerEntry check %s" % error)

    info['textinputsupport'] = TEXTINPUTSUPPORT
    STATICBOXINFO = info
    return info
コード例 #51
0
ファイル: Flash_online.py プロジェクト: ACJTeam/acjgit
 def box(self):
     box = getBoxType()
     return box
コード例 #52
0
ファイル: mytest.py プロジェクト: tigrousad/enigma2
if os.path.isfile("/usr/lib/enigma2/python/enigma.zip"):
    sys.path.append("/usr/lib/enigma2/python/enigma.zip")

from Tools.Profile import profile, profile_final
profile("PYTHON_START")

import Tools.RedirectOutput
import enigma
from boxbranding import getBoxType, getBrandOEM, getMachineBuild
import eConsoleImpl
import eBaseImpl
enigma.eTimer = eBaseImpl.eTimer
enigma.eSocketNotifier = eBaseImpl.eSocketNotifier
enigma.eConsoleAppContainer = eConsoleImpl.eConsoleAppContainer
boxtype = getBoxType()

if os.path.isfile(
        "/usr/lib/enigma2/python/Plugins/Extensions/MediaPortal/plugin.pyo"
) and boxtype in ('dm7080', 'dm820'):
    import pyo_patcher

from traceback import print_exc
profile("SimpleSummary")
from Screens import InfoBar
from Screens.SimpleSummary import SimpleSummary

from sys import stdout, exc_info

profile("Bouquets")
from Components.config import config, configfile, ConfigText, ConfigYesNo, ConfigInteger, NoSave
コード例 #53
0
ファイル: AVSwitch.py プロジェクト: mosadraja/enigma2-3
def InitAVSwitch():
	if getBoxType() == 'vuduo' or getBoxType().startswith('ixuss'):
		config.av.yuvenabled = ConfigBoolean(default=False)
	else:
		config.av.yuvenabled = ConfigBoolean(default=True)
	config.av.osd_alpha = ConfigSlider(default=255, increment = 5, limits=(20,255)) # Make openATV compatible with some plugins who still use config.av.osd_alpha
	colorformat_choices = {"cvbs": _("CVBS"), "rgb": _("RGB"), "svideo": _("S-Video")}
	# when YUV is not enabled, don't let the user select it
	if config.av.yuvenabled.value:
		colorformat_choices["yuv"] = _("YPbPr")

	config.av.autores = ConfigSelection(choices={"disabled": _("Disabled"), "simple": _("Simple"), "native": _("Native"), "all": _("All resolutions"), "hd": _("only HD")}, default="disabled")
	config.av.autores_preview = NoSave(ConfigYesNo(default=False))
	config.av.autores_1080i_deinterlace = ConfigYesNo(default=False)
	choicelist = {
			"24,24": _("24p/24p"),
			"24,25": _("24p/25p"),
			"24,30": _("24p/30p"),
			"24,50": _("24p/50p"),
			"24,60": _("24p/60p"),
			"25,24": _("25p/24p"),
			"30,24": _("30p/24p"),
			"50,24": _("50p/24p"),
			"60,24": _("60p/24p"),
			"25,25": _("25p/25p"),
			"25,30": _("25p/30p"),
			"25,50": _("25p/50p"),
			"25,60": _("25p/60p"),
			"30,25": _("30p/25p"),
			"50,25": _("50p/25p"),
			"60,25": _("60p/25p"),
			"30,30": _("30p/30p"),
			"30,50": _("30p/50p"),
			"30,60": _("30p/60p"),
			"50,30": _("50p/30p"),
			"60,30": _("60p/30p"),
			"50,50": _("50p/50p"),
			"50,60": _("50p/60p"),
			"60,50": _("60p/50p"),
			"60,60": _("60p/60p")
				}  # first value <=720p , second value > 720p
	config.av.autores_24p =  ConfigSelection(choices=choicelist, default="50,24")
	config.av.autores_25p =  ConfigSelection(choices=choicelist, default="50,25")
	config.av.autores_30p =  ConfigSelection(choices=choicelist, default="60,30")
	config.av.autores_unknownres =  ConfigSelection(choices={"next": _("next higher Resolution"), "highest": _("highest Resolution")}, default="next")
	choicelist = []
	for i in range(5, 16):
		choicelist.append(("%d" % i, ngettext("%d second", "%d seconds", i) % i))
	config.av.autores_label_timeout = ConfigSelection(default = "5", choices = [("0", _("Not Shown"))] + choicelist)
	config.av.autores_delay = ConfigSelectionNumber(min = 0, max = 3000, stepwidth = 50, default = 400, wraparound = True)
	config.av.autores_deinterlace = ConfigYesNo(default=False)
	config.av.autores_sd = ConfigSelection(choices={"720p50": _("720p50"), "720p": _("720p"), "1080i50": _("1080i50"), "1080i": _("1080i")}, default="720p50")
	config.av.autores_480p24 = ConfigSelection(choices={"480p24": _("480p 24Hz"), "720p24": _("720p 24Hz"), "1080p24": _("1080p 24Hz")}, default="1080p24")
	config.av.autores_720p24 = ConfigSelection(choices={"720p24": _("720p 24Hz"), "1080p24": _("1080p 24Hz"), "1080i50": _("1080i 50Hz"), "1080i": _("1080i 60Hz")}, default="720p24")
	config.av.autores_1080p24 = ConfigSelection(choices={"1080p24": _("1080p 24Hz"), "1080p25": _("1080p 25Hz"), "1080i50": _("1080p 50Hz"), "1080i": _("1080i 60Hz")}, default="1080p24")
	config.av.autores_1080p25 = ConfigSelection(choices={"1080p25": _("1080p 25Hz"), "1080p50": _("1080p 50Hz"), "1080i50": _("1080i 50Hz")}, default="1080p25")
	config.av.autores_1080p30 = ConfigSelection(choices={"1080p30": _("1080p 30Hz"), "1080p60": _("1080p 60Hz"), "1080i": _("1080i 60Hz")}, default="1080p30")
	config.av.autores_2160p24 = ConfigSelection(choices={"2160p24": _("2160p 24Hz"), "2160p25": _("2160p 25Hz"), "2160p30": _("2160p 30Hz")}, default="2160p24")
	config.av.autores_2160p25 = ConfigSelection(choices={"2160p25": _("2160p 25Hz"), "2160p50": _("2160p 50Hz")}, default="2160p25")
	config.av.autores_2160p30 = ConfigSelection(choices={"2160p30": _("2160p 30Hz"), "2160p60": _("2160p 60Hz")}, default="2160p30")
	config.av.smart1080p = ConfigSelection(choices={"false": _("off"), "true": _("1080p50: 24p/50p/60p"), "2160p50": _("2160p50: 24p/50p/60p"), "1080i50": _("1080i50: 24p/50i/60i"), "720p50": _("720p50: 24p/50p/60p")}, default="false")
	config.av.colorformat = ConfigSelection(choices=colorformat_choices, default="rgb")
	config.av.aspectratio = ConfigSelection(choices={
			"4_3_letterbox": _("4:3 Letterbox"),
			"4_3_panscan": _("4:3 PanScan"),
			"16_9": _("16:9"),
			"16_9_always": _("16:9 always"),
			"16_10_letterbox": _("16:10 Letterbox"),
			"16_10_panscan": _("16:10 PanScan"),
			"16_9_letterbox": _("16:9 Letterbox")},
			default = "16_9")
	config.av.aspect = ConfigSelection(choices={
			"4:3": _("4:3"),
			"16:9": _("16:9"),
			"16:10": _("16:10"),
			"auto": _("Automatic")},
			default = "16:9")

	# Some boxes have a redundant proc entry for policy2 choices, but some don't (The choices are from a 16:9 point of view anyways)
	if os.path.exists("/proc/stb/video/policy2_choices"):
		policy2_choices_proc="/proc/stb/video/policy2_choices"
	else:
		policy2_choices_proc="/proc/stb/video/policy_choices"

	try:
		policy2_choices_raw=open(policy2_choices_proc, "r").read()
	except:
		policy2_choices_raw="letterbox"
	
	policy2_choices = {}

	if "letterbox" in policy2_choices_raw:
		# TRANSLATORS: (aspect ratio policy: black bars on top/bottom) in doubt, keep english term.
		policy2_choices.update({"letterbox": _("Letterbox")})

	if "panscan" in policy2_choices_raw:
		# TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term
		policy2_choices.update({"panscan": _("Pan&scan")})

	if "nonliner" in policy2_choices_raw and not "nonlinear" in policy2_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching the top/bottom (Center of picture maintains aspect, top/bottom lose aspect heaver than on linear stretch))
		policy2_choices.update({"nonliner": _("Stretch nonlinear")})
	if "nonlinear" in policy2_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching the top/bottom (Center of picture maintains aspect, top/bottom lose aspect heaver than on linear stretch))
		policy2_choices.update({"nonlinear": _("Stretch nonlinear")})

	if "scale" in policy2_choices_raw and not "auto" in policy2_choices_raw and not "bestfit" in policy2_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching all parts of the picture with the same factor (All parts lose aspect))
		policy2_choices.update({"scale": _("Stretch linear")})
	if "full" in policy2_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching all parts of the picture with the same factor (force aspect))
		policy2_choices.update({"full": _("Stretch full")})
	if "auto" in policy2_choices_raw and not "bestfit" in policy2_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching all parts of the picture with the same factor (All parts lose aspect))
		policy2_choices.update({"auto": _("Stretch linear")})
	if "bestfit" in policy2_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching all parts of the picture with the same factor (All parts lose aspect))
		policy2_choices.update({"bestfit": _("Stretch linear")})

	config.av.policy_169 = ConfigSelection(choices=policy2_choices, default =	"letterbox")

	policy_choices_proc="/proc/stb/video/policy_choices"
	try:
		policy_choices_raw=open(policy_choices_proc, "r").read()
	except:
		policy_choices_raw="panscan"
	
	policy_choices = {}

	if "pillarbox" in policy_choices_raw and not "panscan" in policy_choices_raw:
		# Very few boxes support "pillarbox" as an alias for "panscan" (Which in fact does pillarbox)
		# So only add "pillarbox" if "panscan" is not listed in choices
		
		# TRANSLATORS: (aspect ratio policy: black bars on left/right) in doubt, keep english term.
		policy_choices.update({"pillarbox": _("Pillarbox")})

	if "panscan" in policy_choices_raw:
		# DRIVER BUG:	"panscan" in /proc actually does "pillarbox" (That's probably why an alias to it named "pillarbox" existed)!
		#		Interpret "panscan" setting with a "Pillarbox" text in order to show the correct value in GUI

		# TRANSLATORS: (aspect ratio policy: black bars on left/right) in doubt, keep english term.
		policy_choices.update({"panscan": _("Pillarbox")})

	if "letterbox" in policy_choices_raw:
		# DRIVER BUG:	"letterbox" in /proc actually does pan&scan
		#		"letterbox" and 4:3 content on 16:9 TVs is mutually exclusive, as "letterbox" is the method to show wide content on narrow TVs
		#		Probably the bug arose as the driver actually does the same here as it would for wide content on narrow TVs (It stretches the picture to fit width)
		
		# TRANSLATORS: (aspect ratio policy: Fit width, cut/crop top and bottom (Maintain aspect ratio))
		policy_choices.update({"letterbox": _("Pan&scan")})

	if "nonliner" in policy_choices_raw and not "nonlinear" in policy_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching the left/right (Center 50% of picture maintain aspect, left/right 25% lose aspect heaver than on linear stretch))
		policy_choices.update({"nonliner": _("Stretch nonlinear")})
	if "nonlinear" in policy_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching the left/right (Center 50% of picture maintain aspect, left/right 25% lose aspect heaver than on linear stretch))
		policy_choices.update({"nonlinear": _("Stretch nonlinear")})

	# "auto", "bestfit" and "scale" are aliasses for the same: Stretch linear
	if "scale" in policy_choices_raw and not "auto" in policy_choices_raw and not "bestfit" in policy_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching all parts of the picture with the same factor (All parts lose aspect))
		policy_choices.update({"scale": _("Stretch linear")})
	if "full" in policy_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching all parts of the picture with the same factor (force aspect))
		policy_choices.update({"full": _("Stretch full")})
	if "auto" in policy_choices_raw and not "bestfit" in policy_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching all parts of the picture with the same factor (All parts lose aspect))
		policy_choices.update({"auto": _("Stretch linear")})
	if "bestfit" in policy_choices_raw:
		# TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching all parts of the picture with the same factor (All parts lose aspect))
		policy_choices.update({"bestfit": _("Stretch linear")})

	config.av.policy_43 = ConfigSelection(choices=policy_choices, default = "panscan")
	config.av.tvsystem = ConfigSelection(choices = {"pal": _("PAL"), "ntsc": _("NTSC"), "multinorm": _("multinorm")}, default="pal")
	config.av.wss = ConfigEnableDisable(default = True)
	config.av.generalAC3delay = ConfigSelectionNumber(-1000, 1000, 5, default = 0)
	config.av.generalPCMdelay = ConfigSelectionNumber(-1000, 1000, 5, default = 0)
	config.av.vcrswitch = ConfigEnableDisable(default = False)

	#config.av.aspect.setValue('16:9')
	config.av.aspect.addNotifier(iAVSwitch.setAspect)
	config.av.wss.addNotifier(iAVSwitch.setWss)
	config.av.policy_43.addNotifier(iAVSwitch.setPolicy43)
	config.av.policy_169.addNotifier(iAVSwitch.setPolicy169)

	def setColorFormat(configElement):
		if config.av.videoport and config.av.videoport.value in ("YPbPr", "Scart-YPbPr"):
			iAVSwitch.setColorFormat(3)
		elif config.av.videoport and config.av.videoport.value in ("RCA"):
			iAVSwitch.setColorFormat(0)
		else:
			if getBoxType() == 'et6x00':
				map = {"cvbs": 3, "rgb": 3, "svideo": 2, "yuv": 3}	
			elif getBoxType() == 'gbquad' or getBoxType() == 'gbquadplus' or getBoxType().startswith('et'):
				map = {"cvbs": 0, "rgb": 3, "svideo": 2, "yuv": 3}
			else:
				map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
			iAVSwitch.setColorFormat(map[configElement.value])
	config.av.colorformat.addNotifier(setColorFormat)

	def setAspectRatio(configElement):
		map = {"4_3_letterbox": 0, "4_3_panscan": 1, "16_9": 2, "16_9_always": 3, "16_10_letterbox": 4, "16_10_panscan": 5, "16_9_letterbox" : 6}
		iAVSwitch.setAspectRatio(map[configElement.value])

	iAVSwitch.setInput("ENCODER") # init on startup
	if (getBoxType() in ('gbquad', 'gbquadplus', 'et5x00', 'ixussone', 'ixusszero', 'axodin', 'axodinc', 'starsatlx', 'galaxym6', 'geniuse3hd', 'evoe3hd', 'axase3', 'axase3c', 'omtimussos1', 'omtimussos2', 'gb800seplus', 'gb800ueplus', 'gbultrase', 'gbultraue', 'gbultraueh' , 'twinboxlcd' )) or about.getModelString() == 'et6000':
		detected = False
	else:
		detected = eAVSwitch.getInstance().haveScartSwitch()

	SystemInfo["ScartSwitch"] = detected

	if os.path.exists("/proc/stb/hdmi/bypass_edid_checking"):
		f = open("/proc/stb/hdmi/bypass_edid_checking", "r")
		can_edidchecking = f.read().strip().split(" ")
		f.close()
	else:
		can_edidchecking = False

	SystemInfo["Canedidchecking"] = can_edidchecking

	if can_edidchecking:
		def setEDIDBypass(configElement):
			try:
				f = open("/proc/stb/hdmi/bypass_edid_checking", "w")
				if configElement.value:
					f.write("00000001")
				else:
					f.write("00000000")
				f.close()
			except:
				pass
		config.av.bypass_edid_checking = ConfigYesNo(default=True)
		config.av.bypass_edid_checking.addNotifier(setEDIDBypass)
	else:
		config.av.bypass_edid_checking = ConfigNothing()
		
		
	def setUnsupportModes(configElement):
		iAVSwitch.readPreferredModes()
		iAVSwitch.createConfig()

	config.av.edid_override.addNotifier(setUnsupportModes)

	if os.path.exists("/proc/stb/video/hdmi_colorspace"):
		f = open("/proc/stb/video/hdmi_colorspace", "r")
		have_colorspace = f.read().strip().split(" ")
		f.close()
	else:
		have_colorspace = False

	SystemInfo["havecolorspace"] = have_colorspace

	if have_colorspace:
		def setHDMIColorspace(configElement):
			try:
				f = open("/proc/stb/video/hdmi_colorspace", "w")
				f.write(configElement.value)
				f.close()
			except:
				pass
		if getBoxType() in ('vusolo4k','vuuno4k','vuuno4kse','vuultimo4k','vuduo4k','vuduo4kse'):
			config.av.hdmicolorspace = ConfigSelection(choices={
					"Edid(Auto)": _("Auto"),
					"Hdmi_Rgb": _("RGB"),
					"444": _("YCbCr444"),
					"422": _("YCbCr422"),
					"420": _("YCbCr420")},
					default = "Edid(Auto)")
		elif getBoxType() in ('dm900','dm920','vuzero4k'):
			config.av.hdmicolorspace = ConfigSelection(choices={
					"Edid(Auto)": _("Auto"),
					"Hdmi_Rgb": _("RGB"),
					"Itu_R_BT_709": _("BT709"),
					"DVI_Full_Range_RGB": _("Full Range RGB"),
					"FCC": _("FCC 1953"),
					"Itu_R_BT_470_2_BG": _("BT470 BG"),
					"Smpte_170M": _("Smpte 170M"),
					"Smpte_240M": _("Smpte 240M"),
					"Itu_R_BT_2020_NCL": _("BT2020 NCL"),
					"Itu_R_BT_2020_CL": _("BT2020 CL"),
					"XvYCC_709": _("BT709 XvYCC"),
					"XvYCC_601": _("BT601 XvYCC")},
					default = "Edid(Auto)")
		else:
			config.av.hdmicolorspace = ConfigSelection(choices={
					"auto": _("auto"),
					"rgb": _("rgb"),
					"420": _("420"),
					"422": _("422"),
					"444": _("444")},
					default = "auto")
		config.av.hdmicolorspace.addNotifier(setHDMIColorspace)
	else:
		config.av.hdmicolorspace = ConfigNothing()

	if os.path.exists("/proc/stb/video/hdmi_colorimetry"):
		f = open("/proc/stb/video/hdmi_colorimetry", "r")
		have_colorimetry = f.read().strip().split(" ")
		f.close()
	else:
		have_colorimetry = False

	SystemInfo["havecolorimetry"] = have_colorimetry

	if have_colorimetry:
		def setHDMIColorimetry(configElement):
			sleep(0.1)
			try:
				f = open("/proc/stb/video/hdmi_colorimetry", "w")
				f.write(configElement.value)
				f.close()
			except:
				pass
		config.av.hdmicolorimetry = ConfigSelection(choices={
				"auto": _("auto"),
				"bt2020ncl": _("BT 2020 NCL"),
				"bt2020cl": _("BT 2020 CL"),
				"bt709": _("BT 709")},
				default = "auto")
		config.av.hdmicolorimetry.addNotifier(setHDMIColorimetry)
	else:
		config.av.hdmicolorimetry = ConfigNothing()

	if os.path.exists("/proc/stb/info/boxmode"):
		f = open("/proc/stb/info/boxmode", "r")
		have_boxmode = f.read().strip().split(" ")
		f.close()
	else:
		have_boxmode = False

	SystemInfo["haveboxmode"] = have_boxmode

	if have_boxmode:
		def setBoxmode(configElement):
			try:
				f = open("/proc/stb/info/boxmode", "w")
				f.write(configElement.value)
				f.close()
			except:
				pass
		config.av.boxmode = ConfigSelection(choices={
				"12": _("enable PIP no HDR"),
				"1": _("12bit 4:2:0/4:2:2 no PIP")},
				default = "12")
		config.av.boxmode.addNotifier(setBoxmode)
	else:
		config.av.boxmode = ConfigNothing()

	if os.path.exists("/proc/stb/video/hdmi_colordepth"):
		f = open("/proc/stb/video/hdmi_colordepth", "r")
		have_HdmiColordepth = f.read().strip().split(" ")
		f.close()
	else:
		have_HdmiColordepth = False

	SystemInfo["havehdmicolordepth"] = have_HdmiColordepth

	if have_HdmiColordepth:
		def setHdmiColordepth(configElement):
			try:
				f = open("/proc/stb/video/hdmi_colordepth", "w")
				f.write(configElement.value)
				f.close()
			except:
				pass
		config.av.hdmicolordepth = ConfigSelection(choices={
				"auto": _("Auto"),
				"8bit": _("8bit"),
				"10bit": _("10bit"),
				"12bit": _("12bit")},
				default = "auto")
		config.av.hdmicolordepth.addNotifier(setHdmiColordepth)
	else:
		config.av.hdmicolordepth = ConfigNothing()
		
		
	if os.path.exists("/proc/stb/video/hdmi_hdrtype"):
		f = open("/proc/stb/video/hdmi_hdrtype", "r")
		have_HdmiHdrType = f.read().strip().split(" ")
		f.close()
	else:
		have_HdmiHdrType = False

	SystemInfo["havehdmihdrtype"] = have_HdmiHdrType

	if have_HdmiHdrType:
		def setHdmiHdrType(configElement):
			try:
				f = open("/proc/stb/video/hdmi_hdrtype", "w")
				f.write(configElement.value)
				f.close()
			except:
				pass
		config.av.hdmihdrtype = ConfigSelection(choices={
				"auto": _("Auto"),
				"dolby": _("dolby"),
				"none": _("sdr"),
				"hdr10": _("hdr10"),
				"hlg": _("hlg")},
				default = "auto")
		config.av.hdmihdrtype.addNotifier(setHdmiHdrType)
	else:
		config.av.hdmihdrtype = ConfigNothing()

	if os.path.exists("/proc/stb/hdmi/hlg_support_choices"):
		f = open("/proc/stb/hdmi/hlg_support_choices", "r")
		have_HDRSupport = f.read().strip().split(" ")
		f.close()
	else:
		have_HDRSupport = False

	SystemInfo["HDRSupport"] = have_HDRSupport

	if have_HDRSupport:
		def setHlgSupport(configElement):
			open("/proc/stb/hdmi/hlg_support", "w").write(configElement.value)
		config.av.hlg_support = ConfigSelection(default = "auto(EDID)", 
			choices = [ ("auto(EDID)", _("controlled by HDMI")), ("yes", _("force enabled")), ("no", _("force disabled")) ])
		config.av.hlg_support.addNotifier(setHlgSupport)

		def setHdr10Support(configElement):
			open("/proc/stb/hdmi/hdr10_support", "w").write(configElement.value)
		config.av.hdr10_support = ConfigSelection(default = "auto(EDID)", 
			choices = [ ("auto(EDID)", _("controlled by HDMI")), ("yes", _("force enabled")), ("no", _("force disabled")) ])
		config.av.hdr10_support.addNotifier(setHdr10Support)

		def setDisable12Bit(configElement):
			open("/proc/stb/video/disable_12bit", "w").write(configElement.value)
		config.av.allow_12bit = ConfigSelection(default = "0", choices = [ ("0", _("yes")), ("1", _("no")) ]);
		config.av.allow_12bit.addNotifier(setDisable12Bit)

		def setDisable10Bit(configElement):
			open("/proc/stb/video/disable_10bit", "w").write(configElement.value)
		config.av.allow_10bit = ConfigSelection(default = "0", choices = [ ("0", _("yes")), ("1", _("no")) ]);
		config.av.allow_10bit.addNotifier(setDisable10Bit)


	if os.path.exists("/proc/stb/hdmi/audio_source"):
		f = open("/proc/stb/hdmi/audio_source", "r")
		can_audiosource = f.read().strip().split(" ")
		f.close()
	else:
		can_audiosource = False

	SystemInfo["Canaudiosource"] = can_audiosource

	if can_audiosource:
		def setAudioSource(configElement):
			try:
				f = open("/proc/stb/hdmi/audio_source", "w")
				f.write(configElement.value)
				f.close()
			except:
				pass
		config.av.audio_source = ConfigSelection(choices={
				"pcm": _("PCM"),
				"spdif": _("SPDIF")},
				default="pcm")
		config.av.audio_source.addNotifier(setAudioSource)
	else:
		config.av.audio_source = ConfigNothing()

	if os.path.exists("/proc/stb/audio/3d_surround_choices"):
		f = open("/proc/stb/audio/3d_surround_choices", "r")
		can_3dsurround = f.read().strip().split(" ")
		f.close()
	else:
		can_3dsurround = False

	SystemInfo["Can3DSurround"] = can_3dsurround

	if can_3dsurround:
		def set3DSurround(configElement):
			f = open("/proc/stb/audio/3d_surround", "w")
			f.write(configElement.value)
			f.close()
		choice_list = [("none", _("off")), ("hdmi", _("HDMI")), ("spdif", _("SPDIF")), ("dac", _("DAC"))]
		config.av.surround_3d = ConfigSelection(choices = choice_list, default = "none")
		config.av.surround_3d.addNotifier(set3DSurround)
	else:
		config.av.surround_3d = ConfigNothing()

	if os.path.exists("/proc/stb/audio/3d_surround_speaker_position_choices"):
		f = open("/proc/stb/audio/3d_surround_speaker_position_choices", "r")
		can_3dsurround_speaker = f.read().strip().split(" ")
		f.close()
	else:
		can_3dsurround_speaker = False

	SystemInfo["Can3DSpeaker"] = can_3dsurround_speaker

	if can_3dsurround_speaker:
		def set3DSurroundSpeaker(configElement):
			try:
				f = open("/proc/stb/audio/3d_surround_speaker_position", "w")
				f.write(configElement.value)
				f.close()
			except:
				pass
		choice_list = [("center", _("center")), ("wide", _("wide")), ("extrawide", _("extra wide"))]
		config.av.surround_3d_speaker = ConfigSelection(choices = choice_list, default = "center")
		config.av.surround_3d_speaker.addNotifier(set3DSurroundSpeaker)
	else:
		config.av.surround_3d_speaker = ConfigNothing()

	if os.path.exists("/proc/stb/audio/avl_choices"):
		f = open("/proc/stb/audio/avl_choices", "r")
		can_autovolume = f.read().strip().split(" ")
		f.close()
	else:
		can_autovolume = False

	SystemInfo["CanAutoVolume"] = can_autovolume

	if can_autovolume:
		def setAutoVolume(configElement):
			f = open("/proc/stb/audio/avl", "w")
			f.write(configElement.value)
			f.close()
		choice_list = [("none", _("off")), ("hdmi", _("HDMI")), ("spdif", _("SPDIF")), ("dac", _("DAC"))]
		config.av.autovolume = ConfigSelection(choices = choice_list, default = "none")
		config.av.autovolume.addNotifier(setAutoVolume)
	else:
		config.av.autovolume = ConfigNothing()

	try:
		can_pcm_multichannel = os.access("/proc/stb/audio/multichannel_pcm", os.W_OK)
	except:
		can_pcm_multichannel = False

	SystemInfo["supportPcmMultichannel"] = can_pcm_multichannel
	if can_pcm_multichannel:
		def setPCMMultichannel(configElement):
			open("/proc/stb/audio/multichannel_pcm", "w").write(configElement.value and "enable" or "disable")
		config.av.pcm_multichannel = ConfigYesNo(default = False)
		config.av.pcm_multichannel.addNotifier(setPCMMultichannel)

	def setVolumeStepsize(configElement):
		eDVBVolumecontrol.getInstance().setVolumeSteps(int(configElement.value))
	config.av.volume_stepsize = ConfigSelectionNumber(1, 10, 1, default = 5)
	config.av.volume_stepsize_fastmode = ConfigSelectionNumber(1, 10, 1, default = 5)
	config.av.volume_hide_mute = ConfigYesNo(default = True)
	config.av.volume_stepsize.addNotifier(setVolumeStepsize)

	try:
		f = open("/proc/stb/audio/ac3_choices", "r")
		file = f.read()[:-1]
		f.close()
		can_downmix_ac3 = "downmix" in file
	except:
		can_downmix_ac3 = False
		SystemInfo["CanPcmMultichannel"] = False

	SystemInfo["CanDownmixAC3"] = can_downmix_ac3
	if can_downmix_ac3:
		def setAC3Downmix(configElement):
			f = open("/proc/stb/audio/ac3", "w")
			if getBoxType() in ('dm900', 'dm920', 'dm7080', 'dm800'):
				f.write(configElement.value)
			else:
				f.write(configElement.value and "downmix" or "passthrough")
			f.close()
			if SystemInfo.get("supportPcmMultichannel", False) and not configElement.value:
				SystemInfo["CanPcmMultichannel"] = True
			else:
				SystemInfo["CanPcmMultichannel"] = False
				if can_pcm_multichannel:
					config.av.pcm_multichannel.setValue(False)
		if getBoxType() in ('dm900', 'dm920', 'dm7080', 'dm800'):
			choice_list = [("downmix",  _("Downmix")), ("passthrough", _("Passthrough")), ("multichannel",  _("convert to multi-channel PCM")), ("hdmi_best",  _("use best / controlled by HDMI"))]
			config.av.downmix_ac3 = ConfigSelection(choices = choice_list, default = "downmix")
		else:
			config.av.downmix_ac3 = ConfigYesNo(default = True)
		config.av.downmix_ac3.addNotifier(setAC3Downmix)

	if os.path.exists("/proc/stb/audio/ac3plus_choices"):
		f = open("/proc/stb/audio/ac3plus_choices", "r")
		can_ac3plustranscode = f.read().strip().split(" ")
		f.close()
	else:
		can_ac3plustranscode = False

	SystemInfo["CanAC3plusTranscode"] = can_ac3plustranscode

	if can_ac3plustranscode:
		def setAC3plusTranscode(configElement):
			f = open("/proc/stb/audio/ac3plus", "w")
			f.write(configElement.value)
			f.close()
		if getBoxType() in ('dm900', 'dm920', 'dm7080', 'dm800'):
			choice_list = [("use_hdmi_caps", _("controlled by HDMI")), ("force_ac3", _("convert to AC3")), ("multichannel",  _("convert to multi-channel PCM")), ("hdmi_best",  _("use best / controlled by HDMI")), ("force_ddp",  _("force AC3plus"))]
			config.av.transcodeac3plus = ConfigSelection(choices = choice_list, default = "force_ac3")
		elif getBoxType() in ('gbquad4k', 'gbue4k', 'gbx34k'):
			choice_list = [("downmix", _("Downmix")), ("passthrough", _("Passthrough")), ("force_ac3", _("convert to AC3")), ("multichannel",  _("convert to multi-channel PCM")), ("force_dts",  _("convert to DTS"))]
			config.av.transcodeac3plus = ConfigSelection(choices = choice_list, default = "force_ac3")
		else:
			choice_list = [("use_hdmi_caps", _("controlled by HDMI")), ("force_ac3", _("convert to AC3"))]
			config.av.transcodeac3plus = ConfigSelection(choices = choice_list, default = "force_ac3")
		config.av.transcodeac3plus.addNotifier(setAC3plusTranscode)

	try:
		f = open("/proc/stb/audio/dtshd_choices", "r")
		file = f.read()[:-1]
		can_dtshd = f.read().strip().split(" ")
		f.close()
	except:
		can_dtshd = False

	SystemInfo["CanDTSHD"] = can_dtshd
	if can_dtshd:
		def setDTSHD(configElement):
			f = open("/proc/stb/audio/dtshd", "w")
			f.write(configElement.value)
			f.close()
		if getBoxType() in ("dm7080" , "dm820"):
			choice_list = [("use_hdmi_caps",  _("controlled by HDMI")), ("force_dts", _("convert to DTS"))]
			config.av.dtshd = ConfigSelection(choices = choice_list, default = "use_hdmi_caps")
		else:
			choice_list = [("downmix",  _("Downmix")), ("force_dts", _("convert to DTS")), ("use_hdmi_caps",  _("controlled by HDMI")), ("multichannel",  _("convert to multi-channel PCM")), ("hdmi_best",  _("use best / controlled by HDMI"))]
			config.av.dtshd = ConfigSelection(choices = choice_list, default = "downmix")
		config.av.dtshd.addNotifier(setDTSHD)

	try:
		f = open("/proc/stb/audio/wmapro_choices", "r")
		file = f.read()[:-1]
		can_wmapro = f.read().strip().split(" ")
		f.close()
	except:
		can_wmapro = False

	SystemInfo["CanWMAPRO"] = can_wmapro
	if can_wmapro:
		def setWMAPRO(configElement):
			f = open("/proc/stb/audio/wmapro", "w")
			f.write(configElement.value)
			f.close()
		choice_list = [("downmix",  _("Downmix")), ("passthrough", _("Passthrough")), ("multichannel",  _("convert to multi-channel PCM")), ("hdmi_best",  _("use best / controlled by HDMI"))]
		config.av.wmapro = ConfigSelection(choices = choice_list, default = "downmix")
		config.av.wmapro.addNotifier(setWMAPRO)

	try:
		f = open("/proc/stb/audio/dts_choices", "r")
		file = f.read()[:-1]
		f.close()
		can_downmix_dts = "downmix" in file
	except:
		can_downmix_dts = False

	SystemInfo["CanDownmixDTS"] = can_downmix_dts
	if can_downmix_dts:
		def setDTSDownmix(configElement):
			f = open("/proc/stb/audio/dts", "w")
			f.write(configElement.value and "downmix" or "passthrough")
			f.close()
		config.av.downmix_dts = ConfigYesNo(default = True)
		config.av.downmix_dts.addNotifier(setDTSDownmix)

	try:
		f = open("/proc/stb/audio/aac_choices", "r")
		file = f.read()[:-1]
		f.close()
		can_downmix_aac = "downmix" in file
	except:
		can_downmix_aac = False

	SystemInfo["CanDownmixAAC"] = can_downmix_aac
	if can_downmix_aac:
		def setAACDownmix(configElement):
			f = open("/proc/stb/audio/aac", "w")
			if getBoxType() in ('dm900', 'dm920', 'dm7080', 'dm800', 'gbquad4k', 'gbue4k', 'gbx34k'):
				f.write(configElement.value)
			else:
				f.write(configElement.value and "downmix" or "passthrough")
			f.close()
		if getBoxType() in ('dm900', 'dm920', 'dm7080', 'dm800'):
			choice_list = [("downmix",  _("Downmix")), ("passthrough", _("Passthrough")), ("multichannel",  _("convert to multi-channel PCM")), ("hdmi_best",  _("use best / controlled by HDMI"))]
			config.av.downmix_aac = ConfigSelection(choices = choice_list, default = "downmix")
		elif getBoxType() in ('gbquad4k', 'gbue4k', 'gbx34k'):
			choice_list = [("downmix",  _("Downmix")), ("passthrough", _("Passthrough")), ("multichannel",  _("convert to multi-channel PCM")), ("force_ac3", _("convert to AC3")), ("force_dts",  _("convert to DTS")), ("use_hdmi_cacenter",  _("use_hdmi_cacenter")), ("wide",  _("wide")), ("extrawide",  _("extrawide"))]
			config.av.downmix_aac = ConfigSelection(choices = choice_list, default = "downmix")
		else:
			config.av.downmix_aac = ConfigYesNo(default = True)
		config.av.downmix_aac.addNotifier(setAACDownmix)

	try:
		f = open("/proc/stb/audio/aacplus_choices", "r")
		file = f.read()[:-1]
		f.close()
		can_downmix_aacplus = "downmix" in file
	except:
		can_downmix_aacplus = False

	SystemInfo["CanDownmixAACPlus"] = can_downmix_aacplus
	if can_downmix_aacplus:
		def setAACDownmixPlus(configElement):
			f = open("/proc/stb/audio/aacplus", "w")
			f.write(configElement.value)
			f.close()

		choice_list = [("downmix",  _("Downmix")), ("passthrough", _("Passthrough")), ("multichannel",  _("convert to multi-channel PCM")), ("force_ac3", _("convert to AC3")), ("force_dts",  _("convert to DTS")), ("use_hdmi_cacenter",  _("use_hdmi_cacenter")), ("wide",  _("wide")), ("extrawide",  _("extrawide"))]
		config.av.downmix_aacplus = ConfigSelection(choices = choice_list, default = "downmix")
		config.av.downmix_aacplus.addNotifier(setAACDownmixPlus)

	if os.path.exists("/proc/stb/audio/aac_transcode_choices"):
		f = open("/proc/stb/audio/aac_transcode_choices", "r")
		can_aactranscode = f.read().strip().split(" ")
		f.close()
	else:
		can_aactranscode = False

	SystemInfo["CanAACTranscode"] = can_aactranscode

	if can_aactranscode:
		def setAACTranscode(configElement):
			f = open("/proc/stb/audio/aac_transcode", "w")
			f.write(configElement.value)
			f.close()
		choice_list = [("off", _("off")), ("ac3", _("AC3")), ("dts", _("DTS"))]
		config.av.transcodeaac = ConfigSelection(choices = choice_list, default = "off")
		config.av.transcodeaac.addNotifier(setAACTranscode)
	else:
		config.av.transcodeaac = ConfigNothing()

	if os.path.exists("/proc/stb/audio/btaudio"):
		f = open("/proc/stb/audio/btaudio", "r")
		can_btaudio = f.read().strip().split(" ")
		f.close()
	else:
		can_btaudio = False

	SystemInfo["CanBTAudio"] = can_btaudio

	if can_btaudio:
		def setBTAudio(configElement):
			f = open("/proc/stb/audio/btaudio", "w")
			f.write(configElement.value)
			f.close()
		choice_list = [("off", _("off")), ("on", _("on"))]
		config.av.btaudio = ConfigSelection(choices = choice_list, default = "off")
		config.av.btaudio.addNotifier(setBTAudio)
	else:
		config.av.btaudio = ConfigNothing()

	if os.path.exists("/proc/stb/audio/btaudio_delay"):
		f = open("/proc/stb/audio/btaudio_delay", "r")
		can_btaudio_delay = f.read().strip().split(" ")
		f.close()
	else:
		can_btaudio_delay = False

	SystemInfo["CanBTAudioDelay"] = can_btaudio_delay

	if can_btaudio_delay:
		def setBTAudioDelay(configElement):
			f = open("/proc/stb/audio/btaudio_delay", "w")
			f.write(format(configElement.value * 90,"x"))
			f.close()
		config.av.btaudiodelay = ConfigSelectionNumber(-1000, 1000, 5, default = 0)
		config.av.btaudiodelay.addNotifier(setBTAudioDelay)
	else:
		config.av.btaudiodelay = ConfigNothing()

	if os.path.exists("/proc/stb/vmpeg/0/pep_scaler_sharpness"):
		def setScaler_sharpness(config):
			myval = int(config.value)
			try:
				print "[AVSwitch] setting scaler_sharpness to: %0.8X" % myval
				f = open("/proc/stb/vmpeg/0/pep_scaler_sharpness", "w")
				f.write("%0.8X\n" % myval)
				f.close()
				f = open("/proc/stb/vmpeg/0/pep_apply", "w")
				f.write("1")
				f.close()
			except IOError:
				print "[AVSwitch] couldn't write pep_scaler_sharpness"

		if getBoxType() in ('gbquad', 'gbquadplus'):
			config.av.scaler_sharpness = ConfigSlider(default=5, limits=(0,26))
		else:
			config.av.scaler_sharpness = ConfigSlider(default=13, limits=(0,26))
		config.av.scaler_sharpness.addNotifier(setScaler_sharpness)
	else:
		config.av.scaler_sharpness = NoSave(ConfigNothing())

	iAVSwitch.setConfiguredMode()
コード例 #54
0
ファイル: AVSwitch.py プロジェクト: mosadraja/enigma2-3
class AVSwitch:
	hw_type = HardwareInfo().get_device_name()
	rates = { } # high-level, use selectable modes.
	modes = { }  # a list of (high-level) modes for a certain port.

	rates["PAL"] =		{	"50Hz":		{ 50: "pal" },
							"60Hz":		{ 60: "pal60" },
							"multi":	{ 50: "pal", 60: "pal60" } }

	rates["NTSC"] =		{	"60Hz":		{ 60: "ntsc" } }

	rates["Multi"] =	{	"multi":	{ 50: "pal", 60: "ntsc" } }

	rates["480i"] =		{	"60Hz":		{ 60: "480i" } }

	rates["576i"] =		{	"50Hz":		{ 50: "576i" } }

	rates["480p"] =		{	"60Hz":		{ 60: "480p" } }

	rates["576p"] =		{	"50Hz":		{ 50: "576p" } }

	rates["720p"] =		{	"50Hz":		{ 50: "720p50" },
							"60Hz":		{ 60: "720p" },
							"multi":	{ 50: "720p50", 60: "720p" },
							"auto":		{ 50: "720p50", 60: "720p", 24: "720p24" } }

	rates["1080i"] =	{	"50Hz":		{ 50: "1080i50" },
							"60Hz":		{ 60: "1080i" },
							"multi":	{ 50: "1080i50", 60: "1080i" },
							"auto":		{ 50: "1080i50", 60: "1080i", 24: "1080p24" } }

	rates["1080p"] =	{ 	"50Hz":		{ 50: "1080p50" },
							"60Hz":		{ 60: "1080p" },
							"multi":	{ 50: "1080p50", 60: "1080p" },
							"auto":		{ 50: "1080p50", 60: "1080p", 24: "1080p24" } }

	if getBoxType().startswith('dm9'):
		rates["2160p"] =	{ 	"50Hz":		{ 50: "2160p50" },
								"60Hz":		{ 60: "2160p60" },
								"multi":	{ 50: "2160p50", 60: "2160p60" },
								"auto":		{ 50: "2160p50", 60: "2160p60", 24: "2160p24" } }
	else:
		rates["2160p"] =	{ 	"50Hz":		{ 50: "2160p50" },
								"60Hz":		{ 60: "2160p" },
								"multi":	{ 50: "2160p50", 60: "2160p" },
								"auto":		{ 50: "2160p50", 60: "2160p", 24: "2160p24" } }

	rates["2160p30"] =	{ 	"25Hz":		{ 50: "2160p25" },
							"30Hz":		{ 60: "2160p30"} ,
							"multi":	{ 50: "2160p25", 60: "2160p30" },
							"auto":		{ 50: "2160p25", 60: "2160p30", 24: "2160p24" } }

	rates["PC"] = {
		"1024x768":						{ 60: "1024x768" }, # not possible on DM7025
		"800x600" :						{ 60: "800x600" },  # also not possible
		"720x480" :						{ 60: "720x480" },
		"720x576" :						{ 60: "720x576" },
		"1280x720":						{ 60: "1280x720" },
		"1280x720 multi":				{ 50: "1280x720_50", 60: "1280x720" },
		"1920x1080":					{ 60: "1920x1080"},
		"1920x1080 multi":				{ 50: "1920x1080", 60: "1920x1080_50" },
		"1280x1024":					{ 60: "1280x1024"},
		"1366x768" :					{ 60: "1366x768"},
		"1366x768 multi":				{ 50: "1366x768", 60: "1366x768_50" },
		"1280x768":						{ 60: "1280x768" },
		"640x480" :						{ 60: "640x480" }
	}

	modes["Scart"] = ["PAL", "NTSC", "Multi"]
	# modes["DVI-PC"] = ["PC"]

	if (about.getChipSetString() in ('7366', '7376', '5272s', '7444', '7445', '7445s')):
		modes["HDMI"] = ["720p", "1080p", "2160p", "1080i", "576p", "576i", "480p", "480i"]
		widescreen_modes = {"720p", "1080p", "1080i", "2160p"}
	elif (about.getChipSetString() in ('7252', '7251', '7251S', '7252S', '7251s', '7252s', '72604', '7278', '7444s', '3798mv200', '3798cv200', 'hi3798mv200', 'hi3798cv200')):
		modes["HDMI"] = ["720p", "1080p", "2160p", "2160p30", "1080i", "576p", "576i", "480p", "480i"]
		widescreen_modes = {"720p", "1080p", "1080i", "2160p", "2160p30"}
	elif (about.getChipSetString() in ('7241', '7358', '7362', '73625', '7346', '7356', '73565', '7424', '7425', '7435', '7552', '7581', '7584', '75845', '7585', 'pnx8493', '7162', '7111', '3716mv410', 'hi3716mv410', 'hi3716mv430')) or (getBrandOEM() in ('azbox')):
		modes["HDMI"] = ["720p", "1080p", "1080i", "576p", "576i", "480p", "480i"]
		widescreen_modes = {"720p", "1080p", "1080i"}
	elif about.getChipSetString() in ('meson-6',):
		modes["HDMI"] = ["720p", "1080p", "1080i"]
		widescreen_modes = {"720p", "1080p", "1080i"}
	elif about.getChipSetString() in ('meson-64','S905D'):
		modes["HDMI"] = ["720p", "1080p", "2160p", "2160p30", "1080i"]
		widescreen_modes = {"720p", "1080p", "1080i", "2160p", "2160p30"}
	else:
		modes["HDMI"] = ["720p", "1080i", "576p", "576i", "480p", "480i"]
		widescreen_modes = {"720p", "1080i"}

	modes["YPbPr"] = modes["HDMI"]
	if has_scartyuv:
		modes["Scart-YPbPr"] = modes["HDMI"]

	# if modes.has_key("DVI-PC") and not getModeList("DVI-PC"):
	# 	print "[AVSwitch] remove DVI-PC because of not existing modes"
	# 	del modes["DVI-PC"]
	if modes.has_key("YPbPr") and not has_yuv:
		del modes["YPbPr"]
	if modes.has_key("Scart") and not has_scart and not has_rca and not has_avjack:
			del modes["Scart"]
		
	if getBoxType() in ('mutant2400',):
		f = open("/proc/stb/info/board_revision", "r").read()
		if f >= "2":
			del modes["YPbPr"]

	def __init__(self):
		self.last_modes_preferred =  [ ]
		self.on_hotplug = CList()
		self.current_mode = None
		self.current_port = None

		self.readAvailableModes()
		self.is24hzAvailable()

		self.readPreferredModes()
		self.createConfig()


	def readAvailableModes(self):
		try:
			f = open("/proc/stb/video/videomode_choices")
			modes = f.read()[:-1]
			f.close()
		except IOError:
			print "[AVSwitch] couldn't read available videomodes."
			modes = [ ]
			return modes
		return modes.split(' ')

	def readPreferredModes(self):
		if config.av.edid_override.value == False:
			try:
				f = open("/proc/stb/video/videomode_edid")
				modes = f.read()[:-1]
				f.close()
				self.modes_preferred = modes.split(' ')
				print "[AVSwitch] reading edid modes: ", self.modes_preferred
			except IOError:
				print "[AVSwitch] reading edid modes failed, using all modes"
				try:
					f = open("/proc/stb/video/videomode_preferred")
					modes = f.read()[:-1]
					f.close()
					self.modes_preferred = modes.split(' ')
					print "[AVSwitch] reading _preferred modes: ", self.modes_preferred
				except IOError:
					print "[AVSwitch] reading preferred modes failed, using all modes"
					self.modes_preferred = self.readAvailableModes()
		else:
			self.modes_preferred = self.readAvailableModes()
			print "[AVSwitch] used default modes: ", self.modes_preferred
			
		if len(self.modes_preferred) <= 2:
			print "[AVSwitch] preferend modes not ok, possible driver failer, len=", len(self.modes_preferred)
			self.modes_preferred = self.readAvailableModes()

		if self.modes_preferred != self.last_modes_preferred:
			self.last_modes_preferred = self.modes_preferred
			self.on_hotplug("HDMI") # must be HDMI

	def is24hzAvailable(self):
		try:
			self.has24pAvailable = os.access("/proc/stb/video/videomode_24hz", os.W_OK) and True or False
		except IOError:
			print "[AVSwitch] failed to read video choices 24hz ."
			self.has24pAvailable = False
		SystemInfo["have24hz"] = self.has24pAvailable

	# check if a high-level mode with a given rate is available.
	def isModeAvailable(self, port, mode, rate):
		rate = self.rates[mode][rate]
		for mode in rate.values():
			if port == "DVI":
				if getBrandOEM() in ('azbox',):
					if mode not in self.modes_preferred and not config.av.edid_override.value:
						print "[AVSwitch] no, not preferred"
						return False
			if port != "HDMI":
				if mode not in self.readAvailableModes():
					return False
			elif mode not in self.modes_preferred:
				return False
		return True

	def isWidescreenMode(self, port, mode):
		return mode in self.widescreen_modes

	def setMode(self, port, mode, rate, force = None):
		print "[AVSwitch] setMode - port: %s, mode: %s, rate: %s" % (port, mode, rate)

		# config.av.videoport.setValue(port)
		# we can ignore "port"
		self.current_mode = mode
		self.current_port = port
		modes = self.rates[mode][rate]


		mode_50 = modes.get(50)
		mode_60 = modes.get(60)
		mode_24 = modes.get(24)

		if mode_50 is None or force == 60:
			mode_50 = mode_60
		if mode_60 is None or force == 50:
			mode_60 = mode_50
		if mode_24 is None or force:
			mode_24 = mode_60
			if force == 50:
				mode_24 = mode_50

		try:
			f = open("/proc/stb/video/videomode_50hz", "w")
			f.write(mode_50)
			f.close()
			f = open("/proc/stb/video/videomode_60hz", "w")
			f.write(mode_60)
			f.close()
		except IOError:
			try:
				# fallback if no possibility to setup 50/60 hz mode
				f = open("/proc/stb/video/videomode", "w")
				f.write(mode_50)
				f.close()
			except IOError:
				print "[AVSwitch] setting videomode failed."

		if SystemInfo["have24hz"]:
			try:
				open("/proc/stb/video/videomode_24hz", "w").write(mode_24)
			except IOError:
				print "[VideoHardware] cannot open /proc/stb/video/videomode_24hz"

		if getBrandOEM() in ('gigablue',):
			try:
				# use 50Hz mode (if available) for booting
				f = open("/etc/videomode", "w")
				f.write(mode_50)
				f.close()
			except IOError:
				print "[AVSwitch] writing initial videomode to /etc/videomode failed."

		map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
		self.setColorFormat(map[config.av.colorformat.value])

		if about.getCPUString().startswith('STx'):
			#call setResolution() with -1,-1 to read the new scrren dimensions without changing the framebuffer resolution
			from enigma import gMainDC
			gMainDC.getInstance().setResolution(-1, -1)

	def saveMode(self, port, mode, rate):
		config.av.videoport.setValue(port)
		config.av.videoport.save()
		if port in config.av.videomode:
			config.av.videomode[port].setValue(mode)
			config.av.videomode[port].save()
		if mode in config.av.videorate:
			config.av.videorate[mode].setValue(rate)
			config.av.videorate[mode].save()

	def isPortAvailable(self, port):
		# fixme
		return True

	def isPortUsed(self, port):
		if port == "HDMI":
			self.readPreferredModes()
			return len(self.modes_preferred) != 0
		else:
			return True

	def getPortList(self):
		return [port for port in self.modes if self.isPortAvailable(port)]

	# get a list with all modes, with all rates, for a given port.
	def getModeList(self, port):
		res = [ ]
		for mode in self.modes[port]:
			# list all rates which are completely valid
			rates = [rate for rate in self.rates[mode] if self.isModeAvailable(port, mode, rate)]

			# if at least one rate is ok, add this mode
			if len(rates):
				res.append( (mode, rates) )
		return res

	def createConfig(self, *args):
		hw_type = HardwareInfo().get_device_name()
		has_hdmi = HardwareInfo().has_hdmi()
		lst = []

		config.av.videomode = ConfigSubDict()
		config.av.autores_mode_sd = ConfigSubDict()
		config.av.autores_mode_hd = ConfigSubDict()
		config.av.autores_mode_fhd = ConfigSubDict()
		config.av.autores_mode_uhd = ConfigSubDict()
		config.av.videorate = ConfigSubDict()
		config.av.autores_rate_sd = ConfigSubDict()
		config.av.autores_rate_hd = ConfigSubDict()
		config.av.autores_rate_fhd = ConfigSubDict()
		config.av.autores_rate_uhd = ConfigSubDict()

		# create list of output ports
		portlist = self.getPortList()
		for port in portlist:
			descr = port
			if 'HDMI' in port:
				lst.insert(0, (port, descr))
			else:
				lst.append((port, descr))

			modes = self.getModeList(port)
			if len(modes):
				config.av.videomode[port] = ConfigSelection(choices = [mode for (mode, rates) in modes])
				config.av.autores_mode_sd[port] = ConfigSelection(choices = [mode for (mode, rates) in modes])
				config.av.autores_mode_hd[port] = ConfigSelection(choices = [mode for (mode, rates) in modes])
				config.av.autores_mode_fhd[port] = ConfigSelection(choices = [mode for (mode, rates) in modes])
				config.av.autores_mode_uhd[port] = ConfigSelection(choices = [mode for (mode, rates) in modes])
			for (mode, rates) in modes:
				ratelist = []
				for rate in rates:
					if rate in ("auto") and not SystemInfo["have24hz"]:
						continue
					ratelist.append((rate, rate))
				config.av.videorate[mode] = ConfigSelection(choices = ratelist)
				config.av.autores_rate_sd[mode] = ConfigSelection(choices = ratelist)
				config.av.autores_rate_hd[mode] = ConfigSelection(choices = ratelist)
				config.av.autores_rate_fhd[mode] = ConfigSelection(choices = ratelist)
				config.av.autores_rate_uhd[mode] = ConfigSelection(choices = ratelist)
		config.av.videoport = ConfigSelection(choices = lst)

	def setInput(self, input):
		INPUT = { "ENCODER": 0, "SCART": 1, "AUX": 2 }
		eAVSwitch.getInstance().setInput(INPUT[input])

	def setColorFormat(self, value):
		if not self.current_port:
			self.current_port = config.av.videoport.value
		if self.current_port in ("YPbPr", "Scart-YPbPr"):
			eAVSwitch.getInstance().setColorFormat(3)
		elif self.current_port in ("RCA"):
			eAVSwitch.getInstance().setColorFormat(0)
		else:
			eAVSwitch.getInstance().setColorFormat(value)

	def setConfiguredMode(self):
		port = config.av.videoport.value
		if port not in config.av.videomode:
			print "[AVSwitch] current port not available, not setting videomode"
			return

		mode = config.av.videomode[port].value

		if mode not in config.av.videorate:
			print "[AVSwitch] current mode not available, not setting videomode"
			return

		rate = config.av.videorate[mode].value
		self.setMode(port, mode, rate)

	def setAspect(self, cfgelement):
		print "[AVSwitch] setting aspect: %s" % cfgelement.value
		try:
			f = open("/proc/stb/video/aspect", "w")
			f.write(cfgelement.value)
			f.close()
		except IOError:
			print "[AVSwitch] setting aspect failed."

	def setWss(self, cfgelement):
		if not cfgelement.value:
			wss = "auto(4:3_off)"
		else:
			wss = "auto"
		if os.path.exists("/proc/stb/denc/0/wss"):
			print "[AVSwitch] setting wss: %s" % wss
			f = open("/proc/stb/denc/0/wss", "w")
			f.write(wss)
			f.close()

	def setPolicy43(self, cfgelement):
		print "[AVSwitch] setting policy: %s" % cfgelement.value
		arw = "0"
		try:
			if about.getChipSetString() in ('meson-6', 'meson-64'):
				if cfgelement.value == "panscan" : arw = "11"
				if cfgelement.value == "letterbox" : arw = "12"
				if cfgelement.value == "bestfit" : arw = "10"
				open("/sys/class/video/screen_mode", "w").write(arw)
			else:
				f = open("/proc/stb/video/policy", "w")
				f.write(cfgelement.value)
				f.close()
		except IOError:
			print "[AVSwitch] setting policy43 failed."

	def setPolicy169(self, cfgelement):
		if os.path.exists("/proc/stb/video/policy2"):
			print "[AVSwitch] setting policy2: %s" % cfgelement.value
			f = open("/proc/stb/video/policy2", "w")
			f.write(cfgelement.value)
			f.close()

	def getOutputAspect(self):
		ret = (16,9)
		port = config.av.videoport.value
		if port not in config.av.videomode:
			print "current port not available in getOutputAspect!!! force 16:9"
		else:
			mode = config.av.videomode[port].value
			force_widescreen = self.isWidescreenMode(port, mode)
			is_widescreen = force_widescreen or config.av.aspect.value in ("16:9", "16:10")
			is_auto = config.av.aspect.value == "auto"
			if is_widescreen:
				if force_widescreen:
					pass
				else:
					aspect = {"16:9": "16:9", "16:10": "16:10"}[config.av.aspect.value]
					if aspect == "16:10":
						ret = (16,10)
			elif is_auto:
				try:
					aspect_str = open("/proc/stb/vmpeg/0/aspect", "r").read()
					if aspect_str == "1": # 4:3
						ret = (4,3)
				except IOError:
					pass
			else:  # 4:3
				ret = (4,3)
		return ret

	def getFramebufferScale(self):
		aspect = self.getOutputAspect()
		fb_size = getDesktop(0).size()
		return aspect[0] * fb_size.height(), aspect[1] * fb_size.width()

	def setAspectRatio(self, value):
		eAVSwitch.getInstance().setAspectRatio(value)

	def getAspectRatioSetting(self):
		valstr = config.av.aspectratio.value
		if valstr == "4_3_letterbox":
			val = 0
		elif valstr == "4_3_panscan":
			val = 1
		elif valstr == "16_9":
			val = 2
		elif valstr == "16_9_always":
			val = 3
		elif valstr == "16_10_letterbox":
			val = 4
		elif valstr == "16_10_panscan":
			val = 5
		elif valstr == "16_9_letterbox":
			val = 6
		return val
コード例 #55
0
ファイル: Lcd.py プロジェクト: Openesi2/gui
def InitLcd():
    if getBoxType() in (
            'force4', 'alien5', 'viperslim', 'lunix', 'lunix4k', 'purehdse',
            'vipert2c', 'evoslimse', 'evoslimt2c', 'valalinux', 'tmtwin4k',
            'tmnanom3', 'mbmicrov2', 'revo4k', 'force3uhd', 'force2nano',
            'evoslim', 'wetekplay', 'wetekplay2', 'wetekhub', 'ultrabox',
            'novaip', 'dm520', 'dm525', 'purehd', 'mutant11', 'xpeedlxpro',
            'zgemmai55', 'sf98', 'et7x00mini', 'xpeedlxcs2', 'xpeedlxcc',
            'e4hd', 'e4hdhybrid', 'mbmicro', 'beyonwizt2', 'amikomini',
            'dynaspark', 'amiko8900', 'sognorevolution', 'arguspingulux',
            'arguspinguluxmini', 'arguspinguluxplus', 'sparkreloaded',
            'sabsolo', 'sparklx', 'gis8120', 'gb800se', 'gb800solo',
            'gb800seplus', 'gbultrase', 'gbipbox', 'tmsingle', 'tmnano2super',
            'iqonios300hd', 'iqonios300hdv2', 'optimussos1plus', 'optimussos1',
            'vusolo', 'et4x00', 'et5x00', 'et6x00', 'et7000', 'et7100',
            'mixosf7', 'mixoslumi', 'gbx1', 'gbx2', 'gbx3', 'gbx3h'):
        detected = False
    else:
        detected = eDBoxLCD.getInstance().detected()
    SystemInfo["Display"] = detected
    config.lcd = ConfigSubsection()

    if fileExists("/proc/stb/lcd/mode"):
        f = open("/proc/stb/lcd/mode", "r")
        can_lcdmodechecking = f.read()
        f.close()
    else:
        can_lcdmodechecking = False
    SystemInfo["LCDMiniTV"] = can_lcdmodechecking

    if detected:
        ilcd = LCD()
        if can_lcdmodechecking:

            def setLCDModeMinitTV(configElement):
                try:
                    print 'setLCDModeMinitTV', configElement.value
                    f = open("/proc/stb/lcd/mode", "w")
                    f.write(configElement.value)
                    f.close()
                except:
                    pass

            def setMiniTVFPS(configElement):
                try:
                    print 'setMiniTVFPS', configElement.value
                    f = open("/proc/stb/lcd/fps", "w")
                    f.write("%d \n" % configElement.value)
                    f.close()
                except:
                    pass

            def setLCDModePiP(configElement):
                pass

            def setLCDScreenshot(configElement):
                ilcd.setScreenShot(configElement.value)

            config.lcd.modepip = ConfigSelection(choices={
                "0": _("off"),
                "5": _("PIP"),
                "7": _("PIP with OSD")
            },
                                                 default="0")
            if config.misc.boxtype.value in ('gbquad', 'gbquadplus'):
                config.lcd.modepip.addNotifier(setLCDModePiP)
            else:
                config.lcd.modepip = ConfigNothing()
            config.lcd.screenshot = ConfigYesNo(default=False)
            config.lcd.screenshot.addNotifier(setLCDScreenshot)

            config.lcd.modeminitv = ConfigSelection(choices={
                "0": _("normal"),
                "1": _("MiniTV"),
                "2": _("OSD"),
                "3": _("MiniTV with OSD")
            },
                                                    default="0")
            config.lcd.fpsminitv = ConfigSlider(default=30, limits=(0, 30))
            config.lcd.modeminitv.addNotifier(setLCDModeMinitTV)
            config.lcd.fpsminitv.addNotifier(setMiniTVFPS)
        else:
            config.lcd.modeminitv = ConfigNothing()
            config.lcd.screenshot = ConfigNothing()
            config.lcd.fpsminitv = ConfigNothing()

        config.lcd.scroll_speed = ConfigSelection(default="300",
                                                  choices=[("500", _("slow")),
                                                           ("300",
                                                            _("normal")),
                                                           ("100", _("fast"))])
        config.lcd.scroll_delay = ConfigSelection(
            default="10000",
            choices=[("10000", "10 " + _("seconds")),
                     ("20000", "20 " + _("seconds")),
                     ("30000", "30 " + _("seconds")),
                     ("60000", "1 " + _("minute")),
                     ("300000", "5 " + _("minutes")),
                     ("noscrolling", _("off"))])

        def setLCDbright(configElement):
            ilcd.setBright(configElement.value)

        def setLCDstandbybright(configElement):
            ilcd.setStandbyBright(configElement.value)

        def setLCDdimbright(configElement):
            ilcd.setDimBright(configElement.value)

        def setLCDdimdelay(configElement):
            ilcd.setDimDelay(configElement.value)

        def setLCDcontrast(configElement):
            ilcd.setContrast(configElement.value)

        def setLCDinverted(configElement):
            ilcd.setInverted(configElement.value)

        def setLCDflipped(configElement):
            ilcd.setFlipped(configElement.value)

        def setLCDmode(configElement):
            ilcd.setMode(configElement.value)

        def setLCDpower(configElement):
            ilcd.setPower(configElement.value)

        def setfblcddisplay(configElement):
            ilcd.setfblcddisplay(configElement.value)

        def setLCDshowoutputresolution(configElement):
            ilcd.setShowoutputresolution(configElement.value)

        def setLCDminitvmode(configElement):
            ilcd.setLCDMiniTVMode(configElement.value)

        def setLCDminitvpipmode(configElement):
            ilcd.setLCDMiniTVPIPMode(configElement.value)

        def setLCDminitvfps(configElement):
            ilcd.setLCDMiniTVFPS(configElement.value)

        def setLEDnormalstate(configElement):
            ilcd.setLEDNormalState(configElement.value)

        def setLEDdeepstandby(configElement):
            ilcd.setLEDDeepStandbyState(configElement.value)

        def setLEDblinkingtime(configElement):
            ilcd.setLEDBlinkingTime(configElement.value)

        def setPowerLEDstate(configElement):
            if fileExists("/proc/stb/power/powerled"):
                f = open("/proc/stb/power/powerled", "w")
                f.write(configElement.value)
                f.close()

        def setPowerLEDstanbystate(configElement):
            if fileExists("/proc/stb/power/standbyled"):
                f = open("/proc/stb/power/standbyled", "w")
                f.write(configElement.value)
                f.close()

        def setPowerLEDdeepstanbystate(configElement):
            if fileExists("/proc/stb/power/suspendled"):
                f = open("/proc/stb/power/suspendled", "w")
                f.write(configElement.value)
                f.close()

        def setXcoreVFD(configElement):
            if fileExists(
                    "/sys/module/brcmstb_osmega/parameters/pt6302_cgram"):
                f = open("/sys/module/brcmstb_osmega/parameters/pt6302_cgram",
                         "w")
                f.write(configElement.value)
                f.close()
            if fileExists(
                    "/sys/module/brcmstb_spycat4k/parameters/pt6302_cgram"):
                f = open(
                    "/sys/module/brcmstb_spycat4k/parameters/pt6302_cgram",
                    "w")
                f.write(configElement.value)
                f.close()
            if fileExists(
                    "/sys/module/brcmstb_spycat4kmini/parameters/pt6302_cgram"
            ):
                f = open(
                    "/sys/module/brcmstb_spycat4kmini/parameters/pt6302_cgram",
                    "w")
                f.write(configElement.value)
                f.close()
            if fileExists(
                    "/sys/module/brcmstb_spycat4kcombo/parameters/pt6302_cgram"
            ):
                f = open(
                    "/sys/module/brcmstb_spycat4kcombo/parameters/pt6302_cgram",
                    "w")
                f.write(configElement.value)
                f.close()

        config.usage.vfd_xcorevfd = ConfigSelection(default="0",
                                                    choices=[
                                                        ("0",
                                                         _("12 character")),
                                                        ("1", _("8 character"))
                                                    ])
        config.usage.vfd_xcorevfd.addNotifier(setXcoreVFD)

        config.usage.lcd_powerled = ConfigSelection(default="on",
                                                    choices=[("off", _("Off")),
                                                             ("on", _("On"))])
        config.usage.lcd_powerled.addNotifier(setPowerLEDstate)

        config.usage.lcd_standbypowerled = ConfigSelection(default="on",
                                                           choices=[("off",
                                                                     _("Off")),
                                                                    ("on",
                                                                     _("On"))])
        config.usage.lcd_standbypowerled.addNotifier(setPowerLEDstanbystate)

        config.usage.lcd_deepstandbypowerled = ConfigSelection(
            default="on", choices=[("off", _("Off")), ("on", _("On"))])
        config.usage.lcd_deepstandbypowerled.addNotifier(
            setPowerLEDdeepstanbystate)

        if getBoxType() in ('dm900', 'dm920', 'e4hdultra', 'protek4k'):
            standby_default = 4
        elif getBoxType() in ('spycat4kmini', 'osmega'):
            standby_default = 10
        else:
            standby_default = 1

        if not ilcd.isOled():
            config.lcd.contrast = ConfigSlider(default=5, limits=(0, 20))
            config.lcd.contrast.addNotifier(setLCDcontrast)
        else:
            config.lcd.contrast = ConfigNothing()

        if getBoxType() in ('novatwin', 'novacombo', 'mixosf5', 'mixosf5mini',
                            'gi9196m', 'gi9196lite', 'zgemmas2s', 'zgemmash1',
                            'zgemmash2', 'zgemmass', 'zgemmahs', 'zgemmah2s',
                            'zgemmah2h', 'spycat'):
            config.lcd.standby = ConfigSlider(default=standby_default,
                                              limits=(0, 4))
            config.lcd.dimbright = ConfigSlider(default=standby_default,
                                                limits=(0, 4))
            config.lcd.bright = ConfigSlider(default=4, limits=(0, 4))
        elif getBoxType() in ('spycat4kmini', 'osmega'):
            config.lcd.standby = ConfigSlider(default=standby_default,
                                              limits=(0, 10))
            config.lcd.dimbright = ConfigSlider(default=standby_default,
                                                limits=(0, 10))
            config.lcd.bright = ConfigSlider(default=10, limits=(0, 10))
        else:
            config.lcd.standby = ConfigSlider(default=standby_default,
                                              limits=(0, 10))
            config.lcd.dimbright = ConfigSlider(default=standby_default,
                                                limits=(0, 10))
            config.lcd.bright = ConfigSlider(
                default=SystemInfo["DefaultDisplayBrightness"], limits=(0, 10))
        config.lcd.dimbright.addNotifier(setLCDdimbright)
        config.lcd.dimbright.apply = lambda: setLCDdimbright(config.lcd.
                                                             dimbright)
        config.lcd.dimdelay = ConfigSelection(default="0",
                                              choices=[
                                                  ("5", "5 " + _("seconds")),
                                                  ("10", "10 " + _("seconds")),
                                                  ("15", "15 " + _("seconds")),
                                                  ("20", "20 " + _("seconds")),
                                                  ("30", "30 " + _("seconds")),
                                                  ("60", "1 " + _("minute")),
                                                  ("120", "2 " + _("minutes")),
                                                  ("300", "5 " + _("minutes")),
                                                  ("0", _("off"))
                                              ])
        config.lcd.dimdelay.addNotifier(setLCDdimdelay)
        config.lcd.standby.addNotifier(setLCDstandbybright)
        config.lcd.standby.apply = lambda: setLCDstandbybright(config.lcd.
                                                               standby)
        config.lcd.bright.addNotifier(setLCDbright)
        config.lcd.bright.apply = lambda: setLCDbright(config.lcd.bright)
        config.lcd.bright.callNotifiersOnSaveAndCancel = True

        config.lcd.invert = ConfigYesNo(default=False)
        config.lcd.invert.addNotifier(setLCDinverted)

        config.lcd.flip = ConfigYesNo(default=False)
        config.lcd.flip.addNotifier(setLCDflipped)

        if SystemInfo["LcdLiveTV"]:

            def lcdLiveTvChanged(configElement):
                open(SystemInfo["LcdLiveTV"],
                     "w").write(configElement.value and "0" or "1")
                from Screens.InfoBar import InfoBar
                InfoBarInstance = InfoBar.instance
                InfoBarInstance and InfoBarInstance.session.open(dummyScreen)

            config.lcd.showTv = ConfigYesNo(default=False)
            config.lcd.showTv.addNotifier(lcdLiveTvChanged)

        if SystemInfo["LCDMiniTV"] and config.misc.boxtype.value not in (
                'gbquad', 'gbquadplus', 'gbquad4k', 'gbue4k'):
            config.lcd.minitvmode = ConfigSelection(
                [("0", _("normal")), ("1", _("MiniTV")), ("2", _("OSD")),
                 ("3", _("MiniTV with OSD"))], "0")
            config.lcd.minitvmode.addNotifier(setLCDminitvmode)
            config.lcd.minitvpipmode = ConfigSelection(
                [("0", _("off")), ("5", _("PIP")),
                 ("7", _("PIP with OSD"))], "0")
            config.lcd.minitvpipmode.addNotifier(setLCDminitvpipmode)
            config.lcd.minitvfps = ConfigSlider(default=30, limits=(0, 30))
            config.lcd.minitvfps.addNotifier(setLCDminitvfps)

        if SystemInfo["VFD_scroll_repeats"] and getBoxType() not in (
                'ixussone',
                'ixusszero') and getDisplayType() not in ('7segment'):

            def scroll_repeats(el):
                open(SystemInfo["VFD_scroll_repeats"], "w").write(el.value)

            choicelist = [("0", _("None")), ("1", _("1X")), ("2", _("2X")),
                          ("3", _("3X")), ("4", _("4X")),
                          ("500", _("Continues"))]
            config.usage.vfd_scroll_repeats = ConfigSelection(
                default="3", choices=choicelist)
            config.usage.vfd_scroll_repeats.addNotifier(
                scroll_repeats, immediate_feedback=False)
        else:
            config.usage.vfd_scroll_repeats = ConfigNothing()

        if SystemInfo["VFD_scroll_delay"] and getBoxType() not in (
                'ixussone',
                'ixusszero') and getDisplayType() not in ('7segment'):

            def scroll_delay(el):
                # add workaround for Boxes who need hex code
                if getBoxType() in ('sf4008', 'beyonwizu4'):
                    open(SystemInfo["VFD_scroll_delay"],
                         "w").write(hex(int(el.value)))
                else:
                    open(SystemInfo["VFD_scroll_delay"],
                         "w").write(str(el.value))

            config.usage.vfd_scroll_delay = ConfigSlider(default=150,
                                                         increment=10,
                                                         limits=(0, 500))
            config.usage.vfd_scroll_delay.addNotifier(scroll_delay,
                                                      immediate_feedback=False)
            config.lcd.hdd = ConfigSelection([("0", _("No")), ("1", _("Yes"))],
                                             "1")
        else:
            config.lcd.hdd = ConfigNothing()
            config.usage.vfd_scroll_delay = ConfigNothing()

        if SystemInfo["VFD_initial_scroll_delay"] and getBoxType() not in (
                'ixussone',
                'ixusszero') and getDisplayType() not in ('7segment'):

            def initial_scroll_delay(el):
                if getBoxType() in ('sf4008', 'beyonwizu4'):
                    # add workaround for Boxes who need hex code
                    open(SystemInfo["VFD_initial_scroll_delay"],
                         "w").write(hex(int(el.value)))
                else:
                    open(SystemInfo["VFD_initial_scroll_delay"],
                         "w").write(el.value)

            choicelist = [("3000", "3 " + _("seconds")),
                          ("5000", "5 " + _("seconds")),
                          ("10000", "10 " + _("seconds")),
                          ("20000", "20 " + _("seconds")),
                          ("30000", "30 " + _("seconds")),
                          ("0", _("no delay"))]
            config.usage.vfd_initial_scroll_delay = ConfigSelection(
                default="10000", choices=choicelist)
            config.usage.vfd_initial_scroll_delay.addNotifier(
                initial_scroll_delay, immediate_feedback=False)
        else:
            config.usage.vfd_initial_scroll_delay = ConfigNothing()

        if SystemInfo["VFD_final_scroll_delay"] and getBoxType() not in (
                'ixussone',
                'ixusszero') and getDisplayType() not in ('7segment'):

            def final_scroll_delay(el):
                if getBoxType() in ('sf4008', 'beyonwizu4'):
                    # add workaround for Boxes who need hex code
                    open(SystemInfo["VFD_final_scroll_delay"],
                         "w").write(hex(int(el.value)))
                else:
                    open(SystemInfo["VFD_final_scroll_delay"],
                         "w").write(el.value)

            choicelist = [("3000", "3 " + _("seconds")),
                          ("5000", "5 " + _("seconds")),
                          ("10000", "10 " + _("seconds")),
                          ("20000", "20 " + _("seconds")),
                          ("30000", "30 " + _("seconds")),
                          ("0", _("no delay"))]
            config.usage.vfd_final_scroll_delay = ConfigSelection(
                default="10000", choices=choicelist)
            config.usage.vfd_final_scroll_delay.addNotifier(
                final_scroll_delay, immediate_feedback=False)
        else:
            config.usage.vfd_final_scroll_delay = ConfigNothing()

        if fileExists("/proc/stb/lcd/show_symbols"):
            config.lcd.mode = ConfigSelection([("0", _("No")),
                                               ("1", _("Yes"))], "1")
            config.lcd.mode.addNotifier(setLCDmode)
        else:
            config.lcd.mode = ConfigNothing()

        if fileExists("/proc/stb/power/vfd") or fileExists(
                "/proc/stb/lcd/vfd"):
            config.lcd.power = ConfigSelection([("0", _("No")),
                                                ("1", _("Yes"))], "1")
            config.lcd.power.addNotifier(setLCDpower)
        else:
            config.lcd.power = ConfigNothing()

        if fileExists("/proc/stb/fb/sd_detach"):
            config.lcd.fblcddisplay = ConfigSelection([("1", _("No")),
                                                       ("0", _("Yes"))], "1")
            config.lcd.fblcddisplay.addNotifier(setfblcddisplay)
        else:
            config.lcd.fblcddisplay = ConfigNothing()

        if fileExists("/proc/stb/lcd/show_outputresolution"):
            config.lcd.showoutputresolution = ConfigSelection(
                [("0", _("No")), ("1", _("Yes"))], "1")
            config.lcd.showoutputresolution.addNotifier(
                setLCDshowoutputresolution)
        else:
            config.lcd.showoutputresolution = ConfigNothing()

        if getBoxType() == 'vuultimo':
            config.lcd.ledblinkingtime = ConfigSlider(default=5,
                                                      increment=1,
                                                      limits=(0, 15))
            config.lcd.ledblinkingtime.addNotifier(setLEDblinkingtime)
            config.lcd.ledbrightnessdeepstandby = ConfigSlider(default=1,
                                                               increment=1,
                                                               limits=(0, 15))
            config.lcd.ledbrightnessdeepstandby.addNotifier(setLEDnormalstate)
            config.lcd.ledbrightnessdeepstandby.addNotifier(setLEDdeepstandby)
            config.lcd.ledbrightnessdeepstandby.apply = lambda: setLEDdeepstandby(
                config.lcd.ledbrightnessdeepstandby)
            config.lcd.ledbrightnessstandby = ConfigSlider(default=1,
                                                           increment=1,
                                                           limits=(0, 15))
            config.lcd.ledbrightnessstandby.addNotifier(setLEDnormalstate)
            config.lcd.ledbrightnessstandby.apply = lambda: setLEDnormalstate(
                config.lcd.ledbrightnessstandby)
            config.lcd.ledbrightness = ConfigSlider(default=3,
                                                    increment=1,
                                                    limits=(0, 15))
            config.lcd.ledbrightness.addNotifier(setLEDnormalstate)
            config.lcd.ledbrightness.apply = lambda: setLEDnormalstate(
                config.lcd.ledbrightness)
            config.lcd.ledbrightness.callNotifiersOnSaveAndCancel = True
        else:

            def doNothing():
                pass

            config.lcd.ledbrightness = ConfigNothing()
            config.lcd.ledbrightness.apply = lambda: doNothing()
            config.lcd.ledbrightnessstandby = ConfigNothing()
            config.lcd.ledbrightnessstandby.apply = lambda: doNothing()
            config.lcd.ledbrightnessdeepstandby = ConfigNothing()
            config.lcd.ledbrightnessdeepstandby.apply = lambda: doNothing()
            config.lcd.ledblinkingtime = ConfigNothing()
    else:

        def doNothing():
            pass

        config.lcd.contrast = ConfigNothing()
        config.lcd.bright = ConfigNothing()
        config.lcd.standby = ConfigNothing()
        config.lcd.bright.apply = lambda: doNothing()
        config.lcd.standby.apply = lambda: doNothing()
        config.lcd.power = ConfigNothing()
        config.lcd.fblcddisplay = ConfigNothing()
        config.lcd.mode = ConfigNothing()
        config.lcd.hdd = ConfigNothing()
        config.lcd.scroll_speed = ConfigSelection(default="300",
                                                  choices=[("500", _("slow")),
                                                           ("300",
                                                            _("normal")),
                                                           ("100", _("fast"))])
        config.lcd.scroll_delay = ConfigSelection(
            default="10000",
            choices=[("10000", "10 " + _("seconds")),
                     ("20000", "20 " + _("seconds")),
                     ("30000", "30 " + _("seconds")),
                     ("60000", "1 " + _("minute")),
                     ("300000", "5 " + _("minutes")),
                     ("noscrolling", _("off"))])
        config.lcd.showoutputresolution = ConfigNothing()
        config.lcd.ledbrightness = ConfigNothing()
        config.lcd.ledbrightness.apply = lambda: doNothing()
        config.lcd.ledbrightnessstandby = ConfigNothing()
        config.lcd.ledbrightnessstandby.apply = lambda: doNothing()
        config.lcd.ledbrightnessdeepstandby = ConfigNothing()
        config.lcd.ledbrightnessdeepstandby.apply = lambda: doNothing()
        config.lcd.ledblinkingtime = ConfigNothing()

    config.misc.standbyCounter.addNotifier(standbyCounterChanged,
                                           initial_call=False)
コード例 #56
0
        leds += 1

    return leds


SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output()
SystemInfo["ZapMode"] = fileCheck("/proc/stb/video/zapmode") or fileCheck(
    "/proc/stb/video/zapping_mode")
SystemInfo["NumFrontpanelLEDs"] = countFrontpanelLEDs()
SystemInfo["FrontpanelDisplay"] = fileExists("/dev/dbox/oled0") or fileExists(
    "/dev/dbox/lcd0")
SystemInfo["OledDisplay"] = fileExists("/dev/dbox/oled0") or fileExists(
    resolveFilename(
        SCOPE_SKIN, 'display/skin_display_picon.xml')) or fileExists(
            resolveFilename(SCOPE_SKIN, 'vfd_skin/skin_display_no_picon.xml')
        ) or getBoxType() in ('osminiplus')
SystemInfo["LcdDisplay"] = fileExists("/dev/dbox/lcd0")
SystemInfo["DeepstandbySupport"] = HardwareInfo().has_deepstandby()
SystemInfo["Fan"] = fileExists("/proc/stb/fp/fan")
SystemInfo["FanPWM"] = SystemInfo["Fan"] and fileExists("/proc/stb/fp/fan_pwm")
SystemInfo["PowerLed"] = fileExists("/proc/stb/power/powerled")
SystemInfo["StandbyLED"] = fileExists("/proc/stb/power/standbyled")
SystemInfo["StandbyPowerLed"] = fileExists("/proc/stb/power/standbyled")
SystemInfo["SuspendPowerLed"] = fileExists("/proc/stb/power/suspendled")
SystemInfo["LedPowerColor"] = fileExists("/proc/stb/fp/ledpowercolor")
SystemInfo["LedStandbyColor"] = fileExists("/proc/stb/fp/ledstandbycolor")
SystemInfo["LedSuspendColor"] = fileExists("/proc/stb/fp/ledsuspendledcolor")
SystemInfo["Power4x7On"] = fileExists("/proc/stb/fp/power4x7on")
SystemInfo["Power4x7Standby"] = fileExists("/proc/stb/fp/power4x7standby")
SystemInfo["Power4x7Suspend"] = fileExists("/proc/stb/fp/power4x7suspend")
SystemInfo["FBLCDDisplay"] = fileCheck("/proc/stb/fb/sd_detach")
コード例 #57
0
from enigma import ePicLoad
from boxbranding import getBoxType
from Screens.Screen import Screen
from Components.ActionMap import ActionMap
from Components.Label import Label
from Components.ConfigList import ConfigListScreen
from Components.config import config, configfile, ConfigSubsection, ConfigSelection, getConfigListEntry
from Components.Pixmap import Pixmap
from Tools.Directories import resolveFilename, SCOPE_ACTIVE_SKIN

from os import path as os_path

if getBoxType() == "beyonwizu4":
    modelist = [
        ("507", _("Beyonwiz U4 (0xAE97)")),
        ("509", _("Beyonwiz U4/T4/T2 (0x02F3)")),
        ("508", _("Beyonwiz T2/T4 (0x02F2)")),
        ("510", _("Beyonwiz T2/T4 (0x02F4)")),
        ("506", _("Beyonwiz T3 (0xABCD)")),
        # ("16", _("Generic (0x00FF)")),
    ]
    imagemap = {
        "506": "ini5.png",
        "507": "BeyonwizU4.png",
        "508": "ini6.png",
        "509": "BeyonwizU4.png",
        "510": "ini6.png",
    }
else:
    modelist = [
        ("0", _("All supported")),
コード例 #58
0
ファイル: HardwareInfo.py プロジェクト: VytenisP/enigma2-3
 def has_deepstandby(self):
     return getBoxType() != 'dm800'
コード例 #59
0
	def poster_resize(self):
		if getBoxType() in ('sf108'):
			model = "sf108.png"
		elif getBoxType() in ('sf8008'):
			model = "sf8008.png"
		elif getBoxType() in ('sf4008'):
			model = "sf4008.png"
		elif getBoxType() in ('sf3038'):
			model = "sf3038.png"
		elif getBoxType() in ('sf128'):
			model = "sf128.png"
		elif getBoxType() in ('sf138'):
			model = "sf138.png"
		elif getBoxType() in ('sf208'):
			model = "sf208.png"
		elif getBoxType() in ('sf228'):
			model = "sf228.png"
		elif getBoxType() in ('sf98'):
			model = "sf98.png"
		elif getBoxType() in ('et8500', 'et8500s'):
			model = "et8500.jpg"
		elif getBoxType() in ('et9000', 'et9x00', 'et9200', 'et9500'):
			model = "et9x00.jpg"
		elif getBoxType() in ('et10000'):
			model = "et10000.jpg"
		else:
			model = None

		poster_path = "/usr/share/enigma2/%s" % model
		self["boxpic"].hide()
		sc = AVSwitch().getFramebufferScale()
		self.picload = ePicLoad()
		size = self["boxpic"].instance.size()
		self.picload.setPara((size.width(), size.height(), sc[0], sc[1], False, 1, "#00000000"))
		if self.picload.startDecode(poster_path, 0, 0, False) == 0:
			ptr = self.picload.getData()
			if ptr != None:
				self["boxpic"].instance.setPixmap(ptr)
				self["boxpic"].show()
コード例 #60
0
ファイル: SystemInfo.py プロジェクト: crayzy13/teamblu2
        return len(data) > 0
    return False


SystemInfo["NumVideoDecoders"] = getNumVideoDecoders()
SystemInfo["PIPAvailable"] = SystemInfo["NumVideoDecoders"] > 1
SystemInfo["CanMeasureFrontendInputPower"] = eDVBResourceManager.getInstance(
).canMeasureFrontendInputPower()
SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output()
SystemInfo["ZapMode"] = fileCheck("/proc/stb/video/zapmode") or fileCheck(
    "/proc/stb/video/zapping_mode")
SystemInfo["NumFrontpanelLEDs"] = countFrontpanelLEDs()
SystemInfo["FrontpanelDisplay"] = fileExists("/dev/dbox/oled0") or fileExists(
    "/dev/dbox/lcd0")
SystemInfo["LCDsymbol_circle_recording"] = fileCheck(
    "/proc/stb/lcd/symbol_circle") or getBoxType() in (
        "hd51", "vs1500") and fileCheck("/proc/stb/lcd/symbol_recording")
SystemInfo["LCDsymbol_timeshift"] = fileCheck("/proc/stb/lcd/symbol_timeshift")
SystemInfo["LCDshow_symbols"] = (getBoxType().startswith("et9")
                                 or getBoxType() in ("hd51", "vs1500")
                                 ) and fileCheck("/proc/stb/lcd/show_symbols")
SystemInfo["LCDsymbol_hdd"] = getBoxType() in (
    "hd51", "vs1500") and fileCheck("/proc/stb/lcd/symbol_hdd")
SystemInfo["FrontpanelDisplayGrayscale"] = fileExists("/dev/dbox/oled0")
SystemInfo["LcdDisplay"] = fileExists("/dev/dbox/lcd0")
SystemInfo["DeepstandbySupport"] = getBoxType() != "dm800"
SystemInfo["OledDisplay"] = fileExists(
    resolveFilename(SCOPE_SKIN, 'lcd_skin/skin_lcd_default.xml'))
SystemInfo["GraphicLCD"] = getBoxType() in ('quadbox2400')
SystemInfo["GBWOL"] = fileExists("/usr/bin/gigablue_wol")
SystemInfo["Fan"] = fileCheck("/proc/stb/fp/fan")