示例#1
0
def InitAVSwitch():
	config.av = ConfigSubsection()
	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.getValue():
		colorformat_choices["yuv"] = _("YPbPr")

	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 = "auto")
	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") and "auto" in open("/proc/stb/video/policy2_choices").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")})
	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.
	"pillarbox": _("Pillarbox"),
	# TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term
	"panscan": _("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)
	"scale": _("Just Scale")}
	if os.path.exists("/proc/stb/video/policy_choices") and "auto" in open("/proc/stb/video/policy_choices").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")})
	config.av.policy_43 = ConfigSelection(choices=policy_choices, default = "pillarbox")
	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)

	iAVSwitch = AVSwitch()

	def setColorFormat(configElement):
		map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
		iAVSwitch.setColorFormat(map[configElement.value])

	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])

	def setSystem(configElement):
		map = {"pal": 0, "ntsc": 1, "multinorm" : 2}
		iAVSwitch.setSystem(map[configElement.value])

	def setWSS(configElement):
		iAVSwitch.setAspectWSS()

	# this will call the "setup-val" initial
	config.av.colorformat.addNotifier(setColorFormat)
	config.av.aspectratio.addNotifier(setAspectRatio)
	config.av.tvsystem.addNotifier(setSystem)
	config.av.wss.addNotifier(setWSS)

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

	try:
		can_downmix = open("/proc/stb/audio/ac3_choices", "r").read()[:-1].find("downmix") != -1
	except:
		can_downmix = False

	SystemInfo["CanDownmixAC3"] = can_downmix
	if can_downmix:
		def setAC3Downmix(configElement):
			open("/proc/stb/audio/ac3", "w").write(configElement.value and "downmix" or "passthrough")
		config.av.downmix_ac3 = ConfigYesNo(default = True)
		config.av.downmix_ac3.addNotifier(setAC3Downmix)

	if os.path.exists("/proc/stb/vmpeg/0/pep_scaler_sharpness"):
		def setScaler_sharpness(config):
			myval = int(config.getValue())
			try:
				print "--> setting scaler_sharpness to: %0.8X" % myval
				open("/proc/stb/vmpeg/0/pep_scaler_sharpness", "w").write("%0.8X" % myval)
				open("/proc/stb/vmpeg/0/pep_apply", "w").write("1")
			except IOError:
				print "couldn't write pep_scaler_sharpness"

		config.av.scaler_sharpness = ConfigSlider(default=13, limits=(0,26))
		config.av.scaler_sharpness.addNotifier(setScaler_sharpness)
	else:
		config.av.scaler_sharpness = NoSave(ConfigNothing())
示例#2
0
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 openSPA 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"),
        "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.autores_2160p24 = ConfigSelection(choices={
        "2160p24": _("2160p 24Hz"),
        "2160p25": _("2160p 25Hz")
    },
                                                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.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)
        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")
                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/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', 'vuultimo4k'):
            config.av.hdmicolorspace = ConfigSelection(choices={
                "Edid(Auto)": _("Auto"),
                "Hdmi_Rgb": _("RGB"),
                "444": _("YCbCr444"),
                "422": _("YCbCr422"),
                "420": _("YCbCr420")
            },
                                                       default="Edid(Auto)")
        elif getBoxType() in ('dm900'):
            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":
            _("PIP enabled, no HDR"),
            "1":
            _("HDR, 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/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):
            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["CanPcmMultichannel"] = 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)

    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()

        choice_list = [("use_hdmi_caps", _("controlled by HDMI")),
                       ("force_ac3", _("always"))]
        config.av.transcodeac3plus = ConfigSelection(choices=choice_list,
                                                     default="use_hdmi_caps")
        config.av.transcodeac3plus.addNotifier(setAC3plusTranscode)

    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")
            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 "[VideoHardware] 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 "[VideoHardware] 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()
示例#3
0
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.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")
				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()
		
		
	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'):
			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):
			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)

	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'):
			config.av.downmix_ac3 = ConfigSelection(choices = [("downmix",  _("Downmix")), ("passthrough", _("Passthrough")), ("multichannel",  _("convert to multi-channel PCM")), ("hdmi_best",  _("use best / controlled by HDMI"))], 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")
		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'):
				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")
		else:
			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 "[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()
示例#4
0
def InitUsageConfig():
	config.misc.useNTPminutes = ConfigSelection(default = "30", choices = [("30", "30" + " " +_("minutes")), ("60", _("Hour")), ("1440", _("Once per day"))])
	config.usage = ConfigSubsection()
	config.usage.showdish = ConfigYesNo(default = True)
	config.misc.showrotorposition = ConfigSelection(default = "no", choices = [("no", _("no")), ("yes", _("yes")), ("withtext", _("with text")), ("tunername", _("with tuner name"))])
	config.usage.multibouquet = ConfigYesNo(default = True)

	config.usage.alternative_number_mode = ConfigYesNo(default = False)
	def alternativeNumberModeChange(configElement):
		eDVBDB.getInstance().setNumberingMode(configElement.value)
		refreshServiceList()
	config.usage.alternative_number_mode.addNotifier(alternativeNumberModeChange)

	config.usage.hide_number_markers = ConfigYesNo(default = True)
	config.usage.hide_number_markers.addNotifier(refreshServiceList)

	config.usage.crypto_icon_mode = ConfigSelection(default = "0", choices = [("0", _("None")), ("1", _("Left from servicename")), ("2", _("Right from servicename"))])
	config.usage.crypto_icon_mode.addNotifier(refreshServiceList)

	config.usage.servicetype_icon_mode = ConfigSelection(default = "0", choices = [("0", _("None")), ("1", _("Left from servicename")), ("2", _("Right from servicename"))])  
	config.usage.servicetype_icon_mode.addNotifier(refreshServiceList)
	config.usage.record_indicator_mode = ConfigSelection(default = "0", choices = [("0", _("None")), ("1", _("Left from servicename")), ("2", _("Right from servicename")), ("3", _("Red colored"))])
	config.usage.record_indicator_mode.addNotifier(refreshServiceList)

	choicelist = [("-1", _("Disable"))]
	for i in range(0,1300,100):
		choicelist.append((str(i), ngettext("%d pixel wide", "%d pixels wide", i) % i))
	config.usage.servicelist_column = ConfigSelection(default="-1", choices=choicelist)
	config.usage.servicelist_column.addNotifier(refreshServiceList)

	config.usage.service_icon_enable = ConfigYesNo(default = False)
	config.usage.service_icon_enable.addNotifier(refreshServiceList)

	config.usage.servicelist_cursor_behavior = ConfigSelection(default = "standard", choices = [
		("standard", _("Standard")),
		("keep", _("Keep service")),
		("reverseB", _("Reverse bouquet buttons")),
		("keep reverseB", _("Keep service") + " + " + _("Reverse bouquet buttons"))])

	config.usage.multiepg_ask_bouquet = ConfigYesNo(default = False)

	config.usage.quickzap_bouquet_change = ConfigYesNo(default = False)
	config.usage.e1like_radio_mode = ConfigYesNo(default = True)

	config.usage.volume_step_slow = ConfigSelectionNumber(default = 1, stepwidth = 1, min = 1, max = 10, wraparound = False)
	config.usage.volume_step_fast = ConfigSelectionNumber(default = 3, stepwidth = 1, min = 1, max = 10, wraparound = False)

	choicelist = [("0", _("No timeout"))]
	for i in range(1, 12):
		choicelist.append((str(i), ngettext("%d second", "%d seconds", i) % i))
	config.usage.infobar_timeout = ConfigSelection(default = "5", choices = choicelist)
	config.usage.show_infobar_on_zap = ConfigYesNo(default = True)
	config.usage.show_infobar_on_skip = ConfigYesNo(default = True)
	config.usage.show_infobar_on_event_change = ConfigYesNo(default = False)
	config.usage.show_second_infobar = ConfigSelection(default = "11", choices = [(None, _("None"))] + choicelist + [("EPG",_("EPG"))])
	config.usage.infobar_frontend_source = ConfigSelection(default = "tuner", choices = [("settings", _("Settings")), ("tuner", _("Tuner"))])
	config.usage.oldstyle_zap_controls = ConfigSelection(default = "standard", choices = [
		("standard", _("Standard")),
		("neutrino", _("Neutrino")),
		("openspa", _("OpenSPA")) ])
	config.usage.oldstyle_channel_select_controls =  ConfigYesNo(default = False)
	config.usage.zap_with_ch_buttons = ConfigYesNo(default = False)
	config.usage.ok_is_channelselection = ConfigYesNo(default = False)
	config.usage.channelselection_preview = ConfigYesNo(default = False)
	config.usage.show_spinner = ConfigYesNo(default = True)
	config.usage.enable_tt_caching = ConfigYesNo(default = True)
	config.usage.sort_settings = ConfigYesNo(default = False)
	config.usage.sort_menus = ConfigYesNo(default = False)
	choicelist = []
	for i in (10, 30):
		choicelist.append((str(i), ngettext("%d second", "%d seconds", i) % i))
	for i in (60, 120, 300, 600, 1200, 1800):
		m = i / 60
		choicelist.append((str(i), ngettext("%d minute", "%d minutes", m) % m))
	for i in (3600, 7200, 14400):
		h = i / 3600
		choicelist.append((str(i), ngettext("%d hour", "%d hours", h) % h))
	config.usage.hdd_standby = ConfigSelection(default = "300", choices = [("0", _("No standby"))] + choicelist)
	config.usage.hdd_standby_in_standby = ConfigSelection(default = "-1", choices = [("-1", _("Same as in active")), ("0", _("No standby"))] + choicelist)
	config.usage.hdd_timer = ConfigYesNo(default = False)
	config.usage.output_12V = ConfigSelection(default = "do not change", choices = [
		("do not change", _("Do not change")), ("off", _("Off")), ("on", _("On")) ])

	config.usage.pip_zero_button = ConfigSelection(default = "standard", choices = [
		("standard", _("Standard")), ("swap", _("Swap PiP and main picture")),
		("swapstop", _("Move PiP to main picture")), ("stop", _("Stop PiP")) ])

	config.usage.pip_hideOnExit = ConfigSelection(default = "without popup", choices = [
		("no", _("No")), ("popup", _("With popup")), ("without popup", _("Without popup")) ])
	choicelist = [("-1", _("Disabled")), ("0", _("No timeout"))]
	for i in [60, 300, 600, 900, 1800, 2700, 3600]:
		m = i/60
		choicelist.append((str(i), ngettext("%d minute", "%d minutes", m) % m))
	config.usage.pip_last_service_timeout = ConfigSelection(default = "0", choices = choicelist)

	config.usage.default_path = ConfigText(default = resolveFilename(SCOPE_HDD))
	config.usage.timer_path = ConfigText(default = "<default>")
	config.usage.instantrec_path = ConfigText(default = "<default>")
	config.usage.timeshift_path = ConfigText(default = "/media/hdd/")
	config.usage.allowed_timeshift_paths = ConfigLocations(default = ["/media/hdd/"])

	config.oscaminfo = ConfigSubsection()
	config.oscaminfo.showInExtensions = ConfigYesNo(default=False)
	config.oscaminfo.userdatafromconf = ConfigYesNo(default = False)
	config.oscaminfo.autoupdate = ConfigYesNo(default = False)
	config.oscaminfo.username = ConfigText(default = "username", fixed_size = False, visible_width=12)
	config.oscaminfo.password = ConfigPassword(default = "password", fixed_size = False)
	config.oscaminfo.ip = ConfigIP( default = [ 127,0,0,1 ], auto_jump=True)
	config.oscaminfo.port = ConfigInteger(default = 16002, limits=(0,65536) )
	config.oscaminfo.intervall = ConfigSelectionNumber(min = 1, max = 600, stepwidth = 1, default = 10, wraparound = True)

	config.cccaminfo = ConfigSubsection()
	config.cccaminfo.showInExtensions = ConfigYesNo(default=False)
	config.cccaminfo.serverNameLength = ConfigSelectionNumber(min = 10, max = 100, stepwidth = 1, default = 22, wraparound = True)
	config.cccaminfo.name = ConfigText(default="Profile", fixed_size=False)
	config.cccaminfo.ip = ConfigText(default="192.168.2.12", fixed_size=False)
	config.cccaminfo.username = ConfigText(default="", fixed_size=False)
	config.cccaminfo.password = ConfigText(default="", fixed_size=False)
	config.cccaminfo.port = ConfigInteger(default=16001, limits=(1, 65535))
	config.cccaminfo.profile = ConfigText(default="", fixed_size=False)
	config.cccaminfo.ecmInfoEnabled = ConfigYesNo(default=True)
	config.cccaminfo.ecmInfoTime = ConfigSelectionNumber(min = 1, max = 10, stepwidth = 1, default = 5, wraparound = True)
	config.cccaminfo.ecmInfoForceHide = ConfigYesNo(default=True)
	config.cccaminfo.ecmInfoPositionX = ConfigInteger(default=50)
	config.cccaminfo.ecmInfoPositionY = ConfigInteger(default=50)
	config.cccaminfo.blacklist = ConfigText(default="/media/cf/CCcamInfo.blacklisted", fixed_size=False)
	config.cccaminfo.profiles = ConfigText(default="/media/cf/CCcamInfo.profiles", fixed_size=False)

	config.usage.movielist_trashcan = ConfigYesNo(default=True)
	config.usage.movielist_trashcan_days = ConfigNumber(default=8)
	config.usage.movielist_trashcan_reserve = ConfigNumber(default=40)
	config.usage.on_movie_start = ConfigSelection(default = "resume", choices = [
		("ask yes", _("Ask user") + " " + _("default") + " " + _("yes")),
		("ask no", _("Ask user") + " " + _("default") + " " + _("no")),
		("resume", _("Resume from last position")),
		("beginning", _("Start from the beginning"))])
	config.usage.on_movie_stop = ConfigSelection(default = "movielist", choices = [
		("ask", _("Ask user")), ("movielist", _("Return to movie list")), ("quit", _("Return to previous service")) ])
	config.usage.on_movie_eof = ConfigSelection(default = "movielist", choices = [
		("ask", _("Ask user")), ("movielist", _("Return to movie list")), ("quit", _("Return to previous service")), ("pause", _("Pause movie at end")), ("playlist", _("Play next (return to movie list)")),
		("playlistquit", _("Play next (return to previous service)")), ("loop", _("Continues play (loop)")), ("repeatcurrent", _("Repeat"))])
	config.usage.next_movie_msg = ConfigYesNo(default = True)
	config.usage.last_movie_played = ConfigText()
	config.usage.leave_movieplayer_onExit = ConfigSelection(default = "popup", choices = [
		("no", _("No")), ("popup", _("With popup")), ("without popup", _("Without popup")), ("movielist", _("Return to movie list")) ])

	config.usage.setup_level = ConfigSelection(default = "expert", choices = [
		("simple", _("Simple")),
		("intermediate", _("Intermediate")),
		("expert", _("Expert")) ])

	config.usage.startup_to_standby = ConfigSelection(default = "no", choices = [
		("no", _("No")),
		("yes", _("Yes")),
		("except", _("No, except Wakeup timer")) ])

	config.usage.wakeup_menu = ConfigNothing()
	config.usage.wakeup_enabled = ConfigYesNo(default = False)
	config.usage.wakeup_day = ConfigSubDict()
	config.usage.wakeup_time = ConfigSubDict()
	for i in range(7):
		config.usage.wakeup_day[i] = ConfigEnableDisable(default = False)
		config.usage.wakeup_time[i] = ConfigClock(default = ((6 * 60 + 0) * 60))

	config.usage.on_long_powerpress = ConfigSelection(default = "show_menu", choices = [
		("show_menu", _("Show shutdown menu")),
		("shutdown", _("Immediate shutdown")),
		("standby", _("Standby")),
		("restart", _("Reboot")) ] )

	config.usage.on_short_powerpress = ConfigSelection(default = "standby", choices = [
		("show_menu", _("Show shutdown menu")),
		("shutdown", _("Immediate shutdown")),
		("standby", _("Standby")) ] )

	choicelist = [("0", _("Do nothing"))]
	for i in range(3600, 21601, 3600):
		h = abs(i / 3600)
		h = ngettext("%d hour", "%d hours", h) % h
		choicelist.append((str(i), _("Standby in ") + h))
	config.usage.inactivity_timer = ConfigSelection(default = "0", choices = choicelist)
	config.usage.inactivity_timer_blocktime = ConfigYesNo(default = True)
	config.usage.inactivity_timer_blocktime_begin = ConfigClock(default = time.mktime((0, 0, 0, 18, 0, 0, 0, 0, 0)))
	config.usage.inactivity_timer_blocktime_end = ConfigClock(default = time.mktime((0, 0, 0, 23, 0, 0, 0, 0, 0)))
	config.usage.inactivity_timer_blocktime_extra = ConfigYesNo(default = False)
	config.usage.inactivity_timer_blocktime_extra_begin = ConfigClock(default = time.mktime((0, 0, 0, 6, 0, 0, 0, 0, 0)))
	config.usage.inactivity_timer_blocktime_extra_end = ConfigClock(default = time.mktime((0, 0, 0, 9, 0, 0, 0, 0, 0)))

	choicelist = [("0", _("Disabled")),("event_standby", _("Standby after current event"))]
	for i in range(900, 7201, 900):
		m = abs(i / 60)
		m = ngettext("%d minute", "%d minutes", m) % m
		choicelist.append((str(i), _("Standby in ") + m))
	config.usage.sleep_timer = ConfigSelection(default = "0", choices = choicelist)

	choicelist = [("0", _("Disabled"))]
	for i in [60, 300, 600] + range(900, 7201, 900):
		m = abs(i / 60)
		m = ngettext("%d minute", "%d minutes", m) % m
		choicelist.append((str(i), _("after ") + m))
	config.usage.standby_to_shutdown_timer = ConfigSelection(default = "0", choices = choicelist)
	config.usage.standby_to_shutdown_timer_blocktime = ConfigYesNo(default = True)
	config.usage.standby_to_shutdown_timer_blocktime_begin = ConfigClock(default = time.mktime((0, 0, 0, 6, 0, 0, 0, 0, 0)))
	config.usage.standby_to_shutdown_timer_blocktime_end = ConfigClock(default = time.mktime((0, 0, 0, 23, 0, 0, 0, 0, 0)))

	choicelist = [("0", _("Disabled"))]
	for m in (1, 5, 10, 15, 30, 60):
		choicelist.append((str(m * 60), ngettext("%d minute", "%d minutes", m) % m))
	config.usage.screen_saver = ConfigSelection(default = "300", choices = choicelist)

	config.usage.check_timeshift = ConfigYesNo(default = True)

	choicelist = [("0", _("Disabled"))]
	for i in (2, 3, 4, 5, 10, 20, 30):
		choicelist.append((str(i), ngettext("%d second", "%d seconds", i) % i))
	for i in (60, 120, 300):
		m = i / 60
		choicelist.append((str(i), ngettext("%d minute", "%d minutes", m) % m))
	config.usage.timeshift_start_delay = ConfigSelection(default = "0", choices = choicelist)

	config.usage.alternatives_priority = ConfigSelection(default = "0", choices = [
		("0", "DVB-S/-C/-T"),
		("1", "DVB-S/-T/-C"),
		("2", "DVB-C/-S/-T"),
		("3", "DVB-C/-T/-S"),
		("4", "DVB-T/-C/-S"),
		("5", "DVB-T/-S/-C"),
		("127", _("No priority")) ])

	config.usage.remote_fallback_enabled = ConfigYesNo(default = False)
	config.usage.remote_fallback = ConfigText(default = _("http://IP-ADDRESS:8001"), fixed_size = False)
	config.usage.show_timer_conflict_warning = ConfigYesNo(default = True)

	dvbs_nims = [("-2", _("Disabled"))]
	dvbt_nims = [("-2", _("Disabled"))]
	dvbc_nims = [("-2", _("Disabled"))]
	nims = [("-1", _("auto"))]
	for x in nimmanager.nim_slots:
		if x.isCompatible("DVB-S"):
			dvbs_nims.append((str(x.slot), x.getSlotName()))
		elif x.isCompatible("DVB-T"):
			dvbt_nims.append((str(x.slot), x.getSlotName()))
		elif x.isCompatible("DVB-C"):
			dvbc_nims.append((str(x.slot), x.getSlotName()))
		nims.append((str(x.slot), x.getSlotName()))
	config.usage.frontend_priority = ConfigSelection(default = "-1", choices = list(nims))
	nims.insert(0,("-2", _("Disabled")))
	config.usage.recording_frontend_priority = ConfigSelection(default = "-2", choices = nims)
	config.usage.frontend_priority_dvbs = ConfigSelection(default = "-2", choices = list(dvbs_nims))
	dvbs_nims.insert(1,("-1", _("auto")))
	config.usage.recording_frontend_priority_dvbs = ConfigSelection(default = "-2", choices = dvbs_nims)
	config.usage.frontend_priority_dvbt = ConfigSelection(default = "-2", choices = list(dvbt_nims))
	dvbt_nims.insert(1,("-1", _("auto")))
	config.usage.recording_frontend_priority_dvbt = ConfigSelection(default = "-2", choices = dvbt_nims)
	config.usage.frontend_priority_dvbc = ConfigSelection(default = "-2", choices = list(dvbc_nims))
	dvbc_nims.insert(1,("-1", _("auto")))
	config.usage.recording_frontend_priority_dvbc = ConfigSelection(default = "-2", choices = dvbc_nims)
	SystemInfo["DVB-S_priority_tuner_available"] = len(dvbs_nims) > 3 and (len(dvbt_nims) > 2 or len(dvbc_nims) > 2)
	SystemInfo["DVB-T_priority_tuner_available"] = len(dvbt_nims) > 3 and (len(dvbs_nims) > 2 or len(dvbc_nims) > 2)
	SystemInfo["DVB-C_priority_tuner_available"] = len(dvbc_nims) > 3 and (len(dvbs_nims) > 2 or len(dvbt_nims) > 2)
 
	config.misc.disable_background_scan = ConfigYesNo(default = False)

	config.usage.servicenum_fontsize = ConfigSelectionNumber(default = 0, stepwidth = 1, min = -8, max = 10, wraparound = True)
	config.usage.servicename_fontsize = ConfigSelectionNumber(default = 0, stepwidth = 1, min = -8, max = 10, wraparound = True)
	config.usage.serviceinfo_fontsize = ConfigSelectionNumber(default = 0, stepwidth = 1, min = -8, max = 10, wraparound = True)
	config.usage.serviceitems_per_page = ConfigSelectionNumber(default = 14, stepwidth = 1, min = 8, max = 20, wraparound = True)

	config.usage.show_event_progress_in_servicelist = ConfigSelection(default = 'barright', choices = [
		('barleft', _("Progress bar left")),
		('barright', _("Progress bar right")),
		('percleft', _("Percentage left")),
		('percright', _("Percentage right")),
		('no', _("No")) ])
	config.usage.show_channel_numbers_in_servicelist = ConfigYesNo(default = True)
	config.usage.show_event_progress_in_servicelist.addNotifier(refreshServiceList)
	config.usage.show_channel_numbers_in_servicelist.addNotifier(refreshServiceList)

	config.usage.blinking_display_clock_during_recording = ConfigYesNo(default = False)

	config.usage.blinking_rec_symbol_during_recording = ConfigYesNo(default = False)

	config.usage.show_message_when_recording_starts = ConfigYesNo(default = True)

	config.usage.load_length_of_movies_in_moviellist = ConfigYesNo(default = True)
	config.usage.show_icons_in_movielist = ConfigSelection(default = 'i', choices = [
		('o', _("Off")),
		('p', _("Progress")),
		('s', _("Small progress")),
		('i', _("Icons")),
	])
	config.usage.movielist_unseen = ConfigYesNo(default = False)

	config.usage.swap_snr_on_osd = ConfigYesNo(default = False)

	config.usage.swap_time_display_on_osd = ConfigSelection(default = "0", choices = [("0", _("Skin Setting")), ("1", _("Mins")), ("2", _("Mins Secs")), ("3", _("Hours Mins")), ("4", _("Hours Mins Secs")), ("5", _("Percentage"))])
	config.usage.swap_media_time_display_on_osd = ConfigSelection(default = "0", choices = [("0", _("Skin Setting")), ("1", _("Mins")), ("2", _("Mins Secs")), ("3", _("Hours Mins")), ("4", _("Hours Mins Secs")), ("5", _("Percentage"))])
	config.usage.swap_time_remaining_on_osd = ConfigSelection(default = "0", choices = [("0", _("Remaining")), ("1", _("Elapsed")), ("2", _("Elapsed & Remaining")), ("3", _("Remaining & Elapsed"))])
	config.usage.elapsed_time_positive_osd = ConfigYesNo(default = False)
	config.usage.swap_time_display_on_vfd = ConfigSelection(default = "0", choices = [("0", _("Skin Setting")), ("1", _("Mins")), ("2", _("Mins Secs")), ("3", _("Hours Mins")), ("4", _("Hours Mins Secs")), ("5", _("Percentage"))])
	config.usage.swap_media_time_display_on_vfd = ConfigSelection(default = "0", choices = [("0", _("Skin Setting")), ("1", _("Mins")), ("2", _("Mins Secs")), ("3", _("Hours Mins")), ("4", _("Hours Mins Secs")), ("5", _("Percentage"))])
	config.usage.swap_time_remaining_on_vfd = ConfigSelection(default = "0", choices = [("0", _("Remaining")), ("1", _("Elapsed")), ("2", _("Elapsed & Remaining")), ("3", _("Remaining & Elapsed"))])
	config.usage.elapsed_time_positive_vfd = ConfigYesNo(default = False)
	config.usage.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.usage.lcd_scroll_speed = ConfigSelection(default = "300", choices = [
		("500", _("slow")),
		("300", _("normal")),
		("100", _("fast"))])

	config.usage.maxchannelnumlen = ConfigSelection(default = "5", choices = [("4", _("4")), ("5", _("5"))])
	config.usage.numzaptimeoutmode = ConfigSelection(default = "standard", choices = [("standard", _("Standard")), ("userdefined", _("User defined")), ("off", _("off"))])
	config.usage.numzaptimeout1 = ConfigSlider(default = 3000, increment = 250, limits = (750, 5000))
	config.usage.numzaptimeout2 = ConfigSlider(default = 1000, increment = 250, limits = (750, 5000))

	def SpinnerOnOffChanged(configElement):
		setSpinnerOnOff(int(configElement.value))
	config.usage.show_spinner.addNotifier(SpinnerOnOffChanged)

	def EnableTtCachingChanged(configElement):
		setEnableTtCachingOnOff(int(configElement.value))
	config.usage.enable_tt_caching.addNotifier(EnableTtCachingChanged)

	def TunerTypePriorityOrderChanged(configElement):
		setTunerTypePriorityOrder(int(configElement.value))
	config.usage.alternatives_priority.addNotifier(TunerTypePriorityOrderChanged, immediate_feedback=False)

	def PreferredTunerChanged(configElement):
		setPreferredTuner(int(configElement.value))
	config.usage.frontend_priority.addNotifier(PreferredTunerChanged)

	config.usage.hide_zap_errors = ConfigYesNo(default = False)
	config.usage.hide_ci_messages = ConfigYesNo(default = True)
	config.usage.show_cryptoinfo = ConfigYesNo(default = True)
	config.usage.show_eit_nownext = ConfigYesNo(default = True)
	config.usage.show_vcr_scart = ConfigYesNo(default = False)
	config.usage.show_update_disclaimer = ConfigYesNo(default = True)
	config.usage.pic_resolution = ConfigSelection(default = None, choices = [(None, _("Same resolution as skin")), ("(720, 576)","720x576"), ("(1280, 720)", "1280x720"), ("(1920, 1080)", "1920x1080")])

	if SystemInfo["Fan"]:
		choicelist = [('off', _("Off")), ('on', _("On")), ('auto', _("Auto"))]
		if os.path.exists("/proc/stb/fp/fan_choices"):
			choicelist = [x for x in choicelist if x[0] in open("/proc/stb/fp/fan_choices", "r").read().strip().split(" ")]
		config.usage.fan = ConfigSelection(choicelist)
		def fanChanged(configElement):
			open(SystemInfo["Fan"], "w").write(configElement.value)
		config.usage.fan.addNotifier(fanChanged)

	if SystemInfo["FanPWM"]:
		def fanSpeedChanged(configElement):
			open(SystemInfo["FanPWM"], "w").write(hex(configElement.value)[2:])
		config.usage.fanspeed = ConfigSlider(default=127, increment=8, limits=(0, 255))
		config.usage.fanspeed.addNotifier(fanSpeedChanged)

	if SystemInfo["StandbyLED"]:
		def standbyLEDChanged(configElement):
			open(SystemInfo["StandbyLED"], "w").write(configElement.value and "on" or "off")
		config.usage.standbyLED = ConfigYesNo(default = True)
		config.usage.standbyLED.addNotifier(standbyLEDChanged)

	config.epg = ConfigSubsection()
	config.epg.eit = ConfigYesNo(default = True)
	config.epg.mhw = ConfigYesNo(default = True)
	config.epg.freesat = ConfigYesNo(default = True)
	config.epg.viasat = ConfigYesNo(default = True)
	config.epg.netmed = ConfigYesNo(default = True)
	config.epg.virgin = ConfigYesNo(default = False)
	config.misc.showradiopic = ConfigYesNo(default = True)
	def EpgSettingsChanged(configElement):
		from enigma import eEPGCache
		mask = 0xffffffff
		if not config.epg.eit.value:
			mask &= ~(eEPGCache.NOWNEXT | eEPGCache.SCHEDULE | eEPGCache.SCHEDULE_OTHER)
		if not config.epg.mhw.value:
			mask &= ~eEPGCache.MHW
		if not config.epg.freesat.value:
			mask &= ~(eEPGCache.FREESAT_NOWNEXT | eEPGCache.FREESAT_SCHEDULE | eEPGCache.FREESAT_SCHEDULE_OTHER)
		if not config.epg.viasat.value:
			mask &= ~eEPGCache.VIASAT
		if not config.epg.netmed.value:
			mask &= ~(eEPGCache.NETMED_SCHEDULE | eEPGCache.NETMED_SCHEDULE_OTHER)
		if not config.epg.virgin.value:
			mask &= ~(eEPGCache.VIRGIN_NOWNEXT | eEPGCache.VIRGIN_SCHEDULE)
		eEPGCache.getInstance().setEpgSources(mask)
	config.epg.eit.addNotifier(EpgSettingsChanged)
	config.epg.mhw.addNotifier(EpgSettingsChanged)
	config.epg.freesat.addNotifier(EpgSettingsChanged)
	config.epg.viasat.addNotifier(EpgSettingsChanged)
	config.epg.netmed.addNotifier(EpgSettingsChanged)
	config.epg.virgin.addNotifier(EpgSettingsChanged)

	config.epg.maxdays = ConfigSelectionNumber(min = 1, max = 28, stepwidth = 1, default = 5, wraparound = True)
	def EpgmaxdaysChanged(configElement):
		from enigma import eEPGCache
		eEPGCache.getInstance().setEpgmaxdays(config.epg.maxdays.getValue())
	config.epg.maxdays.addNotifier(EpgmaxdaysChanged)

	config.epg.histminutes = ConfigSelectionNumber(min = 0, max = 120, stepwidth = 15, default = 0, wraparound = True)
	def EpgHistorySecondsChanged(configElement):
		from enigma import eEPGCache
		eEPGCache.getInstance().setEpgHistorySeconds(config.epg.histminutes.getValue()*60)
	config.epg.histminutes.addNotifier(EpgHistorySecondsChanged)

	def setHDDStandby(configElement):
		for hdd in harddiskmanager.HDDList():
			hdd[1].setIdleTime(int(configElement.value))
	config.usage.hdd_standby.addNotifier(setHDDStandby, immediate_feedback=False)

	if SystemInfo["12V_Output"]:
		def set12VOutput(configElement):
			Misc_Options.getInstance().set_12V_output(configElement.value == "on" and 1 or 0)
		config.usage.output_12V.addNotifier(set12VOutput, immediate_feedback=False)

	config.usage.keymap = ConfigText(default = eEnv.resolve("${datadir}/enigma2/keymap.xml"))
	config.usage.keytrans = ConfigText(default = eEnv.resolve("${datadir}/enigma2/keytranslation.xml"))

	config.network = ConfigSubsection()
	if SystemInfo["WakeOnLAN"]:
		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")	
		config.network.wol = ConfigYesNo(default = False)
		config.network.wol.addNotifier(wakeOnLANChanged)

	config.network.Inadyn_autostart = ConfigYesNo(default = False)
	config.network.OpenVPN_autostart = ConfigYesNo(default = False)

	config.seek = ConfigSubsection()
	config.seek.selfdefined_13 = ConfigNumber(default=15)
	config.seek.selfdefined_46 = ConfigNumber(default=60)
	config.seek.selfdefined_79 = ConfigNumber(default=300)

	config.seek.speeds_forward = ConfigSet(default=[2, 4, 8, 16, 32, 64, 128], choices=[2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
	config.seek.speeds_backward = ConfigSet(default=[2, 4, 8, 16, 32, 64, 128], choices=[1, 2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
	config.seek.speeds_slowmotion = ConfigSet(default=[2, 4, 8], choices=[2, 4, 6, 8, 12, 16, 25])

	config.seek.enter_forward = ConfigSelection(default = "2", choices = ["2", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128"])
	config.seek.enter_backward = ConfigSelection(default = "1", choices = ["1", "2", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128"])

	config.seek.on_pause = ConfigSelection(default = "play", choices = [
		("play", _("Play")),
		("step", _("Single step (GOP)")),
		("last", _("Last speed")) ])


	config.crash = ConfigSubsection()
	config.crash.details = ConfigYesNo(default = False)

	debugpath = [('/home/root/logs/', '/home/root/')]
	for p in harddiskmanager.getMountedPartitions():
		if os.path.exists(p.mountpoint):
			d = os.path.normpath(p.mountpoint)
			if p.mountpoint != '/':
				debugpath.append((p.mountpoint + 'logs/', d))
	config.crash.debug_path = ConfigSelection(default = "/home/root/logs/", choices = debugpath)
	if not os.path.exists("/home"):
		os.mkdir("/home",0755)
	if not os.path.exists("/home/root"):
		os.mkdir("/home/root",0755)

	def updatedebug_path(configElement):
		if not os.path.exists(config.crash.debug_path.value):
			try:
				os.mkdir(config.crash.debug_path.value,0755)
			except:
				print "Failed to create log path: %s" % config.crash.debug_path.value
	config.crash.debug_path.addNotifier(updatedebug_path, immediate_feedback = False)

	crashlogheader = "We are really sorry. Your receiver encountered " \
					 "a software problem, and needs to be restarted.\n" \
					 "Please send the logfile %senigma2_crash_xxxxxx.log to http://openspa.info.\n" \
					 "Your receiver restarts in 10 seconds!\n" \
					 "Component: enigma2" % config.crash.debug_path.value
	config.crash.debug_text = ConfigText(default=_(crashlogheader), fixed_size=False)

	config.usage.timerlist_finished_timer_position = ConfigSelection(default = "end", choices = [("beginning", _("At beginning")), ("end", _("At end"))])

	def updateEnterForward(configElement):
		if not configElement.value:
			configElement.value = [2]
		updateChoices(config.seek.enter_forward, configElement.value)

	config.seek.speeds_forward.addNotifier(updateEnterForward, immediate_feedback = False)

	def updateEnterBackward(configElement):
		if not configElement.value:
			configElement.value = [2]
		updateChoices(config.seek.enter_backward, configElement.value)

	config.seek.speeds_backward.addNotifier(updateEnterBackward, immediate_feedback = False)

	def updateEraseSpeed(el):
		eBackgroundFileEraser.getInstance().setEraseSpeed(int(el.value))
	def updateEraseFlags(el):
		eBackgroundFileEraser.getInstance().setEraseFlags(int(el.value))
	config.misc.erase_speed = ConfigSelection(default="20", choices = [
		("10", "10 MB/s"),
		("20", "20 MB/s"),
		("50", "50 MB/s"),
		("100", "100 MB/s")])
	config.misc.erase_speed.addNotifier(updateEraseSpeed, immediate_feedback = False)
	config.misc.erase_flags = ConfigSelection(default="1", choices = [
		("0", _("Disable")),
		("1", _("Internal hdd only")),
		("3", _("Everywhere"))])
	config.misc.erase_flags.addNotifier(updateEraseFlags, immediate_feedback = False)

	if SystemInfo["ZapMode"]:
		def setZapmode(el):
			open(SystemInfo["ZapMode"], "w").write(el.value)
		config.misc.zapmode = ConfigSelection(default = "mute", choices = [
			("mute", _("Black screen")), ("hold", _("Hold screen")), ("mutetilllock", _("Black screen till locked")), ("holdtilllock", _("Hold till locked"))])
		config.misc.zapmode.addNotifier(setZapmode, immediate_feedback = False)

	config.subtitles = ConfigSubsection()
	config.subtitles.ttx_subtitle_colors = ConfigSelection(default = "1", choices = [
		("0", _("original")),
		("1", _("white")),
		("2", _("yellow")) ])
	config.subtitles.ttx_subtitle_original_position = ConfigYesNo(default = False)
	config.subtitles.subtitle_position = ConfigSelection( choices = ["0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100", "150", "200", "250", "300", "350", "400", "450"], default = "50")
	config.subtitles.subtitle_alignment = ConfigSelection(choices = [("left", _("left")), ("center", _("center")), ("right", _("right"))], default = "center")
	config.subtitles.subtitle_rewrap = ConfigYesNo(default = False)
	config.subtitles.colourise_dialogs = ConfigYesNo(default = False)
	config.subtitles.subtitle_borderwidth = ConfigSelection(choices = ["1", "2", "3", "4", "5"], default = "3")
	config.subtitles.subtitle_fontsize  = ConfigSelection(choices = ["%d" % x for x in range(16,101) if not x % 2], default = "40")
	config.subtitles.showbackground = ConfigYesNo(default = False)

	subtitle_delay_choicelist = []
	for i in range(-900000, 1845000, 45000):
		if i == 0:
			subtitle_delay_choicelist.append(("0", _("No delay")))
		else:
			subtitle_delay_choicelist.append((str(i), "%2.1f sec" % (i / 90000.)))
	config.subtitles.subtitle_noPTSrecordingdelay = ConfigSelection(default = "315000", choices = subtitle_delay_choicelist)

	config.subtitles.dvb_subtitles_yellow = ConfigYesNo(default = False)
	config.subtitles.dvb_subtitles_original_position = ConfigSelection(default = "0", choices = [("0", _("Original")), ("1", _("Fixed")), ("2", _("Relative"))])
	config.subtitles.dvb_subtitles_centered = ConfigYesNo(default = True)
	config.subtitles.subtitle_bad_timing_delay = ConfigSelection(default = "0", choices = subtitle_delay_choicelist)
	config.subtitles.dvb_subtitles_backtrans = ConfigSelection(default = "0", choices = [
		("0", _("No transparency")),
		("25", "10%"),
		("50", "20%"),
		("75", "30%"),
		("100", "40%"),
		("125", "50%"),
		("150", "60%"),
		("175", "70%"),
		("200", "80%"),
		("225", "90%"),
		("255", _("Full transparency"))])
	config.subtitles.pango_subtitle_colors = ConfigSelection(default = "1", choices = [
		("0", _("alternative")),
		("1", _("white")),
		("2", _("yellow")) ])
	config.subtitles.pango_subtitle_fontswitch = ConfigYesNo(default = True)
	config.subtitles.pango_subtitles_delay = ConfigSelection(default = "0", choices = subtitle_delay_choicelist)
	config.subtitles.pango_subtitles_fps = ConfigSelection(default = "1", choices = [
		("1", _("Original")),
		("23976", _("23.976")),
		("24000", _("24")),
		("25000", _("25")),
		("29970", _("29.97")),
		("30000", _("30"))])
	config.subtitles.pango_autoturnon = ConfigYesNo(default = True)

	config.autolanguage = ConfigSubsection()
	audio_language_choices=[
		("---", _("None")),
		("orj dos ory org esl qaa und mis mul ORY ORJ Audio_ORJ", _("Original")),
		("ara", _("Arabic")),
		("eus baq", _("Basque")),
		("bul", _("Bulgarian")),
		("hrv", _("Croatian")),
		("ces cze", _("Czech")),
		("dan", _("Danish")),
		("dut ndl", _("Dutch")),
		("eng qaa", _("English")),
		("est", _("Estonian")),
		("fin", _("Finnish")),
		("fra fre", _("French")),
		("deu ger", _("German")),
		("ell gre", _("Greek")),
		("heb", _("Hebrew")),
		("hun", _("Hungarian")),
		("ita", _("Italian")),
		("lav", _("Latvian")),
		("lit", _("Lithuanian")),
		("ltz", _("Luxembourgish")),
		("nor", _("Norwegian")),
		("pol", _("Polish")),
		("por", _("Portuguese")),
		("fas per", _("Persian")),
		("ron rum", _("Romanian")),
		("rus", _("Russian")),
		("srp", _("Serbian")),
		("slk slo", _("Slovak")),
		("slv", _("Slovenian")),
		("spa", _("Spanish")),
		("swe", _("Swedish")),
		("tha", _("Thai")),
		("tur Audio_TUR", _("Turkish"))]

	def setEpgLanguage(configElement):
		eServiceEvent.setEPGLanguage(configElement.value)
	config.autolanguage.audio_epglanguage = ConfigSelection(audio_language_choices[:1] + audio_language_choices [2:], default="---")
	config.autolanguage.audio_epglanguage.addNotifier(setEpgLanguage)

	def setEpgLanguageAlternative(configElement):
		eServiceEvent.setEPGLanguageAlternative(configElement.value)
	config.autolanguage.audio_epglanguage_alternative = ConfigSelection(audio_language_choices[:1] + audio_language_choices [2:], default="---")
	config.autolanguage.audio_epglanguage_alternative.addNotifier(setEpgLanguageAlternative)

	config.autolanguage.audio_autoselect1 = ConfigSelection(choices=audio_language_choices, default="---")
	config.autolanguage.audio_autoselect2 = ConfigSelection(choices=audio_language_choices, default="---")
	config.autolanguage.audio_autoselect3 = ConfigSelection(choices=audio_language_choices, default="---")
	config.autolanguage.audio_autoselect4 = ConfigSelection(choices=audio_language_choices, default="---")
	config.autolanguage.audio_defaultac3 = ConfigYesNo(default = False)
	config.autolanguage.audio_defaultddp = ConfigYesNo(default = False)
	config.autolanguage.audio_usecache = ConfigYesNo(default = True)

	subtitle_language_choices = audio_language_choices[:1] + audio_language_choices [2:]
	config.autolanguage.subtitle_autoselect1 = ConfigSelection(choices=subtitle_language_choices, default="---")
	config.autolanguage.subtitle_autoselect2 = ConfigSelection(choices=subtitle_language_choices, default="---")
	config.autolanguage.subtitle_autoselect3 = ConfigSelection(choices=subtitle_language_choices, default="---")
	config.autolanguage.subtitle_autoselect4 = ConfigSelection(choices=subtitle_language_choices, default="---")
	config.autolanguage.subtitle_hearingimpaired = ConfigYesNo(default = False)
	config.autolanguage.subtitle_defaultimpaired = ConfigYesNo(default = False)
	config.autolanguage.subtitle_defaultdvb = ConfigYesNo(default = False)
	config.autolanguage.subtitle_usecache = ConfigYesNo(default = True)
	config.autolanguage.equal_languages = ConfigSelection(default = "15", choices = [
		("0", _("None")),("1", "1"),("2", "2"),("3", "1,2"),
		("4", "3"),("5", "1,3"),("6", "2,3"),("7", "1,2,3"),
		("8", "4"),("9", "1,4"),("10", "2,4"),("11", "1,2,4"),
		("12", "3,4"),("13", "1,3,4"),("14", "2,3,4"),("15", _("All"))])

	config.streaming = ConfigSubsection()
	config.streaming.stream_ecm = ConfigYesNo(default = False)
	config.streaming.descramble = ConfigYesNo(default = True)
	config.streaming.descramble_client = ConfigYesNo(default = False)
	config.streaming.stream_eit = ConfigYesNo(default = True)
	config.streaming.stream_ait = ConfigYesNo(default = True)
	config.streaming.authentication = ConfigYesNo(default = False)

	#config.osd = ConfigSubsection()
	config.osd.dst_left = ConfigSelectionNumber(default = 0, stepwidth = 1, min = 0, max = 720, wraparound = False)
	config.osd.dst_width = ConfigSelectionNumber(default = 720, stepwidth = 1, min = 0, max = 720, wraparound = False)
	config.osd.dst_top = ConfigSelectionNumber(default = 0, stepwidth = 1, min = 0, max = 576, wraparound = False)
	config.osd.dst_height = ConfigSelectionNumber(default = 576, stepwidth = 1, min = 0, max = 576, wraparound = False)
	config.osd.alpha = ConfigSelectionNumber(default = 255, stepwidth = 1, min = 0, max = 255, wraparound = False)
	config.osd.alpha_teletext = ConfigSelectionNumber(default = 255, stepwidth = 1, min = 0, max = 255, wraparound = False)
	config.osd.alpha_webbrowser = ConfigSelectionNumber(default = 255, stepwidth = 1, min = 0, max = 255, wraparound = False)
	config.av.osd_alpha = NoSave(ConfigNumber(default = 255))
	config.osd.threeDmode = ConfigSelection([("off", _("Off")), ("auto", _("Auto")), ("sidebyside", _("Side by Side")),("topandbottom", _("Top and Bottom"))], "auto")
	config.osd.threeDznorm = ConfigSlider(default = 50, increment = 1, limits = (0, 100))
	config.osd.show3dextensions = ConfigYesNo(default = False)
	choiceoptions = [("mode1", _("Mode 1")), ("mode2", _("Mode 2"))]
	config.osd.threeDsetmode = ConfigSelection(default = 'mode1' , choices = choiceoptions )
示例#5
0
文件: AVSwitch.py 项目: ostende/test2
def InitAVSwitch():
    config.av = ConfigSubsection()
    config.av.yuvenabled = ConfigBoolean(default=False)
    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.colorformat = ConfigSelection(choices=colorformat_choices,
                                            default="cvbs")
    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="4_3_letterbox")

    config.av.aspect = ConfigSelection(choices={
        "4_3": _("4:3"),
        "16_9": _("16:9"),
        "16_10": _("16:10"),
        "auto": _("Automatic")
    },
                                       default="auto")
    config.av.policy_169 = ConfigSelection(
        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")
        },
        default="letterbox")
    config.av.policy_43 = ConfigSelection(
        choices={
            # TRANSLATORS: (aspect ratio policy: black bars on left/right) in doubt, keep english term.
            "pillarbox": _("Pillarbox"),
            # TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term
            "panscan": _("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)
            "scale": _("Just Scale")
        },
        default="pillarbox")
    config.av.tvsystem = ConfigSelection(choices={
        "pal": _("PAL"),
        "ntsc": _("NTSC"),
        "multinorm": _("multinorm")
    },
                                         default="pal")
    config.av.wss = ConfigEnableDisable(default=True)
    config.av.defaultac3 = ConfigYesNo(default=False)
    config.av.generalAC3delay = ConfigSelectionNumber(-1000,
                                                      1000,
                                                      25,
                                                      default=0)
    config.av.generalPCMdelay = ConfigSelectionNumber(-1000,
                                                      1000,
                                                      25,
                                                      default=0)
    config.av.vcrswitch = ConfigEnableDisable(default=False)

    iAVSwitch = AVSwitch()

    def setColorFormat(configElement):
        map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
        iAVSwitch.setColorFormat(map[configElement.value])

    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])

    def setSystem(configElement):
        map = {"pal": 0, "ntsc": 1, "multinorm": 2}
        iAVSwitch.setSystem(map[configElement.value])

    def setWSS(configElement):
        iAVSwitch.setAspectWSS()

    # this will call the "setup-val" initial
    config.av.colorformat.addNotifier(setColorFormat)
    config.av.aspectratio.addNotifier(setAspectRatio)
    config.av.tvsystem.addNotifier(setSystem)
    config.av.wss.addNotifier(setWSS)

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

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

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

    config.av.bypass_edid_checking.addNotifier(setEDIDBypass)

    can_pcm_multichannel = False
    if SystemInfo["CanMultiChannelPCM"]:
        config.av.multichannel_pcm = ConfigYesNo(default=False)
        can_pcm_multichannel = True
        if config.av.multichannel_pcm.value:
            try:
                can_pcm_multichannel = access(
                    "/proc/stb/audio/multichannel_pcm", W_OK) and True or False
            except:
                can_pcm_multichannel = False
    SystemInfo["supportMultiChannelPCM"] = can_pcm_multichannel

    can_speaker_position = False
    if os_path.exists("/proc/stb/audio/3d_surround_speaker_position_choices"):
        can_speaker_position = True
    SystemInfo["supportSpeakerPosition"] = can_speaker_position
    if SystemInfo["CanSpeakerPosition"]:
        choice_list = [("center", _("center")), ("wide", _("wide")),
                       ("extrawide", _("extrawide"))]
        config.av.surround_speaker_position = ConfigSelection(
            choices=choice_list, default="wide")

    if SystemInfo["Can3DSurround"]:

        def set3DSurround(configElement):
            f = open("/proc/stb/audio/3d_surround", "w")
            f.write(configElement.value)
            f.close()
            if SystemInfo[
                    "supportSpeakerPosition"] and config.av.surround_3d.value == "none":
                config.av.surround_speaker_position.value = "wide"
                config.av.surround_speaker_position.save()
                SystemInfo["CanSpeakerPosition"] = False
            elif SystemInfo[
                    "supportSpeakerPosition"] and config.av.surround_3d.value != "none":
                SystemInfo["CanSpeakerPosition"] = True

        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)

    if SystemInfo["supportSpeakerPosition"]:

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

        config.av.surround_speaker_position.addNotifier(setSpeakerPosition)

    if SystemInfo["CanAVL"]:

        def setAVL(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.avl = ConfigSelection(choices=choice_list, default="none")
        config.av.avl.addNotifier(setAVL)

    if SystemInfo["CanDownmixAC3"]:

        def setAC3Downmix(configElement):
            open("/proc/stb/audio/ac3",
                 "w").write(configElement.value and "downmix" or "passthrough")
            if SystemInfo["supportMultiChannelPCM"] and (
                    not config.av.downmix_ac3.value):
                SystemInfo["CanMultiChannelPCM"] = True
            elif SystemInfo[
                    "supportMultiChannelPCM"] and config.av.downmix_ac3.value:
                SystemInfo["CanMultiChannelPCM"] = False
                config.av.multichannel_pcm.value = False
                config.av.multichannel_pcm.save()

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

    if SystemInfo["CanDownmixAAC"]:

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

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

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

    if SystemInfo["supportMultiChannelPCM"]:
        config.av.multichannel_pcm.addNotifier(
            setMultiChannelPCM, initial_call=config.av.multichannel_pcm.value)

    try:
        can_osd_alpha = open("/proc/stb/video/alpha", "r") and True or False
    except:
        can_osd_alpha = False

    SystemInfo["CanChangeOsdAlpha"] = can_osd_alpha

    def setAlpha(config):
        open("/proc/stb/video/alpha", "w").write(str(config.value))

    if can_osd_alpha:
        config.av.osd_alpha = ConfigSlider(default=255, limits=(0, 255))
        config.av.osd_alpha.addNotifier(setAlpha)

    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
                open("/proc/stb/vmpeg/0/pep_scaler_sharpness",
                     "w").write("%0.8X" % myval)
                open("/proc/stb/vmpeg/0/pep_apply", "w").write("1")
            except IOError:
                print "couldn't write pep_scaler_sharpness"

        config.av.scaler_sharpness = ConfigSlider(default=0, limits=(0, 26))
        config.av.scaler_sharpness.addNotifier(setScaler_sharpness)
    else:
        config.av.scaler_sharpness = NoSave(ConfigNothing())
示例#6
0
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, limits=(0, 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"),
        "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=200,
                                                    max=3000,
                                                    stepwidth=200,
                                                    default=400,
                                                    wraparound=True)
    config.av.autores_deinterlace = ConfigYesNo(default=False)
    config.av.autores_sd = ConfigSelection(choices={
        "720p": _("720p"),
        "1080i": _("1080i")
    },
                                           default="720p")
    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.smart1080p = ConfigSelection(choices={
        "false": _("off"),
        "true": _("1080p50: 24/50/60Hz"),
        "1080i50": _("1080i50: 24/50/60Hz"),
        "720p50": _("720p50: 24/50/60Hz")
    },
                                           default="false")
    config.av.colorformat = ConfigSelection(choices=colorformat_choices,
                                            default="yuv")
    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 == "Scart-YPbPr":
            iAVSwitch.setColorFormat(3)
        elif config.av.videoport and config.av.videoport.value == "YPbPr" and getMachineBuild(
        ) == 'inihdx' or getMachineBuild() == 'ventonhdx':
            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])

    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])

    config.av.colorformat.addNotifier(setColorFormat)

    iAVSwitch.setInput("ENCODER")  # init on startup
    if (getBoxType()
            in ('gbquad', 'gbquadplus', 'et5x00', 'ixussone', 'ixusszero',
                'e3hd', 'odinm6', 'omtimussos1', 'omtimussos2', 'gb800seplus',
                'gb800ueplus')) 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")
                f.write(configElement.value)
                f.close()
            except:
                pass

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

    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/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 setAutoVulume(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(setAutoVulume)
    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)
        config.av.autovolume = ConfigNothing()

    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() == 'gbquad' or getBoxType() == '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()
示例#7
0
def InitAVSwitch():
    config.av = ConfigSubsection()
    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.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="auto")
    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")
    }
    try:
        if "auto" in open("/proc/stb/video/policy2_choices").read():
            # 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")})
    except:
        pass
    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.
        "pillarbox": _("Pillarbox"),
        # TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term
        "panscan": _("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)
        "scale": _("Just scale")
    }
    try:
        if "auto" in open("/proc/stb/video/policy_choices").read():
            # 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")})
    except:
        pass
    config.av.policy_43 = ConfigSelection(choices=policy_choices,
                                          default="pillarbox")
    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)

    iAVSwitch = AVSwitch()

    def setColorFormat(configElement):
        map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
        iAVSwitch.setColorFormat(map[configElement.value])

    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])

    def setSystem(configElement):
        map = {"pal": 0, "ntsc": 1, "multinorm": 2}
        iAVSwitch.setSystem(map[configElement.value])

    def setWSS(configElement):
        iAVSwitch.setAspectWSS()

    # this will call the "setup-val" initial
    config.av.colorformat.addNotifier(setColorFormat)
    config.av.aspectratio.addNotifier(setAspectRatio)
    config.av.tvsystem.addNotifier(setSystem)
    config.av.wss.addNotifier(setWSS)

    iAVSwitch.setInput("ENCODER")  # init on startup
    if getBoxType() in ('gbquad4k', 'gbue4k', 'gbquad', 'gbquadplus',
                        'gb800seplus', 'gb800ueplus', 'gbipbox', 'gbultra',
                        'gbultraue', 'gbultraueh', 'gbultrase', 'spycat',
                        'gbx1', 'gbx2', 'gbx3', 'gbx3h'):
        detected = False
    else:
        detected = eAVSwitch.getInstance().haveScartSwitch()

    SystemInfo["ScartSwitch"] = detected

    if SystemInfo["HasMultichannelPCM"]:

        def setPCMMultichannel(configElement):
            open(SystemInfo["HasMultichannelPCM"],
                 "w").write(configElement.value and "enable" or "disable")

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

    try:
        SystemInfo["CanDownmixAC3"] = "downmix" in open(
            "/proc/stb/audio/ac3_choices", "r").read()
    except:
        SystemInfo["CanDownmixAC3"] = False

    if SystemInfo["CanDownmixAC3"]:

        def setAC3Downmix(configElement):
            open("/proc/stb/audio/ac3",
                 "w").write(configElement.value and "downmix" or "passthrough")

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

    try:
        SystemInfo["CanDownmixDTS"] = "downmix" in open(
            "/proc/stb/audio/dts_choices", "r").read()
    except:
        SystemInfo["CanDownmixDTS"] = False

    if SystemInfo["CanDownmixDTS"]:

        def setDTSDownmix(configElement):
            open("/proc/stb/audio/dts",
                 "w").write(configElement.value and "downmix" or "passthrough")

        config.av.downmix_dts = ConfigYesNo(default=True)
        config.av.downmix_dts.addNotifier(setDTSDownmix)

    try:
        SystemInfo["CanDownmixAAC"] = "downmix" in open(
            "/proc/stb/audio/aac_choices", "r").read()
    except:
        SystemInfo["CanDownmixAAC"] = False

    if SystemInfo["CanDownmixAAC"]:

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

        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()

    try:
        SystemInfo["CanChangeOsdAlpha"] = open("/proc/stb/video/alpha",
                                               "r") and True or False
    except:
        SystemInfo["CanChangeOsdAlpha"] = False

    if SystemInfo["CanChangeOsdAlpha"]:

        def setAlpha(config):
            open("/proc/stb/video/alpha", "w").write(str(config.value))

        config.av.osd_alpha = ConfigSlider(default=255,
                                           increment=5,
                                           limits=(20, 255))
        config.av.osd_alpha.addNotifier(setAlpha)

    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
                open("/proc/stb/vmpeg/0/pep_scaler_sharpness",
                     "w").write("%0.8X" % myval)
                open("/proc/stb/vmpeg/0/pep_apply", "w").write("1")
            except IOError:
                print "couldn't write pep_scaler_sharpness"

        if getBoxType() in ('gbquad4k', '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=True)

    if SystemInfo["HasMultichannelPCM"]:

        def setMultichannelPCM(configElement):
            open(SystemInfo["HasMultichannelPCM"],
                 "w").write(configElement.value and "enable" or "disable")

        config.av.multichannel_pcm = ConfigYesNo(default=False)
        config.av.multichannel_pcm.addNotifier(setMultichannelPCM)

    if SystemInfo["HasAutoVolume"]:

        def setAutoVolume(configElement):
            open(SystemInfo["HasAutoVolume"], "w").write(configElement.value)

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

    if SystemInfo["HasAutoVolumeLevel"]:

        def setAutoVolumeLevel(configElement):
            open(SystemInfo["HasAutoVolumeLevel"],
                 "w").write(configElement.value and "enabled" or "disabled")

        config.av.autovolumelevel = ConfigYesNo(default=False)
        config.av.autovolumelevel.addNotifier(setAutoVolumeLevel)

    if SystemInfo["Has3DSurround"]:

        def set3DSurround(configElement):
            open(SystemInfo["Has3DSurround"], "w").write(configElement.value)

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

    if SystemInfo["Has3DSpeaker"]:

        def set3DSpeaker(configElement):
            open(SystemInfo["Has3DSpeaker"], "w").write(configElement.value)

        config.av.speaker_3d = ConfigSelection(default="center",
                                               choices=[("center",
                                                         _("center")),
                                                        ("wide", _("wide")),
                                                        ("extrawide",
                                                         _("extra wide"))])
        config.av.speaker_3d.addNotifier(set3DSpeaker)

    if SystemInfo["Has3DSurroundSpeaker"]:

        def set3DSurroundSpeaker(configElement):
            open(SystemInfo["Has3DSurroundSpeaker"],
                 "w").write(configElement.value)

        config.av.surround_3d_speaker = ConfigSelection(
            default="disabled",
            choices=[("disabled", _("off")), ("center", _("center")),
                     ("wide", _("wide")), ("extrawide", _("extra wide"))])
        config.av.surround_3d_speaker.addNotifier(set3DSurroundSpeaker)

    if SystemInfo["Has3DSurroundSoftLimiter"]:

        def set3DSurroundSoftLimiter(configElement):
            open(SystemInfo["Has3DSurroundSoftLimiter"],
                 "w").write(configElement.value and "enabled" or "disabled")

        config.av.surround_softlimiter_3d = ConfigYesNo(default=False)
        config.av.surround_softlimiter_3d.addNotifier(set3DSurroundSoftLimiter)
示例#8
0
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))
    colorformat_choices = {
        'cvbs': _('CVBS'),
        'rgb': _('RGB'),
        'svideo': _('S-Video')
    }
    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=50,
                                                    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.smart1080p = ConfigSelection(choices={
        'false': _('off'),
        'true': _('1080p50: 24/50/60Hz'),
        '1080i50': _('1080i50: 24/50/60Hz'),
        '720p50': _('720p50: 24/50/60Hz')
    },
                                           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')
    policy2_choices = {
        'letterbox': _('Letterbox'),
        'panscan': _('Pan&scan'),
        'scale': _('Just scale')
    }
    if os.path.exists('/proc/stb/video/policy2_choices'):
        f = open('/proc/stb/video/policy2_choices')
        if 'auto' in f.readline():
            policy2_choices.update({'auto': _('Auto')})
        f.close()
    config.av.policy_169 = ConfigSelection(choices=policy2_choices,
                                           default='letterbox')
    policy_choices = {
        'panscan': _('Pillarbox'),
        'letterbox': _('Pan&scan'),
        'bestfit': _('Just scale')
    }
    if os.path.exists('/proc/stb/video/policy_choices'):
        f = open('/proc/stb/video/policy_choices')
        if 'auto' in f.readline():
            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.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')
    if getBoxType() in ('gbquad', 'gbquadplus', 'et5x00', 'ixussone',
                        'ixusszero', 'axodin', 'axodinc', 'starsatlx',
                        'galaxym6', 'geniuse3hd', 'evoe3hd', 'axase3',
                        'axase3c', 'omtimussos1', 'omtimussos2', 'gb800seplus',
                        'gb800ueplus', 'gbultrase', 'gbultraue',
                        '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')
                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/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):
            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['CanPcmMultichannel'] = 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()
示例#9
0
def InitAVSwitch():
    config.av = ConfigSubsection()
    config.av.yuvenabled = ConfigBoolean(default=True)
    colorformat_choices = {"cvbs": _("CVBS")}

    # when YUV, Scart or S-Video is not support by HW, don't let the user select it
    if SystemInfo["HasYPbPr"]:
        colorformat_choices["yuv"] = _("YPbPr")
    if SystemInfo["HasScart"]:
        colorformat_choices["rgb"] = _("RGB")
    if SystemInfo["HasSVideo"]:
        colorformat_choices["svideo"] = _("S-Video")

    config.av.colorformat = ConfigSelection(choices=colorformat_choices,
                                            default="cvbs")
    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="auto")
    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: scale as close to fullscreen as possible)
        "scale": _("Just scale")
    }
    try:
        if "full" in open("/proc/stb/video/policy2_choices").read():
            # TRANSLATORS: (aspect ratio policy: display as fullscreen, even if the content aspect ratio does not match the screen ratio)
            policy2_choices.update({"full": _("Full screen")})
    except:
        pass
    try:
        if "auto" in open("/proc/stb/video/policy2_choices").read():
            # TRANSLATORS: (aspect ratio policy: automatically select the best aspect ratio mode)
            policy2_choices.update({"auto": _("Auto")})
    except:
        pass
    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.
        "pillarbox": _("Pillarbox"),
        # TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term
        "panscan": _("Pan&scan"),
        # TRANSLATORS: (aspect ratio policy: scale as close to fullscreen as possible)
        "scale": _("Just scale")
    }
    try:
        if "nonlinear" in open("/proc/stb/video/policy_choices").read():
            # TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching the left/right)
            policy_choices.update({"nonlinear": _("Nonlinear")})
    except:
        pass
    try:
        if "full" in open("/proc/stb/video/policy_choices").read():
            # TRANSLATORS: (aspect ratio policy: display as fullscreen, even if the content aspect ratio does not match the screen ratio)
            policy_choices.update({"full": _("Full screen")})
    except:
        pass
    try:
        if "auto" in open("/proc/stb/video/policy_choices").read():
            # TRANSLATORS: (aspect ratio policy: automatically select the best aspect ratio mode)
            policy_choices.update({"auto": _("Auto")})
    except:
        pass
    config.av.policy_43 = ConfigSelection(choices=policy_choices,
                                          default="pillarbox")
    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)

    iAVSwitch = AVSwitch()

    def setColorFormat(configElement):
        map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
        iAVSwitch.setColorFormat(map[configElement.value])

    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])

    def setSystem(configElement):
        map = {"pal": 0, "ntsc": 1, "multinorm": 2}
        iAVSwitch.setSystem(map[configElement.value])

    def setWSS(configElement):
        iAVSwitch.setAspectWSS()

    # this will call the "setup-val" initial
    config.av.colorformat.addNotifier(setColorFormat)
    config.av.aspectratio.addNotifier(setAspectRatio)
    config.av.tvsystem.addNotifier(setSystem)
    config.av.wss.addNotifier(setWSS)

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

    if SystemInfo["CanDownmixAC3"]:

        def setAC3Downmix(configElement):
            open("/proc/stb/audio/ac3",
                 "w").write(configElement.value and "downmix" or "passthrough")

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

    if SystemInfo["CanDownmixDTS"]:

        def setDTSDownmix(configElement):
            open("/proc/stb/audio/dts",
                 "w").write(configElement.value and "downmix" or "passthrough")

        config.av.downmix_dts = ConfigYesNo(default=True)
        config.av.downmix_dts.addNotifier(setDTSDownmix)

    if SystemInfo["CanDownmixAAC"]:

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

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

    try:
        SystemInfo["CanChangeOsdAlpha"] = open("/proc/stb/video/alpha",
                                               "r") and True or False
    except:
        SystemInfo["CanChangeOsdAlpha"] = False

    if SystemInfo["CanChangeOsdAlpha"]:

        def setAlpha(config):
            open("/proc/stb/video/alpha", "w").write(str(config.value))

        config.av.osd_alpha = ConfigSlider(default=255, limits=(0, 255))
        config.av.osd_alpha.addNotifier(setAlpha)

    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
                open("/proc/stb/vmpeg/0/pep_scaler_sharpness",
                     "w").write("%0.8X" % myval)
                open("/proc/stb/vmpeg/0/pep_apply", "w").write("1")
            except IOError:
                print "couldn't write pep_scaler_sharpness"

        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 SystemInfo["HasMultichannelPCM"]:

        def setMultichannelPCM(configElement):
            open(SystemInfo["HasMultichannelPCM"],
                 "w").write(configElement.value and "enable" or "disable")

        config.av.multichannel_pcm = ConfigYesNo(default=False)
        config.av.multichannel_pcm.addNotifier(setMultichannelPCM)

    if SystemInfo["HDMIAudioSource"]:

        def setHDMIAudioSource(configElement):
            open(SystemInfo["HDMIAudioSource"], "w").write(configElement.value)

        config.av.hdmi_audio_source = ConfigSelection(default="pcm",
                                                      choices=[
                                                          ("pcm", _("PCM")),
                                                          ("spdif", _("SPDIF"))
                                                      ])
        config.av.hdmi_audio_source.addNotifier(setHDMIAudioSource)

    def setVolumeStepsize(configElement):
        eDVBVolumecontrol.getInstance().setVolumeSteps(int(
            configElement.value))

    config.av.volume_stepsize = ConfigSelectionNumber(1, 10, 1, default=2)
    config.av.volume_stepsize.addNotifier(setVolumeStepsize)
示例#10
0
def InitUsageConfig():
    config.usage = ConfigSubsection()
    config.usage.showdish = ConfigYesNo(default=True)
    config.misc.showrotorposition = ConfigSelection(default='no', choices=[('no', _('no')),
     ('yes', _('yes')),
     ('withtext', _('with text')),
     ('tunername', _('with tuner name'))])
    config.usage.multibouquet = ConfigYesNo(default=True)
    config.usage.alternative_number_mode = ConfigYesNo(default=False)

    def alternativeNumberModeChange(configElement):
        eDVBDB.getInstance().setNumberingMode(configElement.value)
        refreshServiceList()

    config.usage.alternative_number_mode.addNotifier(alternativeNumberModeChange)
    config.usage.hide_number_markers = ConfigYesNo(default=True)
    config.usage.hide_number_markers.addNotifier(refreshServiceList)
    config.usage.servicetype_icon_mode = ConfigSelection(default='0', choices=[('0', _('None')), ('1', _('Left from servicename')), ('2', _('Right from servicename'))])
    config.usage.servicetype_icon_mode.addNotifier(refreshServiceList)
    config.usage.crypto_icon_mode = ConfigSelection(default='0', choices=[('0', _('None')), ('1', _('Left from servicename')), ('2', _('Right from servicename'))])
    config.usage.crypto_icon_mode.addNotifier(refreshServiceList)
    config.usage.record_indicator_mode = ConfigSelection(default='0', choices=[('0', _('None')),
     ('1', _('Left from servicename')),
     ('2', _('Right from servicename')),
     ('3', _('Red colored'))])
    config.usage.record_indicator_mode.addNotifier(refreshServiceList)
    choicelist = [('-1', _('Disable'))]
    for i in range(0, 1300, 100):
        choicelist.append((str(i), ngettext('%d pixel wide', '%d pixels wide', i) % i))

    config.usage.servicelist_column = ConfigSelection(default='-1', choices=choicelist)
    config.usage.servicelist_column.addNotifier(refreshServiceList)
    config.usage.service_icon_enable = ConfigYesNo(default=False)
    config.usage.service_icon_enable.addNotifier(refreshServiceList)
    config.usage.servicelist_cursor_behavior = ConfigSelection(default='standard', choices=[('standard', _('Standard')),
     ('keep', _('Keep service')),
     ('reverseB', _('Reverse bouquet buttons')),
     ('keep reverseB', _('Keep service') + ' + ' + _('Reverse bouquet buttons'))])
    choicelist = [('by skin', _('As defined by the skin'))]
    for i in range(5, 41):
        choicelist.append(str(i))

    config.usage.servicelist_number_of_services = ConfigSelection(default='by skin', choices=choicelist)
    config.usage.servicelist_number_of_services.addNotifier(refreshServiceList)
    config.usage.multiepg_ask_bouquet = ConfigYesNo(default=False)
    config.usage.quickzap_bouquet_change = ConfigYesNo(default=False)
    config.usage.e1like_radio_mode = ConfigYesNo(default=True)
    choicelist = [('0', _('No timeout'))]
    for i in range(1, 12):
        choicelist.append((str(i), ngettext('%d second', '%d seconds', i) % i))

    config.usage.infobar_timeout = ConfigSelection(default='5', choices=choicelist)
    config.usage.show_infobar_on_zap = ConfigYesNo(default=True)
    config.usage.show_infobar_on_skip = ConfigYesNo(default=True)
    config.usage.show_infobar_on_event_change = ConfigYesNo(default=False)
    config.usage.show_second_infobar = ConfigSelection(default=None, choices=[(None, _('None'))] + choicelist + [('EPG', _('EPG'))])
    config.usage.show_simple_second_infobar = ConfigYesNo(default=True)
    config.usage.infobar_frontend_source = ConfigSelection(default='tuner', choices=[('settings', _('Settings')), ('tuner', _('Tuner'))])
    config.usage.oldstyle_zap_controls = ConfigYesNo(default=False)
    config.usage.oldstyle_channel_select_controls = ConfigYesNo(default=False)
    config.usage.zap_with_ch_buttons = ConfigYesNo(default=False)
    config.usage.ok_is_channelselection = ConfigYesNo(default=False)
    config.usage.volume_instead_of_channelselection = ConfigYesNo(default=False)
    config.usage.channelselection_preview = ConfigYesNo(default=False)
    config.usage.show_spinner = ConfigYesNo(default=True)
    config.usage.menu_sort_weight = ConfigDictionarySet(default={'mainmenu': {'submenu': {}}})
    config.usage.menu_sort_mode = ConfigSelection(default='default', choices=[('a_z', _('alphabetical')), ('default', _('Default')), ('user', _('user defined'))])
    config.usage.menu_path = ConfigSelection(default='off', choices=[('off', _('Disabled')), ('small', _('Small')), ('large', _('Large'))])
    config.usage.enable_tt_caching = ConfigYesNo(default=True)
    choicelist = []
    for i in (10, 30):
        choicelist.append((str(i), ngettext('%d second', '%d seconds', i) % i))

    for i in (60, 120, 300, 600, 1200, 1800):
        m = i / 60
        choicelist.append((str(i), ngettext('%d minute', '%d minutes', m) % m))

    for i in (3600, 7200, 14400):
        h = i / 3600
        choicelist.append((str(i), ngettext('%d hour', '%d hours', h) % h))

    config.usage.hdd_standby = ConfigSelection(default='300', choices=[('0', _('No standby'))] + choicelist)
    config.usage.output_12V = ConfigSelection(default='do not change', choices=[('do not change', _('Do not change')), ('off', _('Off')), ('on', _('On'))])
    config.usage.pip_zero_button = ConfigSelection(default='standard', choices=[('standard', _('Standard')),
     ('swap', _('Swap PiP and main picture')),
     ('swapstop', _('Move PiP to main picture')),
     ('stop', _('Stop PiP'))])
    config.usage.pip_hideOnExit = ConfigSelection(default='without popup', choices=[('no', _('No')), ('popup', _('With popup')), ('without popup', _('Without popup'))])
    choicelist = [('-1', _('Disabled')), ('0', _('No timeout'))]
    for i in [60,
     300,
     600,
     900,
     1800,
     2700,
     3600]:
        m = i / 60
        choicelist.append((str(i), ngettext('%d minute', '%d minutes', m) % m))

    config.usage.pip_last_service_timeout = ConfigSelection(default='0', choices=choicelist)
    config.usage.default_path = ConfigText(default=resolveFilename(SCOPE_HDD))
    config.usage.timer_path = ConfigText(default='<default>')
    config.usage.instantrec_path = ConfigText(default='<default>')
    config.usage.timeshift_path = ConfigText(default='/media/hdd/')
    config.usage.allowed_timeshift_paths = ConfigLocations(default=['/media/hdd/'])
    config.oscaminfo = ConfigSubsection()
    config.oscaminfo.showInExtensions = ConfigYesNo(default=False)
    config.oscaminfo.userdatafromconf = ConfigYesNo(default=False)
    config.oscaminfo.autoupdate = ConfigYesNo(default=False)
    config.oscaminfo.username = ConfigText(default='username', fixed_size=False, visible_width=12)
    config.oscaminfo.password = ConfigPassword(default='password', fixed_size=False)
    config.oscaminfo.ip = ConfigIP(default=[127,
     0,
     0,
     1], auto_jump=True)
    config.oscaminfo.port = ConfigInteger(default=16002, limits=(0, 65536))
    config.oscaminfo.intervall = ConfigSelectionNumber(min=1, max=600, stepwidth=1, default=10, wraparound=True)
    SystemInfo['OScamInstalled'] = False
    config.cccaminfo = ConfigSubsection()
    config.cccaminfo.showInExtensions = ConfigYesNo(default=False)
    config.cccaminfo.serverNameLength = ConfigSelectionNumber(min=10, max=100, stepwidth=1, default=22, wraparound=True)
    config.cccaminfo.name = ConfigText(default='Profile', fixed_size=False)
    config.cccaminfo.ip = ConfigText(default='192.168.2.12', fixed_size=False)
    config.cccaminfo.username = ConfigText(default='', fixed_size=False)
    config.cccaminfo.password = ConfigText(default='', fixed_size=False)
    config.cccaminfo.port = ConfigInteger(default=16001, limits=(1, 65535))
    config.cccaminfo.profile = ConfigText(default='', fixed_size=False)
    config.cccaminfo.ecmInfoEnabled = ConfigYesNo(default=True)
    config.cccaminfo.ecmInfoTime = ConfigSelectionNumber(min=1, max=10, stepwidth=1, default=5, wraparound=True)
    config.cccaminfo.ecmInfoForceHide = ConfigYesNo(default=True)
    config.cccaminfo.ecmInfoPositionX = ConfigInteger(default=50)
    config.cccaminfo.ecmInfoPositionY = ConfigInteger(default=50)
    config.cccaminfo.blacklist = ConfigText(default='/media/cf/CCcamInfo.blacklisted', fixed_size=False)
    config.cccaminfo.profiles = ConfigText(default='/media/cf/CCcamInfo.profiles', fixed_size=False)
    config.usage.movielist_trashcan = ConfigYesNo(default=True)
    config.usage.movielist_trashcan_days = ConfigNumber(default=8)
    config.usage.movielist_trashcan_reserve = ConfigNumber(default=40)
    config.usage.on_movie_start = ConfigSelection(default='resume', choices=[('ask yes', _('Ask user') + ' ' + _('default') + ' ' + _('yes')),
     ('ask no', _('Ask user') + ' ' + _('default') + ' ' + _('no')),
     ('resume', _('Resume from last position')),
     ('beginning', _('Start from the beginning'))])
    config.usage.on_movie_stop = ConfigSelection(default='movielist', choices=[('ask', _('Ask user')), ('movielist', _('Return to movie list')), ('quit', _('Return to previous service'))])
    config.usage.on_movie_eof = ConfigSelection(default='movielist', choices=[('ask', _('Ask user')),
     ('movielist', _('Return to movie list')),
     ('quit', _('Return to previous service')),
     ('pause', _('Pause movie at end')),
     ('playlist', _('Play next (return to movie list)')),
     ('playlistquit', _('Play next (return to previous service)')),
     ('loop', _('Continues play (loop)')),
     ('repeatcurrent', _('Repeat'))])
    config.usage.next_movie_msg = ConfigYesNo(default=True)
    config.usage.last_movie_played = ConfigText()
    config.usage.leave_movieplayer_onExit = ConfigSelection(default='popup', choices=[('no', _('No')),
     ('popup', _('With popup')),
     ('without popup', _('Without popup')),
     ('movielist', _('Return to movie list'))])
    config.usage.setup_level = ConfigSelection(default='expert', choices=[('simple', _('Simple')), ('intermediate', _('Intermediate')), ('expert', _('Expert'))])
    config.usage.startup_to_standby = ConfigSelection(default='no', choices=[('no', _('No')), ('yes', _('Yes')), ('except', _('No, except Wakeup timer'))])
    config.usage.wakeup_menu = ConfigNothing()
    config.usage.wakeup_enabled = ConfigYesNo(default=False)
    config.usage.wakeup_day = ConfigSubDict()
    config.usage.wakeup_time = ConfigSubDict()
    for i in range(7):
        config.usage.wakeup_day[i] = ConfigEnableDisable(default=False)
        config.usage.wakeup_time[i] = ConfigClock(default=21600)

    choicelist = [('0', _('Do nothing'))]
    for i in range(3600, 21601, 3600):
        h = abs(i / 3600)
        h = ngettext('%d hour', '%d hours', h) % h
        choicelist.append((str(i), _('Standby in ') + h))

    config.usage.inactivity_timer = ConfigSelection(default='0', choices=choicelist)
    config.usage.inactivity_timer_blocktime = ConfigYesNo(default=True)
    config.usage.inactivity_timer_blocktime_begin = ConfigClock(default=time.mktime((0, 0, 0, 18, 0, 0, 0, 0, 0)))
    config.usage.inactivity_timer_blocktime_end = ConfigClock(default=time.mktime((0, 0, 0, 23, 0, 0, 0, 0, 0)))
    config.usage.inactivity_timer_blocktime_extra = ConfigYesNo(default=False)
    config.usage.inactivity_timer_blocktime_extra_begin = ConfigClock(default=time.mktime((0, 0, 0, 6, 0, 0, 0, 0, 0)))
    config.usage.inactivity_timer_blocktime_extra_end = ConfigClock(default=time.mktime((0, 0, 0, 9, 0, 0, 0, 0, 0)))
    choicelist = [('0', _('Disabled')), ('event_standby', _('Standby after current event'))]
    for i in range(900, 7201, 900):
        m = abs(i / 60)
        m = ngettext('%d minute', '%d minutes', m) % m
        choicelist.append((str(i), _('Standby in ') + m))

    config.usage.sleep_timer = ConfigSelection(default='0', choices=choicelist)
    choicelist = [('0', _('Disabled'))]
    for i in [60, 300, 600] + range(900, 7201, 900):
        m = abs(i / 60)
        m = ngettext('%d minute', '%d minutes', m) % m
        choicelist.append((str(i), _('after ') + m))

    config.usage.standby_to_shutdown_timer = ConfigSelection(default='0', choices=choicelist)
    config.usage.standby_to_shutdown_timer_blocktime = ConfigYesNo(default=True)
    config.usage.standby_to_shutdown_timer_blocktime_begin = ConfigClock(default=time.mktime((0, 0, 0, 6, 0, 0, 0, 0, 0)))
    config.usage.standby_to_shutdown_timer_blocktime_end = ConfigClock(default=time.mktime((0, 0, 0, 23, 0, 0, 0, 0, 0)))
    choicelist = [('0', _('Disabled'))]
    for m in (1, 5, 10, 15, 30, 60):
        choicelist.append((str(m * 60), ngettext('%d minute', '%d minutes', m) % m))

    config.usage.screen_saver = ConfigSelection(default='300', choices=choicelist)
    config.usage.check_timeshift = ConfigYesNo(default=True)
    choicelist = [('0', _('Disabled'))]
    for i in (2, 3, 4, 5, 10, 20, 30):
        choicelist.append((str(i), ngettext('%d second', '%d seconds', i) % i))

    for i in (60, 120, 300):
        m = i / 60
        choicelist.append((str(i), ngettext('%d minute', '%d minutes', m) % m))

    config.usage.timeshift_start_delay = ConfigSelection(default='0', choices=choicelist)
    config.usage.alternatives_priority = ConfigSelection(default='0', choices=[('0', 'DVB-S/-C/-T'),
     ('1', 'DVB-S/-T/-C'),
     ('2', 'DVB-C/-S/-T'),
     ('3', 'DVB-C/-T/-S'),
     ('4', 'DVB-T/-C/-S'),
     ('5', 'DVB-T/-S/-C'),
     ('127', _('No priority'))])
    config.usage.remote_fallback_enabled = ConfigYesNo(default=False)
    config.usage.remote_fallback = ConfigText(default='', fixed_size=False)
    config.usage.show_timer_conflict_warning = ConfigYesNo(default=True)
    dvbs_nims = [('-2', _('Disabled'))]
    dvbt_nims = [('-2', _('Disabled'))]
    dvbc_nims = [('-2', _('Disabled'))]
    atsc_nims = [("-2", _("Disabled"))]
    nims = [('-1', _('auto'))]
    for x in nimmanager.nim_slots:
        if x.isCompatible('DVB-S'):
            dvbs_nims.append((str(x.slot), x.getSlotName()))
        elif x.isCompatible('DVB-T'):
            dvbt_nims.append((str(x.slot), x.getSlotName()))
        elif x.isCompatible('DVB-C'):
            dvbc_nims.append((str(x.slot), x.getSlotName()))
        elif x.isCompatible("ATSC"):
			atsc_nims.append((str(x.slot), x.getSlotName()))    
        nims.append((str(x.slot), x.getSlotName()))

    config.usage.frontend_priority = ConfigSelection(default='-1', choices=list(nims))
    nims.insert(0, ('-2', _('Disabled')))
    config.usage.recording_frontend_priority = ConfigSelection(default='-2', choices=nims)
    config.usage.frontend_priority_dvbs = ConfigSelection(default='-2', choices=list(dvbs_nims))
    dvbs_nims.insert(1, ('-1', _('auto')))
    config.usage.recording_frontend_priority_dvbs = ConfigSelection(default='-2', choices=dvbs_nims)
    config.usage.frontend_priority_dvbt = ConfigSelection(default='-2', choices=list(dvbt_nims))
    dvbt_nims.insert(1, ('-1', _('auto')))
    config.usage.recording_frontend_priority_dvbt = ConfigSelection(default='-2', choices=dvbt_nims)
    config.usage.frontend_priority_dvbc = ConfigSelection(default='-2', choices=list(dvbc_nims))
    dvbc_nims.insert(1, ('-1', _('auto')))
    config.usage.recording_frontend_priority_dvbc = ConfigSelection(default='-2', choices=dvbc_nims)
    config.usage.frontend_priority_atsc = ConfigSelection(default = "-2", choices = list(atsc_nims))
	atsc_nims.insert(1,("-1", _("auto")))
	config.usage.recording_frontend_priority_atsc = ConfigSelection(default = "-2", choices = atsc_nims)
示例#11
0
def InitAVSwitch():
    config.av = ConfigSubsection()
    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.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="auto")
    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") and "auto" in open(
            "/proc/stb/video/policy2_choices").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")})
    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.
        "pillarbox": _("Pillarbox"),
        # TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term
        "panscan": _("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)
        "scale": _("Just scale")
    }
    if os.path.exists("/proc/stb/video/policy_choices") and "auto" in open(
            "/proc/stb/video/policy_choices").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")})
    config.av.policy_43 = ConfigSelection(choices=policy_choices,
                                          default="pillarbox")
    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)

    iAVSwitch = AVSwitch()

    def setColorFormat(configElement):
        if getBoxType() == 'gbquad' or getBoxType() == 'gbquadplus':
            map = {"cvbs": 0, "rgb": 3, "svideo": 2, "yuv": 3}
        else:
            map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
        iAVSwitch.setColorFormat(map[configElement.value])

    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])

    def setSystem(configElement):
        map = {"pal": 0, "ntsc": 1, "multinorm": 2}
        iAVSwitch.setSystem(map[configElement.value])

    def setWSS(configElement):
        iAVSwitch.setAspectWSS()

    # this will call the "setup-val" initial
    config.av.colorformat.addNotifier(setColorFormat)
    config.av.aspectratio.addNotifier(setAspectRatio)
    config.av.tvsystem.addNotifier(setSystem)
    config.av.wss.addNotifier(setWSS)

    iAVSwitch.setInput("ENCODER")  # init on startup
    if (getBoxType()
            in ('gbquad', 'gbquadplus', 'gb800seplus', 'gb800ueplus')):
        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")
                f.write(configElement.value)
                f.close()
            except:
                pass

        config.av.bypass_edid_checking = ConfigSelection(choices={
            "00000000": _("off"),
            "00000001": _("on")
        },
                                                         default="00000000")
        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/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 setAutoVulume(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(setAutoVulume)
    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()

    try:
        can_osd_alpha = open("/proc/stb/video/alpha", "r") and True or False
    except:
        can_osd_alpha = False

    SystemInfo["CanChangeOsdAlpha"] = can_osd_alpha

    def setAlpha(config):
        open("/proc/stb/video/alpha", "w").write(str(config.value))

    if can_osd_alpha:
        config.av.osd_alpha = ConfigSlider(default=255, limits=(0, 255))
        config.av.osd_alpha.addNotifier(setAlpha)

    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)
示例#12
0
def InitAVSwitch():
    config.av = ConfigSubsection()
    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.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="auto")

    # 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 "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")})

    # print "AVSWITCH - policy2_choices: ", policy2_choices
    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 "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")})

    # print "AVSWITCH - policy_choices: ", policy_choices
    config.av.policy_43 = ConfigSelection(choices=policy_choices,
                                          default="letterbox")
    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)

    iAVSwitch = AVSwitch()

    def setColorFormat(configElement):
        map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
        iAVSwitch.setColorFormat(map[configElement.value])

    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])

    def setSystem(configElement):
        map = {"pal": 0, "ntsc": 1, "multinorm": 2}
        iAVSwitch.setSystem(map[configElement.value])

    def setWSS(configElement):
        iAVSwitch.setAspectWSS()

    # this will call the "setup-val" initial
    config.av.colorformat.addNotifier(setColorFormat)
    config.av.aspectratio.addNotifier(setAspectRatio)
    config.av.tvsystem.addNotifier(setSystem)
    config.av.wss.addNotifier(setWSS)

    iAVSwitch.setInput("ENCODER")  # init on startup
    if getBoxType() in ('gbquad4k', 'gbue4k', 'gbquad', 'gbquadplus',
                        'gb800seplus', 'gb800ueplus', 'gbipbox', 'gbultra',
                        'gbultraue', 'gbultraueh', 'gbultrase', 'spycat',
                        'gbx1', 'gbx2', 'gbx3', 'gbx3h'):
        detected = False
    else:
        detected = eAVSwitch.getInstance().haveScartSwitch()

    SystemInfo["ScartSwitch"] = detected

    if SystemInfo["HasMultichannelPCM"]:

        def setPCMMultichannel(configElement):
            open(SystemInfo["HasMultichannelPCM"],
                 "w").write(configElement.value and "enable" or "disable")

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

    try:
        SystemInfo["CanDownmixAC3"] = "downmix" in open(
            "/proc/stb/audio/ac3_choices", "r").read()
    except:
        SystemInfo["CanDownmixAC3"] = False

    if SystemInfo["CanDownmixAC3"]:

        def setAC3Downmix(configElement):
            open("/proc/stb/audio/ac3",
                 "w").write(configElement.value and "downmix" or "passthrough")

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

    try:
        SystemInfo["CanDownmixDTS"] = "downmix" in open(
            "/proc/stb/audio/dts_choices", "r").read()
    except:
        SystemInfo["CanDownmixDTS"] = False

    if SystemInfo["CanDownmixDTS"]:

        def setDTSDownmix(configElement):
            open("/proc/stb/audio/dts",
                 "w").write(configElement.value and "downmix" or "passthrough")

        config.av.downmix_dts = ConfigYesNo(default=True)
        config.av.downmix_dts.addNotifier(setDTSDownmix)

    try:
        SystemInfo["CanDownmixAAC"] = "downmix" in open(
            "/proc/stb/audio/aac_choices", "r").read()
    except:
        SystemInfo["CanDownmixAAC"] = False

    if SystemInfo["CanDownmixAAC"]:

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

        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()

    try:
        SystemInfo["CanChangeOsdAlpha"] = open("/proc/stb/video/alpha",
                                               "r") and True or False
    except:
        SystemInfo["CanChangeOsdAlpha"] = False

    if SystemInfo["CanChangeOsdAlpha"]:

        def setAlpha(config):
            open("/proc/stb/video/alpha", "w").write(str(config.value))

        config.av.osd_alpha = ConfigSlider(default=255,
                                           increment=5,
                                           limits=(20, 255))
        config.av.osd_alpha.addNotifier(setAlpha)

    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
                open("/proc/stb/vmpeg/0/pep_scaler_sharpness",
                     "w").write("%0.8X" % myval)
                open("/proc/stb/vmpeg/0/pep_apply", "w").write("1")
            except IOError:
                print "couldn't write pep_scaler_sharpness"

        if getBoxType() in ('gbquad4k', '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=True)

    if SystemInfo["HasMultichannelPCM"]:

        def setMultichannelPCM(configElement):
            open(SystemInfo["HasMultichannelPCM"],
                 "w").write(configElement.value and "enable" or "disable")

        config.av.multichannel_pcm = ConfigYesNo(default=False)
        config.av.multichannel_pcm.addNotifier(setMultichannelPCM)

    if SystemInfo["HasAutoVolume"]:

        def setAutoVolume(configElement):
            open(SystemInfo["HasAutoVolume"], "w").write(configElement.value)

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

    if SystemInfo["HasAutoVolumeLevel"]:

        def setAutoVolumeLevel(configElement):
            open(SystemInfo["HasAutoVolumeLevel"],
                 "w").write(configElement.value and "enabled" or "disabled")

        config.av.autovolumelevel = ConfigYesNo(default=False)
        config.av.autovolumelevel.addNotifier(setAutoVolumeLevel)

    if SystemInfo["Has3DSurround"]:

        def set3DSurround(configElement):
            open(SystemInfo["Has3DSurround"], "w").write(configElement.value)

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

    if SystemInfo["Has3DSpeaker"]:

        def set3DSpeaker(configElement):
            open(SystemInfo["Has3DSpeaker"], "w").write(configElement.value)

        config.av.speaker_3d = ConfigSelection(default="center",
                                               choices=[("center",
                                                         _("center")),
                                                        ("wide", _("wide")),
                                                        ("extrawide",
                                                         _("extra wide"))])
        config.av.speaker_3d.addNotifier(set3DSpeaker)

    if SystemInfo["Has3DSurroundSpeaker"]:

        def set3DSurroundSpeaker(configElement):
            open(SystemInfo["Has3DSurroundSpeaker"],
                 "w").write(configElement.value)

        config.av.surround_3d_speaker = ConfigSelection(
            default="disabled",
            choices=[("disabled", _("off")), ("center", _("center")),
                     ("wide", _("wide")), ("extrawide", _("extra wide"))])
        config.av.surround_3d_speaker.addNotifier(set3DSurroundSpeaker)

    if SystemInfo["Has3DSurroundSoftLimiter"]:

        def set3DSurroundSoftLimiter(configElement):
            open(SystemInfo["Has3DSurroundSoftLimiter"],
                 "w").write(configElement.value and "enabled" or "disabled")

        config.av.surround_softlimiter_3d = ConfigYesNo(default=False)
        config.av.surround_softlimiter_3d.addNotifier(set3DSurroundSoftLimiter)
示例#13
0
def InitAVSwitch():
	config.av = ConfigSubsection()
	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.getValue():
		colorformat_choices["yuv"] = _("YPbPr")

	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 = "auto")
	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.
	"pillarbox": _("Pillarbox"),
	# TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term
	"panscan": _("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)
	"scale": _("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 = "pillarbox")
	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)

	iAVSwitch = AVSwitch()

	def setColorFormat(configElement):
		if getBoxType() == 'et6x00':
			map = {"cvbs": 3, "rgb": 3, "svideo": 2, "yuv": 3}	
		elif getBoxType() == 'gbquad' 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.getValue()])

	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.getValue()])

	def setSystem(configElement):
		map = {"pal": 0, "ntsc": 1, "multinorm" : 2}
		iAVSwitch.setSystem(map[configElement.getValue()])

	def setWSS(configElement):
		iAVSwitch.setAspectWSS()

	# this will call the "setup-val" initial
	config.av.colorformat.addNotifier(setColorFormat)
	config.av.aspectratio.addNotifier(setAspectRatio)
	config.av.tvsystem.addNotifier(setSystem)
	config.av.wss.addNotifier(setWSS)

	iAVSwitch.setInput("ENCODER") # init on startup
	if getBoxType() == 'gbquad' or getBoxType() == 'et5x00' or getBoxType() == 'ixussone' or getBoxType() == 'ixusszero' or model == 'et6000' or getBoxType() == 'e3hd':
		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")
				f.write(configElement.value)
				f.close()
			except:
				pass
		config.av.bypass_edid_checking = ConfigSelection(choices={
				"00000000": _("off"),
				"00000001": _("on")},
				default = "00000000")
		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()

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

	SystemInfo["CanDownmixAC3"] = can_downmix
	if can_downmix:
		def setAC3Downmix(configElement):
			f = open("/proc/stb/audio/ac3", "w")
			f.write(configElement.value and "downmix" or "passthrough")
			f.close()
		config.av.downmix_ac3 = ConfigYesNo(default = True)
		config.av.downmix_ac3.addNotifier(setAC3Downmix)

	if os.path.exists("/proc/stb/vmpeg/0/pep_scaler_sharpness"):
		def setScaler_sharpness(config):
			myval = int(config.getValue())
			try:
				print "--> 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() == 'gbquad':
			config.av.scaler_sharpness = ConfigSlider(default=13, 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())
def InitSenseWheel():
    detected = eQBOXSenseWheel.getInstance().detected()
    SystemInfo["SenseWheel"] = detected
    config.sensewheel = ConfigSubsection()

    def setPanelLedsEnable(configElement):
        isensewheel.disableSense()
        config.sensewheel.ledpanelhue.enable = configElement.value
        config.sensewheel.ledpanelsaturation.enable = configElement.value
        config.sensewheel.ledpanelvalue.enable = configElement.value
        isensewheel.setPanelLedsEnable(configElement.value)

    def setBoardLedsEnable(configElement):
        isensewheel.disableSense()
        config.sensewheel.ledboardhue.enable = configElement.value
        config.sensewheel.ledboardsaturation.enable = configElement.value
        config.sensewheel.ledboardvalue.enable = configElement.value
        isensewheel.setBoardLedsEnable(configElement.value)

    def setPanelLedsHue(configElement):
        isensewheel.disableSense()
        isensewheel.setPanelLedsHue(configElement.value)

    def setPanelLedsSaturation(configElement):
        isensewheel.disableSense()
        isensewheel.setPanelLedsSaturation(configElement.value)

    def setPanelLedsValue(configElement):
        isensewheel.disableSense()
        isensewheel.setPanelLedsValue(configElement.value)

    def setBoardLedsHue(configElement):
        isensewheel.disableSense()
        isensewheel.setBoardLedsHue(configElement.value)

    def setBoardLedsSaturation(configElement):
        isensewheel.disableSense()
        isensewheel.setBoardLedsSaturation(configElement.value)

    def setBoardLedsValue(configElement):
        isensewheel.disableSense()
        isensewheel.setBoardLedsValue(configElement.value)

    def disableSense(configElement):
        isensewheel.disableSense()

    def enableSense(configElement):
        isensewheel.enableSense()

    def setEnableFlag(configElement):
        isensewheel.setEnableFlag(configElement.value)

    def setStandbyPanelLeds(configElement):
        isensewheel.setStandbyPanelLeds(configElement.value)

    def setStandbyBoardLeds(configElement):
        isensewheel.setStandbyBoardLeds(configElement.value)

    def setStandbyPanel(configElement):
        isensewheel.setStandbyPanel(configElement.value)

    def saveAndExitFromSensePlugin(configElement):
        if (isensewheel.IsFlagSenseEnabled()):
            isensewheel.enableSense()
        else:
            isensewheel.setPanelLedsEnable(False)
            isensewheel.disableSense()  #-<
        # confirm flag enabled sensewheel
        isensewheel.ConfirmFlagSenseEnabled()

    def reloadAndExitFromSensePlugin(configElement):
        # restore old sense enable situation saved
        isensewheel.RestoreOrigFlagSenseEnabled()
        if (isensewheel.IsFlagSenseEnabled()):
            isensewheel.enableSense()
        else:
            isensewheel.setPanelLedsEnable(False)
            isensewheel.disableSense()  #-<

    # WHEEL -----------------------------------------------------------------------------------
    config.sensewheel.ledpanelhue = ConfigSlider(default=150,
                                                 increment=4,
                                                 limits=(0, 359))
    config.sensewheel.ledpanelhue.addNotifier(setPanelLedsHue)
    config.sensewheel.ledpanelhue.apply = lambda: setPanelLedsHue(
        config.sensewheel.ledpanelhue)
    config.sensewheel.ledpanelhue.addNotifierLoad(reloadAndExitFromSensePlugin)
    config.sensewheel.ledpanelhue.addNotifierSave(saveAndExitFromSensePlugin)
    config.sensewheel.ledpanelsaturation = ConfigSlider(default=50,
                                                        increment=2,
                                                        limits=(0, 99))
    config.sensewheel.ledpanelsaturation.addNotifier(setPanelLedsSaturation)
    config.sensewheel.ledpanelsaturation.apply = lambda: setPanelLedsSaturation(
        config.sensewheel.ledpanelsaturation)
    config.sensewheel.ledpanelsaturation.addNotifierLoad(
        reloadAndExitFromSensePlugin)
    config.sensewheel.ledpanelsaturation.addNotifierSave(
        saveAndExitFromSensePlugin)
    config.sensewheel.ledpanelvalue = ConfigSlider(default=50,
                                                   increment=2,
                                                   limits=(0, 99))
    config.sensewheel.ledpanelvalue.addNotifier(setPanelLedsValue)
    config.sensewheel.ledpanelvalue.apply = lambda: setPanelLedsValue(
        config.sensewheel.ledpanelvalue)
    config.sensewheel.ledpanelvalue.addNotifierLoad(
        reloadAndExitFromSensePlugin)
    config.sensewheel.ledpanelvalue.addNotifierSave(saveAndExitFromSensePlugin)
    config.sensewheel.ledpanelenabled = ConfigOnOff()
    config.sensewheel.ledpanelenabled.addNotifier(setPanelLedsEnable)
    config.sensewheel.ledpanelenabled.apply = lambda: setPanelLedsEnable(
        config.sensewheel.ledpanelenabled)
    config.sensewheel.ledpanelenabled.addNotifierLoad(
        reloadAndExitFromSensePlugin)
    config.sensewheel.ledpanelenabled.addNotifierSave(
        saveAndExitFromSensePlugin)
    # BOARD -----------------------------------------------------------------------------------
    config.sensewheel.ledboardhue = ConfigSlider(default=150,
                                                 increment=4,
                                                 limits=(0, 359))
    config.sensewheel.ledboardhue.addNotifier(setBoardLedsHue)
    config.sensewheel.ledboardhue.apply = lambda: setBoardLedsHue(
        config.sensewheel.ledboardhue)
    config.sensewheel.ledboardhue.addNotifierLoad(reloadAndExitFromSensePlugin)
    config.sensewheel.ledboardhue.addNotifierSave(saveAndExitFromSensePlugin)
    config.sensewheel.ledboardsaturation = ConfigSlider(default=50,
                                                        increment=2,
                                                        limits=(0, 99))
    config.sensewheel.ledboardsaturation.addNotifier(setBoardLedsSaturation)
    config.sensewheel.ledboardsaturation.apply = lambda: setBoardLedsSaturation(
        config.sensewheel.ledboardsaturation)
    config.sensewheel.ledboardsaturation.addNotifierLoad(
        reloadAndExitFromSensePlugin)
    config.sensewheel.ledboardsaturation.addNotifierSave(
        saveAndExitFromSensePlugin)
    config.sensewheel.ledboardvalue = ConfigSlider(default=50,
                                                   increment=2,
                                                   limits=(0, 99))
    config.sensewheel.ledboardvalue.addNotifier(setBoardLedsValue)
    config.sensewheel.ledboardvalue.apply = lambda: setBoardLedsValue(
        config.sensewheel.ledboardvalue)
    config.sensewheel.ledboardvalue.addNotifierLoad(
        reloadAndExitFromSensePlugin)
    config.sensewheel.ledboardvalue.addNotifierSave(saveAndExitFromSensePlugin)
    config.sensewheel.ledboardenabled = ConfigOnOff()
    config.sensewheel.ledboardenabled.addNotifier(setBoardLedsEnable)
    config.sensewheel.ledboardenabled.apply = lambda: setBoardLedsEnable(
        config.sensewheel.ledboardenabled)
    config.sensewheel.ledpanelenabled.addNotifierLoad(
        reloadAndExitFromSensePlugin)
    config.sensewheel.ledpanelenabled.addNotifierSave(
        saveAndExitFromSensePlugin)
    # TOUCH ----------------------------------------------------------------------------------
    config.sensewheel.enabled = ConfigEnableDisable()
    config.sensewheel.enabled.addNotifier(setEnableFlag)
    config.sensewheel.enabled.apply = lambda: setEnableFlag(config.sensewheel.
                                                            enabled.value)
    ### Init ###
    isensewheel.setInitEnableFlag(config.sensewheel.enabled.value)
    if (isensewheel.IsFlagSenseEnabled()):
        print("ENABLE")
        isensewheel.enableSense()
    else:
        print("DISABLE")
        isensewheel.setPanelLedsEnable(False)
        isensewheel.disableSense()  #-<
############
    config.sensewheel.enabled.addNotifierLoad(reloadAndExitFromSensePlugin)
    config.sensewheel.enabled.addNotifierSave(saveAndExitFromSensePlugin)
    config.sensewheel.standbypanelled = ConfigOnOff()
    config.sensewheel.standbypanelled.addNotifier(setStandbyPanelLeds)
    config.sensewheel.standbypanelled.apply = lambda: setStandbyPanelLeds(
        config.sensewheel.standbypanelled)
    config.sensewheel.standbypanelled.addNotifierLoad(
        reloadAndExitFromSensePlugin)
    config.sensewheel.standbypanelled.addNotifierSave(
        saveAndExitFromSensePlugin)
    config.sensewheel.standbyboardled = ConfigOnOff()
    config.sensewheel.standbyboardled.addNotifier(setStandbyBoardLeds)
    config.sensewheel.standbyboardled.apply = lambda: setStandbyBoardLeds(
        config.sensewheel.standbyboardled)
    config.sensewheel.standbyboardled.addNotifierLoad(
        reloadAndExitFromSensePlugin)
    config.sensewheel.standbyboardled.addNotifierSave(
        saveAndExitFromSensePlugin)
    config.sensewheel.enablepanelstandby = ConfigOnOff()
    config.sensewheel.enablepanelstandby.addNotifier(setStandbyPanel)
    config.sensewheel.enablepanelstandby.apply = lambda: setStandbyPanel(
        config.sensewheel.enablepanelstandby)
    config.sensewheel.enablepanelstandby.addNotifierLoad(
        reloadAndExitFromSensePlugin)
    config.sensewheel.enablepanelstandby.addNotifierSave(
        saveAndExitFromSensePlugin)
示例#15
0
def InitUsageConfig():
    config.usage = ConfigSubsection()
    config.usage.subnetwork = ConfigYesNo(default=True)
    config.usage.subnetwork_cable = ConfigYesNo(default=True)
    config.usage.subnetwork_terrestrial = ConfigYesNo(default=True)
    config.usage.showdish = ConfigYesNo(default=True)
    config.misc.showrotorposition = ConfigSelection(
        default='no',
        choices=[('no', _('no')), ('yes', _('yes')),
                 ('withtext', _('with text')),
                 ('tunername', _('with tuner name'))])
    config.usage.multibouquet = ConfigYesNo(default=True)
    config.usage.alternative_number_mode = ConfigYesNo(default=True)

    def alternativeNumberModeChange(configElement):
        eDVBDB.getInstance().setNumberingMode(configElement.value)
        refreshServiceList()

    config.usage.alternative_number_mode.addNotifier(
        alternativeNumberModeChange)
    config.usage.hide_number_markers = ConfigYesNo(default=True)
    config.usage.hide_number_markers.addNotifier(refreshServiceList)
    config.usage.servicetype_icon_mode = ConfigSelection(
        default='0',
        choices=[('0', _('None')), ('1', _('Left from servicename')),
                 ('2', _('Right from servicename'))])
    config.usage.servicetype_icon_mode.addNotifier(refreshServiceList)
    config.usage.crypto_icon_mode = ConfigSelection(
        default='0',
        choices=[('0', _('None')), ('1', _('Left from servicename')),
                 ('2', _('Right from servicename'))])
    config.usage.crypto_icon_mode.addNotifier(refreshServiceList)
    config.usage.record_indicator_mode = ConfigSelection(
        default='0',
        choices=[('0', _('None')), ('1', _('Left from servicename')),
                 ('2', _('Right from servicename')), ('3', _('Red colored'))])
    config.usage.record_indicator_mode.addNotifier(refreshServiceList)
    choicelist = [('-1', _('Disable'))]
    for i in range(0, 1300, 100):
        choicelist.append(
            (str(i), ngettext('%d pixel wide', '%d pixels wide', i) % i))

    config.usage.servicelist_column = ConfigSelection(default='-1',
                                                      choices=choicelist)
    config.usage.servicelist_column.addNotifier(refreshServiceList)
    config.usage.service_icon_enable = ConfigYesNo(default=False)
    config.usage.service_icon_enable.addNotifier(refreshServiceList)
    config.usage.servicelist_cursor_behavior = ConfigSelection(
        default='standard',
        choices=[('standard', _('Standard')), ('keep', _('Keep service')),
                 ('reverseB', _('Reverse bouquet buttons')),
                 ('keep reverseB',
                  _('Keep service') + ' + ' + _('Reverse bouquet buttons'))])
    choicelist = [('by skin', _('As defined by the skin'))]
    for i in range(5, 41):
        choicelist.append(str(i))

    config.usage.servicelist_number_of_services = ConfigSelection(
        default='by skin', choices=choicelist)
    config.usage.servicelist_number_of_services.addNotifier(refreshServiceList)
    config.usage.multiepg_ask_bouquet = ConfigYesNo(default=False)
    config.usage.quickzap_bouquet_change = ConfigYesNo(default=False)
    config.usage.e1like_radio_mode = ConfigYesNo(default=True)
    choicelist = [('0', _('No timeout'))]
    for i in range(1, 20):
        choicelist.append((str(i), ngettext('%d second', '%d seconds', i) % i))

    config.usage.infobar_timeout = ConfigSelection(default='5',
                                                   choices=choicelist)
    config.usage.show_infobar_do_dimming = ConfigYesNo(default=True)
    config.usage.show_infobar_dimming_speed = ConfigSelectionNumber(
        min=1, max=40, stepwidth=1, default=40, wraparound=True)
    config.usage.show_infobar_on_zap = ConfigYesNo(default=True)
    config.usage.show_infobar_on_skip = ConfigYesNo(default=True)
    config.usage.show_infobar_on_event_change = ConfigYesNo(default=False)
    config.usage.show_second_infobar = ConfigSelection(
        default=5,
        choices=[("", _('None'))] + choicelist + [('EPG', _('EPG'))])
    config.usage.show_simple_second_infobar = ConfigYesNo(default=True)
    config.usage.infobar_frontend_source = ConfigSelection(
        default='settings',
        choices=[('settings', _('Settings')), ('tuner', _('Tuner'))])
    config.usage.oldstyle_zap_controls = ConfigYesNo(default=False)
    config.usage.oldstyle_channel_select_controls = ConfigYesNo(default=False)
    config.usage.zap_with_ch_buttons = ConfigYesNo(default=False)
    config.usage.ok_is_channelselection = ConfigYesNo(default=False)
    config.usage.volume_instead_of_channelselection = ConfigYesNo(
        default=False)
    config.usage.channelselection_preview = ConfigYesNo(default=False)
    config.usage.show_spinner = ConfigYesNo(default=True)
    config.usage.menu_sort_weight = ConfigDictionarySet(
        default={'mainmenu': {
            'submenu': {}
        }})
    config.usage.menu_sort_mode = ConfigSelection(
        default='default',
        choices=[('a_z', _('alphabetical')), ('default', _('Default')),
                 ('user', _('user defined'))])
    config.usage.menu_show_numbers = ConfigYesNo(default=False)
    config.usage.menu_path = ConfigSelection(default='off',
                                             choices=[('off', _('Disabled')),
                                                      ('small', _('Small')),
                                                      ('large', _('Large'))])
    config.usage.enable_tt_caching = ConfigYesNo(default=True)
    choicelist = []
    for i in (10, 30):
        choicelist.append((str(i), ngettext('%d second', '%d seconds', i) % i))

    for i in (60, 120, 300, 600, 1200, 1800):
        m = i / 60
        choicelist.append((str(i), ngettext('%d minute', '%d minutes', m) % m))

    for i in (3600, 7200, 14400):
        h = i / 3600
        choicelist.append((str(i), ngettext('%d hour', '%d hours', h) % h))

    config.usage.hdd_standby = ConfigSelection(
        default='300', choices=[('0', _('No standby'))] + choicelist)
    config.usage.output_12V = ConfigSelection(default='do not change',
                                              choices=[('do not change',
                                                        _('Do not change')),
                                                       ('off', _('Off')),
                                                       ('on', _('On'))])
    config.usage.pip_zero_button = ConfigSelection(
        default='standard',
        choices=[('standard', _('Standard')),
                 ('swap', _('Swap PiP and main picture')),
                 ('swapstop', _('Move PiP to main picture')),
                 ('stop', _('Stop PiP'))])
    config.usage.pip_hideOnExit = ConfigSelection(default='without popup',
                                                  choices=[('no', _('No')),
                                                           ('popup',
                                                            _('With popup')),
                                                           ('without popup',
                                                            _('Without popup'))
                                                           ])
    choicelist = [('-1', _('Disabled')), ('0', _('No timeout'))]
    for i in [60, 300, 600, 900, 1800, 2700, 3600]:
        m = i / 60
        choicelist.append((str(i), ngettext('%d minute', '%d minutes', m) % m))

    config.usage.pip_last_service_timeout = ConfigSelection(default='0',
                                                            choices=choicelist)
    config.usage.default_path = ConfigText(default='')
    config.usage.timer_path = ConfigText(default='<default>')
    config.usage.instantrec_path = ConfigText(default='<default>')
    config.usage.timeshift_path = ConfigText(default='/media/hdd/')
    config.usage.allowed_timeshift_paths = ConfigLocations(
        default=['/media/hdd/'])
    config.ncaminfo = ConfigSubsection()
    config.ncaminfo.showInExtensions = ConfigYesNo(default=False)
    config.ncaminfo.userdatafromconf = ConfigYesNo(default=False)
    config.ncaminfo.autoupdate = ConfigYesNo(default=False)
    config.ncaminfo.username = ConfigText(default='username',
                                          fixed_size=False,
                                          visible_width=12)
    config.ncaminfo.password = ConfigPassword(default='password',
                                              fixed_size=False)
    config.ncaminfo.ip = ConfigIP(default=[127, 0, 0, 1], auto_jump=True)
    config.ncaminfo.port = ConfigInteger(default=8181, limits=(0, 65536))
    config.ncaminfo.intervall = ConfigSelectionNumber(min=1,
                                                      max=600,
                                                      stepwidth=1,
                                                      default=10,
                                                      wraparound=True)
    config.oscaminfo = ConfigSubsection()
    config.oscaminfo.showInExtensions = ConfigYesNo(default=False)
    config.oscaminfo.userdatafromconf = ConfigYesNo(default=False)
    config.oscaminfo.autoupdate = ConfigYesNo(default=False)
    config.oscaminfo.username = ConfigText(default='username',
                                           fixed_size=False,
                                           visible_width=12)
    config.oscaminfo.password = ConfigPassword(default='password',
                                               fixed_size=False)
    config.oscaminfo.ip = ConfigIP(default=[127, 0, 0, 1], auto_jump=True)
    config.oscaminfo.port = ConfigInteger(default=16002, limits=(0, 65536))
    config.oscaminfo.intervall = ConfigSelectionNumber(min=1,
                                                       max=600,
                                                       stepwidth=1,
                                                       default=10,
                                                       wraparound=True)
    SystemInfo['OScamInstalled'] = False
    config.cccaminfo = ConfigSubsection()
    config.cccaminfo.showInExtensions = ConfigYesNo(default=False)
    config.cccaminfo.serverNameLength = ConfigSelectionNumber(min=10,
                                                              max=100,
                                                              stepwidth=1,
                                                              default=22,
                                                              wraparound=True)
    config.cccaminfo.name = ConfigText(default='Profile', fixed_size=False)
    config.cccaminfo.ip = ConfigText(default='192.168.2.12', fixed_size=False)
    config.cccaminfo.username = ConfigText(default='', fixed_size=False)
    config.cccaminfo.password = ConfigText(default='', fixed_size=False)
    config.cccaminfo.port = ConfigInteger(default=16001, limits=(1, 65535))
    config.cccaminfo.profile = ConfigText(default='', fixed_size=False)
    config.cccaminfo.ecmInfoEnabled = ConfigYesNo(default=True)
    config.cccaminfo.ecmInfoTime = ConfigSelectionNumber(min=1,
                                                         max=10,
                                                         stepwidth=1,
                                                         default=5,
                                                         wraparound=True)
    config.cccaminfo.ecmInfoForceHide = ConfigYesNo(default=True)
    config.cccaminfo.ecmInfoPositionX = ConfigInteger(default=50)
    config.cccaminfo.ecmInfoPositionY = ConfigInteger(default=50)
    config.cccaminfo.blacklist = ConfigText(
        default='/media/cf/CCcamInfo.blacklisted', fixed_size=False)
    config.cccaminfo.profiles = ConfigText(
        default='/media/cf/CCcamInfo.profiles', fixed_size=False)
    config.usage.movielist_trashcan = ConfigYesNo(default=True)
    config.usage.movielist_trashcan_days = ConfigNumber(default=8)
    config.usage.movielist_trashcan_reserve = ConfigNumber(default=40)
    config.usage.on_movie_start = ConfigSelection(
        default='resume',
        choices=[
            ('ask yes', _('Ask user') + ' ' + _('default') + ' ' + _('yes')),
            ('ask no', _('Ask user') + ' ' + _('default') + ' ' + _('no')),
            ('resume', _('Resume from last position')),
            ('beginning', _('Start from the beginning'))
        ])
    config.usage.on_movie_stop = ConfigSelection(
        default='movielist',
        choices=[('ask', _('Ask user')),
                 ('movielist', _('Return to movie list')),
                 ('quit', _('Return to previous service'))])
    config.usage.on_movie_eof = ConfigSelection(
        default='movielist',
        choices=[('ask', _('Ask user')),
                 ('movielist', _('Return to movie list')),
                 ('quit', _('Return to previous service')),
                 ('pause', _('Pause movie at end')),
                 ('playlist', _('Play next (return to movie list)')),
                 ('playlistquit', _('Play next (return to previous service)')),
                 ('loop', _('Continues play (loop)')),
                 ('repeatcurrent', _('Repeat'))])
    config.usage.next_movie_msg = ConfigYesNo(default=True)
    config.usage.last_movie_played = ConfigText()
    config.usage.leave_movieplayer_onExit = ConfigSelection(
        default='popup',
        choices=[('no', _('No')), ('popup', _('With popup')),
                 ('without popup', _('Without popup')),
                 ('movielist', _('Return to movie list'))])
    config.usage.setup_level = ConfigSelection(default='expert',
                                               choices=[
                                                   ('simple', _('Normal')),
                                                   ('intermediate',
                                                    _('Advanced')),
                                                   ('expert', _('Expert'))
                                               ])
    config.usage.startup_to_standby = ConfigSelection(
        default='no',
        choices=[('no', _('No')), ('yes', _('Yes')),
                 ('except', _('No, except Wakeup timer'))])
    config.usage.wakeup_menu = ConfigNothing()
    config.usage.wakeup_enabled = ConfigYesNo(default=False)
    config.usage.wakeup_day = ConfigSubDict()
    config.usage.wakeup_time = ConfigSubDict()
    for i in range(7):
        config.usage.wakeup_day[i] = ConfigEnableDisable(default=False)
        config.usage.wakeup_time[i] = ConfigClock(default=21600)

    choicelist = [('0', _('Do nothing'))]
    for i in range(3600, 21601, 3600):
        h = abs(i / 3600)
        h = ngettext('%d hour', '%d hours', h) % h
        choicelist.append((str(i), _('Standby in ') + h))

    config.usage.inactivity_timer = ConfigSelection(default='0',
                                                    choices=choicelist)
    config.usage.inactivity_timer_blocktime = ConfigYesNo(default=True)
    config.usage.inactivity_timer_blocktime_begin = ConfigClock(
        default=time.mktime((0, 0, 0, 18, 0, 0, 0, 0, 0)))
    config.usage.inactivity_timer_blocktime_end = ConfigClock(
        default=time.mktime((0, 0, 0, 23, 0, 0, 0, 0, 0)))
    config.usage.inactivity_timer_blocktime_extra = ConfigYesNo(default=False)
    config.usage.inactivity_timer_blocktime_extra_begin = ConfigClock(
        default=time.mktime((0, 0, 0, 6, 0, 0, 0, 0, 0)))
    config.usage.inactivity_timer_blocktime_extra_end = ConfigClock(
        default=time.mktime((0, 0, 0, 9, 0, 0, 0, 0, 0)))
    choicelist = [('0', _('Disabled')),
                  ('event_standby', _('Standby after current event'))]
    for i in range(900, 7201, 900):
        m = abs(i / 60)
        m = ngettext('%d minute', '%d minutes', m) % m
        choicelist.append((str(i), _('Standby in ') + m))

    config.usage.sleep_timer = ConfigSelection(default='0', choices=choicelist)
    choicelist = [('0', _('Disabled'))]
    for i in [300, 300, 600] + range(900, 7201, 900):
        m = abs(i / 60)
        m = ngettext('%d minute', '%d minutes', m) % m
        choicelist.append((str(i), _('after ') + m))

    config.usage.standby_to_shutdown_timer = ConfigSelection(
        default='0', choices=choicelist)
    config.usage.standby_to_shutdown_timer_blocktime = ConfigYesNo(
        default=True)
    config.usage.standby_to_shutdown_timer_blocktime_begin = ConfigClock(
        default=time.mktime((0, 0, 0, 6, 0, 0, 0, 0, 0)))
    config.usage.standby_to_shutdown_timer_blocktime_end = ConfigClock(
        default=time.mktime((0, 0, 0, 23, 0, 0, 0, 0, 0)))
    choicelist = [('0', _('Disabled'))]
    for m in (1, 5, 10, 15, 30, 60):
        choicelist.append(
            (str(m * 60), ngettext('%d minute', '%d minutes', m) % m))

    config.usage.screen_saver = ConfigSelection(default='300',
                                                choices=choicelist)
    config.usage.check_timeshift = ConfigYesNo(default=True)
    choicelist = [('0', _('Disabled'))]
    for i in (2, 3, 4, 5, 10, 20, 30):
        choicelist.append((str(i), ngettext('%d second', '%d seconds', i) % i))

    for i in (60, 120, 300):
        m = i / 60
        choicelist.append((str(i), ngettext('%d minute', '%d minutes', m) % m))

    config.usage.timeshift_start_delay = ConfigSelection(default='0',
                                                         choices=choicelist)
    config.usage.alternatives_priority = ConfigSelection(
        default='0',
        choices=[('0', 'DVB-S/-C/-T'), ('1', 'DVB-S/-T/-C'),
                 ('2', 'DVB-C/-S/-T'), ('3', 'DVB-C/-T/-S'),
                 ('4', 'DVB-T/-C/-S'), ('5', 'DVB-T/-S/-C'),
                 ('127', _('No priority'))])
    config.usage.remote_fallback_enabled = ConfigYesNo(default=False)
    config.usage.remote_fallback = ConfigText(default='', fixed_size=False)
    config.usage.show_timer_conflict_warning = ConfigYesNo(default=True)
    dvbs_nims = [('-2', _('Disabled'))]
    dvbt_nims = [('-2', _('Disabled'))]
    dvbc_nims = [('-2', _('Disabled'))]
    atsc_nims = [('-2', _('Disabled'))]
    nims = [('-1', _('auto'))]
    for x in nimmanager.nim_slots:
        if x.isCompatible('DVB-S'):
            dvbs_nims.append((str(x.slot), x.getSlotName()))
        elif x.isCompatible('DVB-T'):
            dvbt_nims.append((str(x.slot), x.getSlotName()))
        elif x.isCompatible('DVB-C'):
            dvbc_nims.append((str(x.slot), x.getSlotName()))
        elif x.isCompatible('ATSC'):
            atsc_nims.append((str(x.slot), x.getSlotName()))
        nims.append((str(x.slot), x.getSlotName()))

    config.usage.frontend_priority = ConfigSelection(default='-1',
                                                     choices=list(nims))
    nims.insert(0, ('-2', _('Disabled')))
    config.usage.recording_frontend_priority = ConfigSelection(default='-2',
                                                               choices=nims)
    config.usage.frontend_priority_dvbs = ConfigSelection(
        default='-2', choices=list(dvbs_nims))
    dvbs_nims.insert(1, ('-1', _('auto')))
    config.usage.recording_frontend_priority_dvbs = ConfigSelection(
        default='-2', choices=dvbs_nims)
    config.usage.frontend_priority_dvbt = ConfigSelection(
        default='-2', choices=list(dvbt_nims))
    dvbt_nims.insert(1, ('-1', _('auto')))
    config.usage.recording_frontend_priority_dvbt = ConfigSelection(
        default='-2', choices=dvbt_nims)
    config.usage.frontend_priority_dvbc = ConfigSelection(
        default='-2', choices=list(dvbc_nims))
    dvbc_nims.insert(1, ('-1', _('auto')))
    config.usage.recording_frontend_priority_dvbc = ConfigSelection(
        default='-2', choices=dvbc_nims)
    config.usage.frontend_priority_atsc = ConfigSelection(
        default="-2", choices=list(atsc_nims))
    atsc_nims.insert(1, ('-1', _('auto')))
    config.usage.recording_frontend_priority_atsc = ConfigSelection(
        default='-2', choices=atsc_nims)

    SystemInfo['DVB-S_priority_tuner_available'] = len(dvbs_nims) > 3 and any(
        len(i) > 2 for i in (dvbt_nims, dvbc_nims, atsc_nims))
    SystemInfo['DVB-T_priority_tuner_available'] = len(dvbt_nims) > 3 and any(
        len(i) > 2 for i in (dvbs_nims, dvbc_nims, atsc_nims))
    SystemInfo['DVB-C_priority_tuner_available'] = len(dvbc_nims) > 3 and any(
        len(i) > 2 for i in (dvbs_nims, dvbt_nims, atsc_nims))
    SystemInfo['ATSC_priority_tuner_available'] = len(atsc_nims) > 3 and any(
        len(i) > 2 for i in (dvbs_nims, dvbc_nims, dvbt_nims))

    config.misc.disable_background_scan = ConfigYesNo(default=False)
    config.usage.show_event_progress_in_servicelist = ConfigSelection(
        default='barright',
        choices=[('barleft', _('Progress bar left')),
                 ('barright', _('Progress bar right')),
                 ('percleft', _('Percentage left')),
                 ('percright', _('Percentage right')), ('no', _('No'))])
    config.usage.show_channel_numbers_in_servicelist = ConfigYesNo(
        default=True)
    config.usage.show_event_progress_in_servicelist.addNotifier(
        refreshServiceList)
    config.usage.show_channel_numbers_in_servicelist.addNotifier(
        refreshServiceList)
    config.usage.blinking_display_clock_during_recording = ConfigYesNo(
        default=False)
    config.usage.show_message_when_recording_starts = ConfigYesNo(default=True)
    config.usage.load_length_of_movies_in_moviellist = ConfigYesNo(
        default=True)
    config.usage.show_icons_in_movielist = ConfigSelection(
        default='i',
        choices=[('o', _('Off')), ('p', _('Progress')),
                 ('s', _('Small progress')), ('i', _('Icons'))])

    config.usage.movielist_unseen = ConfigYesNo(default=False)

    config.usage.swap_snr_on_osd = ConfigYesNo(default=False)

    def SpinnerOnOffChanged(configElement):
        setSpinnerOnOff(int(configElement.value))

    config.usage.show_spinner.addNotifier(SpinnerOnOffChanged)

    def EnableTtCachingChanged(configElement):
        setEnableTtCachingOnOff(int(configElement.value))

    config.usage.enable_tt_caching.addNotifier(EnableTtCachingChanged)

    def TunerTypePriorityOrderChanged(configElement):
        setTunerTypePriorityOrder(int(configElement.value))

    config.usage.alternatives_priority.addNotifier(
        TunerTypePriorityOrderChanged, immediate_feedback=False)

    def PreferredTunerChanged(configElement):
        setPreferredTuner(int(configElement.value))

    config.usage.frontend_priority.addNotifier(PreferredTunerChanged)
    config.usage.hide_zap_errors = ConfigYesNo(default=False)
    config.usage.hide_ci_messages = ConfigYesNo(default=True)
    config.usage.show_cryptoinfo = ConfigYesNo(default=True)
    config.usage.show_eit_nownext = ConfigYesNo(default=True)
    config.usage.show_vcr_scart = ConfigYesNo(default=False)
    config.usage.show_update_disclaimer = ConfigYesNo(default=True)
    config.usage.pic_resolution = ConfigSelection(
        default=None,
        choices=[
            (None, _('Same resolution as skin')), ('(720, 576)', '720x576'),
            ('(1280, 720)', '1280x720'), ('(1920, 1080)', '1920x1080')
        ][:SystemInfo['HasFullHDSkinSupport'] and 4 or 3])
    if SystemInfo['Fan']:
        choicelist = [('off', _('Off')), ('on', _('On')), ('auto', _('Auto'))]
        if os.path.exists('/proc/stb/fp/fan_choices'):
            choicelist = [
                x for x in choicelist if x[0] in open(
                    '/proc/stb/fp/fan_choices', 'r').read().strip().split(' ')
            ]
        config.usage.fan = ConfigSelection(choicelist)

        def fanChanged(configElement):
            open(SystemInfo['Fan'], 'w').write(configElement.value)

        config.usage.fan.addNotifier(fanChanged)
    if SystemInfo['FanPWM']:

        def fanSpeedChanged(configElement):
            open(SystemInfo['FanPWM'], 'w').write(hex(configElement.value)[2:])

        config.usage.fanspeed = ConfigSlider(default=127,
                                             increment=8,
                                             limits=(0, 255))
        config.usage.fanspeed.addNotifier(fanSpeedChanged)
    if SystemInfo['StandbyLED']:

        def standbyLEDChanged(configElement):
            open(SystemInfo['StandbyLED'],
                 'w').write(configElement.value and 'on' or 'off')

        config.usage.standbyLED = ConfigYesNo(default=True)
        config.usage.standbyLED.addNotifier(standbyLEDChanged)

        if SystemInfo["PowerOffDisplay"]:

            def powerOffDisplayChanged(configElement):
                open(SystemInfo["PowerOffDisplay"],
                     "w").write(configElement.value and "1" or "0")

            config.usage.powerOffDisplay = ConfigYesNo(default=True)
            config.usage.powerOffDisplay.addNotifier(powerOffDisplayChanged)

    if SystemInfo['WakeOnLAN']:

        def wakeOnLANChanged(configElement):
            if 'fp' in SystemInfo['WakeOnLAN']:
                open(SystemInfo['WakeOnLAN'],
                     'w').write(configElement.value and 'enable' or 'disable')
            else:
                open(SystemInfo['WakeOnLAN'],
                     'w').write(configElement.value and 'on' or 'off')

        config.usage.wakeOnLAN = ConfigYesNo(default=False)
        config.usage.wakeOnLAN.addNotifier(wakeOnLANChanged)

    if SystemInfo["hasXcoreVFD"]:

        def set12to8characterVFD(configElement):
            open(SystemInfo["hasXcoreVFD"],
                 "w").write(not configElement.value and "1" or "0")

        config.usage.toggle12to8characterVFD = ConfigYesNo(default=False)
        config.usage.toggle12to8characterVFD.addNotifier(set12to8characterVFD)

    if SystemInfo["LcdLiveTVMode"]:

        def setLcdLiveTVMode(configElement):
            open(SystemInfo["LcdLiveTVMode"], "w").write(configElement.value)

        config.usage.LcdLiveTVMode = ConfigSelection(
            default="0", choices=[str(x) for x in range(0, 9)])
        config.usage.LcdLiveTVMode.addNotifier(setLcdLiveTVMode)

    config.epg = ConfigSubsection()
    config.epg.eit = ConfigYesNo(default=True)
    config.epg.mhw = ConfigYesNo(default=False)
    config.epg.freesat = ConfigYesNo(default=True)
    config.epg.viasat = ConfigYesNo(default=True)
    config.epg.netmed = ConfigYesNo(default=True)
    config.epg.virgin = ConfigYesNo(default=False)
    config.misc.showradiopic = ConfigYesNo(default=True)

    def EpgSettingsChanged(configElement):
        from enigma import eEPGCache
        mask = 4294967295L
        if not config.epg.eit.value:
            mask &= ~(eEPGCache.NOWNEXT | eEPGCache.SCHEDULE
                      | eEPGCache.SCHEDULE_OTHER)
        if not config.epg.mhw.value:
            mask &= ~eEPGCache.MHW
        if not config.epg.freesat.value:
            mask &= ~(eEPGCache.FREESAT_NOWNEXT | eEPGCache.FREESAT_SCHEDULE
                      | eEPGCache.FREESAT_SCHEDULE_OTHER)
        if not config.epg.viasat.value:
            mask &= ~eEPGCache.VIASAT
        if not config.epg.netmed.value:
            mask &= ~(eEPGCache.NETMED_SCHEDULE
                      | eEPGCache.NETMED_SCHEDULE_OTHER)
        if not config.epg.virgin.value:
            mask &= ~(eEPGCache.VIRGIN_NOWNEXT | eEPGCache.VIRGIN_SCHEDULE)
        eEPGCache.getInstance().setEpgSources(mask)

    config.epg.eit.addNotifier(EpgSettingsChanged)
    config.epg.mhw.addNotifier(EpgSettingsChanged)
    config.epg.freesat.addNotifier(EpgSettingsChanged)
    config.epg.viasat.addNotifier(EpgSettingsChanged)
    config.epg.netmed.addNotifier(EpgSettingsChanged)
    config.epg.virgin.addNotifier(EpgSettingsChanged)
    config.epg.histminutes = ConfigSelectionNumber(min=0,
                                                   max=120,
                                                   stepwidth=15,
                                                   default=0,
                                                   wraparound=True)

    def EpgHistorySecondsChanged(configElement):
        from enigma import eEPGCache
        eEPGCache.getInstance().setEpgHistorySeconds(
            config.epg.histminutes.getValue() * 60)

    config.epg.histminutes.addNotifier(EpgHistorySecondsChanged)

    def setHDDStandby(configElement):
        for hdd in harddiskmanager.HDDList():
            hdd[1].setIdleTime(int(configElement.value))

    config.usage.hdd_standby.addNotifier(setHDDStandby,
                                         immediate_feedback=False)
    if SystemInfo['12V_Output']:

        def set12VOutput(configElement):
            Misc_Options.getInstance().set_12V_output(
                configElement.value == 'on' and 1 or 0)

        config.usage.output_12V.addNotifier(set12VOutput,
                                            immediate_feedback=False)
    config.usage.keymap = ConfigText(
        default=eEnv.resolve('${datadir}/enigma2/keymap.xml'))
    config.usage.keytrans = ConfigText(
        default=eEnv.resolve('${datadir}/enigma2/keytranslation.xml'))
    config.seek = ConfigSubsection()
    config.seek.selfdefined_13 = ConfigNumber(default=15)
    config.seek.selfdefined_46 = ConfigNumber(default=60)
    config.seek.selfdefined_79 = ConfigNumber(default=300)
    config.seek.speeds_forward = ConfigSet(
        default=[2, 4, 8, 16, 32, 64, 128],
        choices=[2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
    config.seek.speeds_backward = ConfigSet(
        default=[2, 4, 8, 16, 32, 64, 128],
        choices=[1, 2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
    config.seek.speeds_slowmotion = ConfigSet(default=[2, 4, 8],
                                              choices=[2, 4, 6, 8, 12, 16, 25])
    config.seek.enter_forward = ConfigSelection(default='2',
                                                choices=[
                                                    '2', '4', '6', '8', '12',
                                                    '16', '24', '32', '48',
                                                    '64', '96', '128'
                                                ])
    config.seek.enter_backward = ConfigSelection(default='1',
                                                 choices=[
                                                     '1', '2', '4', '6', '8',
                                                     '12', '16', '24', '32',
                                                     '48', '64', '96', '128'
                                                 ])
    config.seek.on_pause = ConfigSelection(default='play',
                                           choices=[('play', _('Play')),
                                                    ('step',
                                                     _('Single step (GOP)')),
                                                    ('last', _('Last speed'))])
    config.usage.timerlist_finished_timer_position = ConfigSelection(
        default='end',
        choices=[('beginning', _('At beginning')), ('end', _('At end'))])

    def updateEnterForward(configElement):
        if not configElement.value:
            configElement.value = [2]
        updateChoices(config.seek.enter_forward, configElement.value)

    config.seek.speeds_forward.addNotifier(updateEnterForward,
                                           immediate_feedback=False)

    def updateEnterBackward(configElement):
        if not configElement.value:
            configElement.value = [2]
        updateChoices(config.seek.enter_backward, configElement.value)

    config.seek.speeds_backward.addNotifier(updateEnterBackward,
                                            immediate_feedback=False)

    def updateEraseSpeed(el):
        eBackgroundFileEraser.getInstance().setEraseSpeed(int(el.value))

    def updateEraseFlags(el):
        eBackgroundFileEraser.getInstance().setEraseFlags(int(el.value))

    config.misc.erase_speed = ConfigSelection(default="20",
                                              choices=[("10", _("10 MB/s")),
                                                       ("20", _("20 MB/s")),
                                                       ("50", _("50 MB/s")),
                                                       ("100", _("100 MB/s"))])
    config.misc.erase_speed.addNotifier(updateEraseSpeed,
                                        immediate_feedback=False)
    config.misc.erase_flags = ConfigSelection(default='1',
                                              choices=[
                                                  ('0', _('Disable')),
                                                  ('1',
                                                   _('Internal hdd only')),
                                                  ('3', _('Everywhere'))
                                              ])
    config.misc.erase_flags.addNotifier(updateEraseFlags,
                                        immediate_feedback=False)

    if SystemInfo['ZapMode']:

        def setZapmode(el):
            open(SystemInfo['ZapMode'], 'w').write(el.value)

        config.misc.zapmode = ConfigSelection(
            default='mute',
            choices=[('mute', _('Black screen')), ('hold', _('Hold screen')),
                     ('mutetilllock', _('Black screen till locked')),
                     ('holdtilllock', _('Hold till locked'))])
        config.misc.zapmode.addNotifier(setZapmode, immediate_feedback=False)
    config.usage.historymode = ConfigSelection(default='1',
                                               choices=[('0', _('Just zap')),
                                                        ('1', _('Show menu'))])

    if SystemInfo['VFD_scroll_repeats']:

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

        choicelist = []
        for i in range(1, 11, 1):
            choicelist.append(str(i))
        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']:

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

        choicelist = []
        for i in range(0, 1001, 50):
            choicelist.append(str(i))
        config.usage.vfd_scroll_delay = ConfigSelection(default='150',
                                                        choices=choicelist)
        config.usage.vfd_scroll_delay.addNotifier(scroll_delay,
                                                  immediate_feedback=False)

    if SystemInfo['VFD_initial_scroll_delay']:

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

        choicelist = []
        for i in range(0, 20001, 500):
            choicelist.append(str(i))
        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']:

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

        choicelist = []
        for i in range(0, 20001, 500):
            choicelist.append(str(i))
        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 SystemInfo['HasForceLNBOn']:

        def forceLNBPowerChanged(configElement):
            open(SystemInfo['HasForceLNBOn'], 'w').write(configElement.value)

        config.misc.forceLnbPower = ConfigSelection(default='on',
                                                    choices=[('on', _('Yes')),
                                                             ('off', _('No'))])
        config.misc.forceLnbPower.addNotifier(forceLNBPowerChanged)

    if SystemInfo['HasForceToneburst']:

        def forceToneBurstChanged(configElement):
            open(SystemInfo['HasForceToneburst'],
                 'w').write(configElement.value)

        config.misc.forceToneBurst = ConfigSelection(default='enable',
                                                     choices=[
                                                         ('enable', _('Yes')),
                                                         ('disable', _('No'))
                                                     ])
        config.misc.forceToneBurst.addNotifier(forceToneBurstChanged)

    if SystemInfo['HasBypassEdidChecking']:

        def setHasBypassEdidChecking(configElement):
            open(SystemInfo['HasBypassEdidChecking'],
                 'w').write(configElement.value)

        config.av.bypassEdidChecking = ConfigSelection(default='00000000',
                                                       choices=[('00000001',
                                                                 _('Yes')),
                                                                ('00000000',
                                                                 _('No'))])
        config.av.bypassEdidChecking.addNotifier(setHasBypassEdidChecking)

    if SystemInfo['HasColorspace']:

        def setHaveColorspace(configElement):
            open(SystemInfo['HasColorspace'], 'w').write(configElement.value)

        if SystemInfo['HasColorspaceSimple']:
            config.av.hdmicolorspace = ConfigSelection(default='Edid(Auto)',
                                                       choices={
                                                           'Edid(Auto)':
                                                           _('Auto'),
                                                           'Hdmi_Rgb': _('RGB')
                                                       })
        else:
            config.av.hdmicolorspace = ConfigSelection(default='auto',
                                                       choices={
                                                           'auto': _('auto'),
                                                           'rgb': _('rgb'),
                                                           '420': _('420'),
                                                           '422': _('422'),
                                                           '444': _('444')
                                                       })
        config.av.hdmicolorspace.addNotifier(setHaveColorspace)
    config.subtitles = ConfigSubsection()
    config.subtitles.ttx_subtitle_colors = ConfigSelection(
        default='1',
        choices=[('0', _('original')), ('1', _('white')), ('2', _('yellow'))])
    config.subtitles.ttx_subtitle_original_position = ConfigYesNo(
        default=False)
    config.subtitles.subtitle_position = ConfigSelection(choices=[
        '0', '10', '20', '30', '40', '50', '60', '70', '80', '90', '100',
        '150', '200', '250', '300', '350', '400', '450'
    ],
                                                         default='50')
    config.subtitles.subtitle_alignment = ConfigSelection(choices=[
        ('left', _('left')), ('center', _('center')), ('right', _('right'))
    ],
                                                          default='center')
    config.subtitles.subtitle_rewrap = ConfigYesNo(default=False)
    config.subtitles.colourise_dialogs = ConfigYesNo(default=False)
    config.subtitles.subtitle_borderwidth = ConfigSelection(
        choices=['1', '2', '3', '4', '5'], default='3')
    config.subtitles.subtitle_fontsize = ConfigSelection(
        choices=['%d' % x for x in range(16, 101) if not x % 2], default='40')
    config.subtitles.showbackground = ConfigYesNo(default=False)
    subtitle_delay_choicelist = []
    for i in range(-900000, 1845000, 45000):
        if i == 0:
            subtitle_delay_choicelist.append(('0', _('No delay')))
        else:
            subtitle_delay_choicelist.append(
                (str(i), _("%2.1f sec") % (i / 90000.)))

    config.subtitles.subtitle_noPTSrecordingdelay = ConfigSelection(
        default='315000', choices=subtitle_delay_choicelist)
    config.subtitles.dvb_subtitles_yellow = ConfigYesNo(default=False)
    config.subtitles.dvb_subtitles_original_position = ConfigSelection(
        default='0',
        choices=[('0', _('Original')), ('1', _('Fixed')),
                 ('2', _('Relative'))])
    config.subtitles.dvb_subtitles_centered = ConfigYesNo(default=False)
    config.subtitles.subtitle_bad_timing_delay = ConfigSelection(
        default='0', choices=subtitle_delay_choicelist)
    config.subtitles.dvb_subtitles_backtrans = ConfigSelection(
        default='0',
        choices=[('0', _('No transparency')), ('25', '10%'), ('50', '20%'),
                 ('75', '30%'), ('100', '40%'), ('125', '50%'), ('150', '60%'),
                 ('175', '70%'), ('200', '80%'), ('225', '90%'),
                 ('255', _('Full transparency'))])
    config.subtitles.pango_subtitle_colors = ConfigSelection(
        default='1',
        choices=[('0', _('alternative')), ('1', _('white')),
                 ('2', _('yellow'))])
    config.subtitles.pango_subtitle_fontswitch = ConfigYesNo(default=True)
    config.subtitles.pango_subtitles_delay = ConfigSelection(
        default='0', choices=subtitle_delay_choicelist)
    config.subtitles.pango_subtitles_fps = ConfigSelection(
        default='1',
        choices=[('1', _('Original')), ('23976', _('23.976')),
                 ('24000', _('24')), ('25000', _('25')), ('29970', _('29.97')),
                 ('30000', _('30'))])
    config.subtitles.pango_autoturnon = ConfigYesNo(default=True)
    config.autolanguage = ConfigSubsection()
    audio_language_choices = [
        ('---', _('None')),
        ('orj dos ory org esl qaa und mis mul ORY ORJ Audio_ORJ',
         _('Original')), ('ara', _('Arabic')), ('eus baq', _('Basque')),
        ('bul', _('Bulgarian')),
        ('hrv', _('Croatian')), ('ces cze', _('Czech')), ('dan', _('Danish')),
        ('dut ndl', _('Dutch')), ('eng qaa', _('English')),
        ('est', _('Estonian')), ('fin', _('Finnish')),
        ('fra fre', _('French')), ('deu ger', _('German')),
        ('ell gre', _('Greek')), ('heb', _('Hebrew')), ('hun', _('Hungarian')),
        ('ita', _('Italian')), ('lav', _('Latvian')), ('lit', _('Lithuanian')),
        ('ltz', _('Luxembourgish')), ('nor', _('Norwegian')),
        ('pol', _('Polish')), ('por dub DUB', _('Portuguese')),
        ('fas per', _('Persian')), ('ron rum', _('Romanian')),
        ('rus', _('Russian')), ('srp', _('Serbian')), ('slk slo', _('Slovak')),
        ('slv', _('Slovenian')), ('spa', _('Spanish')), ('swe', _('Swedish')),
        ('tha', _('Thai')), ('tur Audio_TUR', _('Turkish')),
        ('ukr Ukr', _('Ukrainian'))
    ]

    def setEpgLanguage(configElement):
        eServiceEvent.setEPGLanguage(configElement.value)

    config.autolanguage.audio_epglanguage = ConfigSelection(
        audio_language_choices[:1] + audio_language_choices[2:], default='---')
    config.autolanguage.audio_epglanguage.addNotifier(setEpgLanguage)

    def setEpgLanguageAlternative(configElement):
        eServiceEvent.setEPGLanguageAlternative(configElement.value)

    config.autolanguage.audio_epglanguage_alternative = ConfigSelection(
        audio_language_choices[:1] + audio_language_choices[2:], default='---')
    config.autolanguage.audio_epglanguage_alternative.addNotifier(
        setEpgLanguageAlternative)
    config.autolanguage.audio_autoselect1 = ConfigSelection(
        choices=audio_language_choices, default='---')
    config.autolanguage.audio_autoselect2 = ConfigSelection(
        choices=audio_language_choices, default='---')
    config.autolanguage.audio_autoselect3 = ConfigSelection(
        choices=audio_language_choices, default='---')
    config.autolanguage.audio_autoselect4 = ConfigSelection(
        choices=audio_language_choices, default='---')
    config.autolanguage.audio_defaultac3 = ConfigYesNo(default=False)
    config.autolanguage.audio_defaultddp = ConfigYesNo(default=False)
    config.autolanguage.audio_usecache = ConfigYesNo(default=True)
    subtitle_language_choices = audio_language_choices[:
                                                       1] + audio_language_choices[
                                                           2:]
    config.autolanguage.subtitle_autoselect1 = ConfigSelection(
        choices=subtitle_language_choices, default='---')
    config.autolanguage.subtitle_autoselect2 = ConfigSelection(
        choices=subtitle_language_choices, default='---')
    config.autolanguage.subtitle_autoselect3 = ConfigSelection(
        choices=subtitle_language_choices, default='---')
    config.autolanguage.subtitle_autoselect4 = ConfigSelection(
        choices=subtitle_language_choices, default='---')
    config.autolanguage.subtitle_hearingimpaired = ConfigYesNo(default=False)
    config.autolanguage.subtitle_defaultimpaired = ConfigYesNo(default=False)
    config.autolanguage.subtitle_defaultdvb = ConfigYesNo(default=False)
    config.autolanguage.subtitle_usecache = ConfigYesNo(default=True)
    config.autolanguage.equal_languages = ConfigSelection(default='15',
                                                          choices=[
                                                              ('0', _('None')),
                                                              ('1', '1'),
                                                              ('2', '2'),
                                                              ('3', '1,2'),
                                                              ('4', '3'),
                                                              ('5', '1,3'),
                                                              ('6', '2,3'),
                                                              ('7', '1,2,3'),
                                                              ('8', '4'),
                                                              ('9', '1,4'),
                                                              ('10', '2,4'),
                                                              ('11', '1,2,4'),
                                                              ('12', '3,4'),
                                                              ('13', '1,3,4'),
                                                              ('14', '2,3,4'),
                                                              ('15', _('All'))
                                                          ])
    config.streaming = ConfigSubsection()
    config.streaming.stream_ecm = ConfigYesNo(default=False)
    config.streaming.descramble = ConfigYesNo(default=True)
    config.streaming.descramble_client = ConfigYesNo(default=False)
    config.streaming.stream_eit = ConfigYesNo(default=True)
    config.streaming.stream_ait = ConfigYesNo(default=True)
    config.streaming.authentication = ConfigYesNo(default=False)
    config.mediaplayer = ConfigSubsection()
    config.mediaplayer.useAlternateUserAgent = ConfigYesNo(default=False)
    config.mediaplayer.alternateUserAgent = ConfigText(default='')
示例#16
0
def InitUsageConfig():
	config.usage = ConfigSubsection()
	config.usage.subnetwork = ConfigYesNo(default=True)
	config.usage.subnetwork_cable = ConfigYesNo(default=True)
	config.usage.subnetwork_terrestrial = ConfigYesNo(default=True)
	config.usage.showdish = ConfigYesNo(default=True)
	config.usage.multibouquet = ConfigYesNo(default=True)

	showrotorpositionChoicesUpdate()

	config.usage.alternative_number_mode = ConfigYesNo(default=False)

	def alternativeNumberModeChange(configElement):
		eDVBDB.getInstance().setNumberingMode(configElement.value)
		refreshServiceList()
	config.usage.alternative_number_mode.addNotifier(alternativeNumberModeChange)

	config.usage.servicelist_twolines = ConfigSelection(default="0", choices=[("0", _("Single line mode")), ("1", _("Two lines")), ("2", _("Two lines and next event"))])
	config.usage.servicelist_twolines.addNotifier(refreshServiceList)

	config.usage.hide_number_markers = ConfigYesNo(default=True)
	config.usage.hide_number_markers.addNotifier(refreshServiceList)

	config.usage.servicetype_icon_mode = ConfigSelection(default="0", choices=[("0", _("None")), ("1", _("Left from servicename")), ("2", _("Right from servicename"))])
	config.usage.servicetype_icon_mode.addNotifier(refreshServiceList)
	config.usage.crypto_icon_mode = ConfigSelection(default="0", choices=[("0", _("None")), ("1", _("Left from servicename")), ("2", _("Right from servicename"))])
	config.usage.crypto_icon_mode.addNotifier(refreshServiceList)
	config.usage.record_indicator_mode = ConfigSelection(default="0", choices=[("0", _("None")), ("1", _("Left from servicename")), ("2", _("Right from servicename")), ("3", _("Red colored"))])
	config.usage.record_indicator_mode.addNotifier(refreshServiceList)

	choicelist = [("-1", _("Disable"))]
	for i in range(0, 1300, 100):
		choicelist.append((str(i), ngettext("%d pixel wide", "%d pixels wide", i) % i))
	config.usage.servicelist_column = ConfigSelection(default="-1", choices=choicelist)
	config.usage.servicelist_column.addNotifier(refreshServiceList)

	config.usage.service_icon_enable = ConfigYesNo(default=False)
	config.usage.service_icon_enable.addNotifier(refreshServiceList)
	config.usage.servicelist_cursor_behavior = ConfigSelection(default="keep", choices=[
		("standard", _("Standard")),
		("keep", _("Keep service")),
		("reverseB", _("Reverse bouquet buttons")),
		("keep reverseB", _("Keep service") + " + " + _("Reverse bouquet buttons"))])

	choicelist = [("by skin", _("As defined by the skin"))]
	for i in range(5, 41):
		choicelist.append((str(i)))
	config.usage.servicelist_number_of_services = ConfigSelection(default="by skin", choices=choicelist)
	config.usage.servicelist_number_of_services.addNotifier(refreshServiceList)

	config.usage.multiepg_ask_bouquet = ConfigYesNo(default=False)

	config.usage.quickzap_bouquet_change = ConfigYesNo(default=False)
	config.usage.e1like_radio_mode = ConfigYesNo(default=True)
	config.usage.e1like_radio_mode_last_play = ConfigYesNo(default=True)
	choicelist = [("0", _("No timeout"))]
	for i in range(1, 12):
		choicelist.append((str(i), ngettext("%d second", "%d seconds", i) % i))
	config.usage.infobar_timeout = ConfigSelection(default="5", choices=choicelist)
	config.usage.show_infobar_on_zap = ConfigYesNo(default=True)
	config.usage.show_infobar_on_skip = ConfigYesNo(default=True)
	config.usage.show_infobar_on_event_change = ConfigYesNo(default=False)
	config.usage.show_second_infobar = ConfigSelection(default="0", choices=[("", _("None"))] + choicelist + [("EPG", _("EPG"))])
	config.usage.show_simple_second_infobar = ConfigYesNo(default=False)
	config.usage.infobar_frontend_source = ConfigSelection(default="settings", choices=[("settings", _("Settings")), ("tuner", _("Tuner"))])
	config.usage.oldstyle_zap_controls = ConfigYesNo(default=False)
	config.usage.oldstyle_channel_select_controls = ConfigYesNo(default=False)
	config.usage.zap_with_ch_buttons = ConfigYesNo(default=False)
	config.usage.ok_is_channelselection = ConfigYesNo(default=False)
	config.usage.changebouquet_set_history = ConfigYesNo(default=False)
	config.usage.volume_instead_of_channelselection = ConfigYesNo(default=False)
	config.usage.channelselection_preview = ConfigYesNo(default=False)
	config.usage.show_spinner = ConfigYesNo(default=True)
	config.usage.menu_sort_weight = ConfigDictionarySet(default={"mainmenu": {"submenu": {}}})
	config.usage.menu_sort_mode = ConfigSelection(default="default", choices=[("a_z", _("alphabetical")), ("default", _("Default")), ("user", _("user defined")), ("user_hidden", _("user defined hidden"))])
	config.usage.menu_show_numbers = ConfigSelection(default="no", choices=[("no", _("no")), ("menu&plugins", _("in menu and plugins")), ("menu", _("in menu only")), ("plugins", _("in plugins only"))])
	config.usage.showScreenPath = ConfigSelection(default="small", choices=[("off", _("Disabled")), ("small", _("Small")), ("large", _("Large"))])
	config.usage.enable_tt_caching = ConfigYesNo(default=True)
	config.usage.sort_settings = ConfigYesNo(default=False)
	choicelist = []
	for i in (10, 30):
		choicelist.append((str(i), ngettext("%d second", "%d seconds", i) % i))
	for i in (60, 120, 300, 600, 1200, 1800):
		m = i / 60
		choicelist.append((str(i), ngettext("%d minute", "%d minutes", m) % m))
	for i in (3600, 7200, 14400):
		h = i / 3600
		choicelist.append((str(i), ngettext("%d hour", "%d hours", h) % h))
	config.usage.hdd_standby = ConfigSelection(default="300", choices=[("0", _("No standby"))] + choicelist)
	config.usage.output_12V = ConfigSelection(default="do not change", choices=[
		("do not change", _("Do not change")), ("off", _("Off")), ("on", _("On"))])

	config.usage.pip_zero_button = ConfigSelection(default="standard", choices=[
		("standard", _("Standard")), ("swap", _("Swap PiP and main picture")),
		("swapstop", _("Move PiP to main picture")), ("stop", _("Stop PiP"))])
	config.usage.pip_hideOnExit = ConfigSelection(default="without popup", choices=[
		("no", _("no")), ("popup", _("With popup")), ("without popup", _("Without popup"))])
	choicelist = [("-1", _("Disabled")), ("0", _("No timeout"))]
	for i in [60, 300, 600, 900, 1800, 2700, 3600]:
		m = i / 60
		choicelist.append((str(i), ngettext("%d minute", "%d minutes", m) % m))
	config.usage.pip_last_service_timeout = ConfigSelection(default="0", choices=choicelist)

	config.usage.default_path = ConfigText(default="")
	config.usage.timer_path = ConfigText(default="<default>")
	config.usage.instantrec_path = ConfigText(default="<default>")
	config.usage.timeshift_path = ConfigText(default="/media/hdd/")
	config.usage.allowed_timeshift_paths = ConfigLocations(default=["/media/hdd/"])

	config.usage.movielist_trashcan = ConfigYesNo(default=True)
	config.usage.movielist_trashcan_days = ConfigNumber(default=8)
	config.usage.movielist_trashcan_reserve = ConfigNumber(default=40)
	config.usage.on_movie_start = ConfigSelection(default="resume", choices=[
		("ask yes", _("Ask user") + " " + _("default") + " " + _("yes")),
		("ask no", _("Ask user") + " " + _("default") + " " + _("no")),
		("resume", _("Resume from last position")),
		("beginning", _("Start from the beginning"))])
	config.usage.on_movie_stop = ConfigSelection(default="movielist", choices=[
		("ask", _("Ask user")), ("movielist", _("Return to movie list")), ("quit", _("Return to previous service"))])
	config.usage.on_movie_eof = ConfigSelection(default="movielist", choices=[
		("ask", _("Ask user")), ("movielist", _("Return to movie list")), ("quit", _("Return to previous service")), ("pause", _("Pause movie at end")), ("playlist", _("Play next (return to movie list)")),
		("playlistquit", _("Play next (return to previous service)")), ("loop", _("Continues play (loop)")), ("repeatcurrent", _("Repeat"))])
	config.usage.next_movie_msg = ConfigYesNo(default=True)
	config.usage.last_movie_played = ConfigText()
	config.usage.leave_movieplayer_onExit = ConfigSelection(default="popup", choices=[
		("no", _("no")), ("popup", _("With popup")), ("without popup", _("Without popup")), ("movielist", _("Return to movie list"))])

	config.usage.setup_level = ConfigSelection(default="simple", choices=[
		("simple", _("Normal")),
		("intermediate", _("Advanced")),
		("expert", _("Expert"))])

	config.usage.startup_to_standby = ConfigSelection(default="no", choices=[
		("no", _("no")),
		("yes", _("yes")),
		("except", _("No, except Wakeup timer"))])

	config.usage.wakeup_enabled = ConfigSelection(default="no", choices=[
		("no", _("no")),
		("yes", _("yes")),
		("standby", _("Yes, only from standby")),
		("deepstandby", _("Yes, only from deep standby"))])
	config.usage.wakeup_day = ConfigSubDict()
	config.usage.wakeup_time = ConfigSubDict()
	for i in range(7):
		config.usage.wakeup_day[i] = ConfigEnableDisable(default=False)
		config.usage.wakeup_time[i] = ConfigClock(default=((6 * 60 + 0) * 60))

	config.usage.poweroff_enabled = ConfigYesNo(default=False)
	config.usage.poweroff_force = ConfigYesNo(default=False)
	config.usage.poweroff_nextday = ConfigClock(default = ((6 * 60 + 0) * 60))
	config.usage.poweroff_day = ConfigSubDict()
	config.usage.poweroff_time = ConfigSubDict()
	for i in range(7):
		config.usage.poweroff_day[i] = ConfigEnableDisable(default=False)
		config.usage.poweroff_time[i] = ConfigClock(default = ((1 * 60 + 0) * 60))

	choicelist = [("0", _("Do nothing"))]
	for i in range(3600, 21601, 3600):
		h = abs(i / 3600)
		h = ngettext("%d hour", "%d hours", h) % h
		choicelist.append((str(i), _("Standby in ") + h))
	config.usage.inactivity_timer = ConfigSelection(default="0", choices=choicelist)
	config.usage.inactivity_timer_blocktime = ConfigYesNo(default=True)
	config.usage.inactivity_timer_blocktime_begin = ConfigClock(default=time.mktime((0, 0, 0, 18, 0, 0, 0, 0, 0)))
	config.usage.inactivity_timer_blocktime_end = ConfigClock(default=time.mktime((0, 0, 0, 23, 0, 0, 0, 0, 0)))
	config.usage.inactivity_timer_blocktime_extra = ConfigYesNo(default=False)
	config.usage.inactivity_timer_blocktime_extra_begin = ConfigClock(default=time.mktime((0, 0, 0, 6, 0, 0, 0, 0, 0)))
	config.usage.inactivity_timer_blocktime_extra_end = ConfigClock(default=time.mktime((0, 0, 0, 9, 0, 0, 0, 0, 0)))
	config.usage.inactivity_timer_blocktime_by_weekdays = ConfigYesNo(default=False)
	config.usage.inactivity_timer_blocktime_day = ConfigSubDict()
	config.usage.inactivity_timer_blocktime_begin_day = ConfigSubDict()
	config.usage.inactivity_timer_blocktime_end_day = ConfigSubDict()
	config.usage.inactivity_timer_blocktime_extra_day = ConfigSubDict()
	config.usage.inactivity_timer_blocktime_extra_begin_day = ConfigSubDict()
	config.usage.inactivity_timer_blocktime_extra_end_day = ConfigSubDict()
	for i in range(7):
		config.usage.inactivity_timer_blocktime_day[i] = ConfigYesNo(default=False)
		config.usage.inactivity_timer_blocktime_begin_day[i] = ConfigClock(default=time.mktime((0, 0, 0, 18, 0, 0, 0, 0, 0)))
		config.usage.inactivity_timer_blocktime_end_day[i] = ConfigClock(default=time.mktime((0, 0, 0, 23, 0, 0, 0, 0, 0)))
		config.usage.inactivity_timer_blocktime_extra_day[i] = ConfigYesNo(default=False)
		config.usage.inactivity_timer_blocktime_extra_begin_day[i] = ConfigClock(default=time.mktime((0, 0, 0, 6, 0, 0, 0, 0, 0)))
		config.usage.inactivity_timer_blocktime_extra_end_day[i] = ConfigClock(default=time.mktime((0, 0, 0, 9, 0, 0, 0, 0, 0)))

	choicelist = [("0", _("Disabled")), ("event_standby", _("Standby after current event"))]
	for i in range(900, 7201, 900):
		m = abs(i / 60)
		m = ngettext("%d minute", "%d minutes", m) % m
		choicelist.append((str(i), _("Standby in ") + m))
	config.usage.sleep_timer = ConfigSelection(default="0", choices=choicelist)

	choicelist = [("0", _("Disabled"))]
	for i in [300, 600] + range(900, 14401, 900):
		m = abs(i / 60)
		m = ngettext("%d minute", "%d minutes", m) % m
		choicelist.append((str(i), _("after ") + m))
	config.usage.standby_to_shutdown_timer = ConfigSelection(default="0", choices=choicelist)
	config.usage.standby_to_shutdown_timer_blocktime = ConfigYesNo(default=False)
	config.usage.standby_to_shutdown_timer_blocktime_begin = ConfigClock(default=time.mktime((0, 0, 0, 6, 0, 0, 0, 0, 0)))
	config.usage.standby_to_shutdown_timer_blocktime_end = ConfigClock(default=time.mktime((0, 0, 0, 23, 0, 0, 0, 0, 0)))

	choicelist = [("0", _("Disabled"))]
	for m in (1, 5, 10, 15, 30, 60):
		choicelist.append((str(m * 60), ngettext("%d minute", "%d minutes", m) % m))
	config.usage.screen_saver = ConfigSelection(default="300", choices=choicelist)

	config.usage.check_timeshift = ConfigYesNo(default=True)

	choicelist = [("0", _("Disabled"))]
	for i in (2, 3, 4, 5, 10, 20, 30):
		choicelist.append((str(i), ngettext("%d second", "%d seconds", i) % i))
	for i in (60, 120, 300):
		m = i / 60
		choicelist.append((str(i), ngettext("%d minute", "%d minutes", m) % m))
	config.usage.timeshift_start_delay = ConfigSelection(default="0", choices=choicelist)

	config.usage.alternatives_priority = ConfigSelection(default="0", choices=[
		("0", "DVB-S/-C/-T"),
		("1", "DVB-S/-T/-C"),
		("2", "DVB-C/-S/-T"),
		("3", "DVB-C/-T/-S"),
		("4", "DVB-T/-C/-S"),
		("5", "DVB-T/-S/-C"),
		("127", _("No priority"))])

	def remote_fallback_changed(configElement):
		if configElement.value:
			configElement.value = "%s%s" % (not configElement.value.startswith("http://") and "http://" or "", configElement.value)
			configElement.value = "%s%s" % (configElement.value, configElement.value.count(":") == 1 and ":8001" or "")
	config.usage.remote_fallback_enabled = ConfigYesNo(default=False)
	config.usage.remote_fallback = ConfigText(default="", fixed_size=False)
	config.usage.remote_fallback.addNotifier(remote_fallback_changed, immediate_feedback=False)
	config.usage.remote_fallback_import_url = ConfigText(default="", fixed_size=False)
	config.usage.remote_fallback_import_url.addNotifier(remote_fallback_changed, immediate_feedback=False)
	config.usage.remote_fallback_alternative = ConfigYesNo(default=False)
	config.usage.remote_fallback_dvb_t = ConfigText(default="", fixed_size=False)
	config.usage.remote_fallback_dvb_t.addNotifier(remote_fallback_changed, immediate_feedback=False)
	config.usage.remote_fallback_dvb_c = ConfigText(default="", fixed_size=False)
	config.usage.remote_fallback_dvb_c.addNotifier(remote_fallback_changed, immediate_feedback=False)
	config.usage.remote_fallback_atsc = ConfigText(default="", fixed_size=False)
	config.usage.remote_fallback_atsc.addNotifier(remote_fallback_changed, immediate_feedback=False)
	config.usage.remote_fallback_import = ConfigSelection(default="", choices=[("", _("No")), ("channels", _("Channels only")), ("channels_epg", _("Channels and EPG")), ("epg", _("EPG only"))])
	config.usage.remote_fallback_import_restart = ConfigYesNo(default=False)
	config.usage.remote_fallback_import_standby = ConfigYesNo(default=False)
	config.usage.remote_fallback_ok = ConfigYesNo(default=False)
	config.usage.remote_fallback_nok = ConfigYesNo(default=False)
	config.usage.remote_fallback_extension_menu = ConfigYesNo(default=False)
	config.usage.remote_fallback_external_timer = ConfigYesNo(default=False)
	config.usage.remote_fallback_openwebif_customize = ConfigYesNo(default=False)
	config.usage.remote_fallback_openwebif_userid = ConfigText(default="root")
	config.usage.remote_fallback_openwebif_password = ConfigPassword(default="default")
	config.usage.remote_fallback_openwebif_port = ConfigInteger(default=80, limits=(0, 65535))
	config.usage.remote_fallback_dvbt_region = ConfigText(default="fallback DVB-T/T2 Europe")

	choicelist = [("0", _("Disabled"))]
	for i in (10, 50, 100, 500, 1000, 2000):
		choicelist.append(("%d" % i, _("%d ms") % i))

	config.usage.http_startdelay = ConfigSelection(default="0", choices=choicelist)

	config.usage.show_timer_conflict_warning = ConfigYesNo(default=True)

	preferredTunerChoicesUpdate()

	config.misc.disable_background_scan = ConfigYesNo(default=False)
	config.misc.use_ci_assignment = ConfigYesNo(default=False)
	config.usage.show_event_progress_in_servicelist = ConfigSelection(default='barright', choices=[
		('barleft', _("Progress bar left")),
		('barright', _("Progress bar right")),
		('percleft', _("Percentage left")),
		('percright', _("Percentage right")),
		('no', _("no"))])
	config.usage.show_channel_numbers_in_servicelist = ConfigYesNo(default=True)
	config.usage.show_event_progress_in_servicelist.addNotifier(refreshServiceList)
	config.usage.show_channel_numbers_in_servicelist.addNotifier(refreshServiceList)

	config.usage.blinking_display_clock_during_recording = ConfigYesNo(default=False)

	config.usage.show_message_when_recording_starts = ConfigYesNo(default=True)

	config.usage.load_length_of_movies_in_moviellist = ConfigYesNo(default=True)
	config.usage.show_icons_in_movielist = ConfigSelection(default='i', choices=[
		('o', _("Off")),
		('p', _("Progress")),
		('s', _("Small progress")),
		('i', _("Icons")),
	])
	config.usage.movielist_unseen = ConfigYesNo(default=False)

	config.usage.swap_snr_on_osd = ConfigYesNo(default=False)

	def SpinnerOnOffChanged(configElement):
		setSpinnerOnOff(int(configElement.value))
	config.usage.show_spinner.addNotifier(SpinnerOnOffChanged)

	def EnableTtCachingChanged(configElement):
		setEnableTtCachingOnOff(int(configElement.value))
	config.usage.enable_tt_caching.addNotifier(EnableTtCachingChanged)

	def TunerTypePriorityOrderChanged(configElement):
		setTunerTypePriorityOrder(int(configElement.value))
	config.usage.alternatives_priority.addNotifier(TunerTypePriorityOrderChanged, immediate_feedback=False)

	def PreferredTunerChanged(configElement):
		setPreferredTuner(int(configElement.value))
	config.usage.frontend_priority.addNotifier(PreferredTunerChanged)

	config.usage.show_picon_in_display = ConfigYesNo(default=True)
	config.usage.hide_zap_errors = ConfigYesNo(default=False)
	config.usage.show_cryptoinfo = ConfigYesNo(default=True)
	config.usage.show_eit_nownext = ConfigYesNo(default=True)
	config.usage.show_vcr_scart = ConfigYesNo(default=False)
	config.usage.show_update_disclaimer = ConfigYesNo(default=True)
	config.usage.pic_resolution = ConfigSelection(default=None, choices=[(None, _("Same resolution as skin")), ("(720, 576)", "720x576"), ("(1280, 720)", "1280x720"), ("(1920, 1080)", "1920x1080")][:SystemInfo["HasFullHDSkinSupport"] and 4 or 3])

	if SystemInfo["Fan"]:
		choicelist = [('off', _("Off")), ('on', _("On")), ('auto', _("Auto"))]
		if os.path.exists("/proc/stb/fp/fan_choices"):
			choicelist = [x for x in choicelist if x[0] in open("/proc/stb/fp/fan_choices", "r").read().strip().split(" ")]
		config.usage.fan = ConfigSelection(choicelist)

		def fanChanged(configElement):
			open(SystemInfo["Fan"], "w").write(configElement.value)
		config.usage.fan.addNotifier(fanChanged)

	if SystemInfo["FanPWM"]:
		def fanSpeedChanged(configElement):
			open(SystemInfo["FanPWM"], "w").write(hex(configElement.value)[2:])
		config.usage.fanspeed = ConfigSlider(default=127, increment=8, limits=(0, 255))
		config.usage.fanspeed.addNotifier(fanSpeedChanged)

	if SystemInfo["PowerLED"]:
		def powerLEDChanged(configElement):
			if "fp" in SystemInfo["PowerLED"]:
				open(SystemInfo["PowerLED"], "w").write(configElement.value and "1" or "0")
				patterns = [PATTERN_ON, PATTERN_ON, PATTERN_OFF, PATTERN_OFF] if configElement.value else [PATTERN_OFF, PATTERN_OFF, PATTERN_OFF, PATTERN_OFF]
				ledPatterns.setLedPatterns(1, patterns)
			else:
				open(SystemInfo["PowerLED"], "w").write(configElement.value and "on" or "off")
		config.usage.powerLED = ConfigYesNo(default=True)
		config.usage.powerLED.addNotifier(powerLEDChanged)

	if SystemInfo["StandbyLED"]:
		def standbyLEDChanged(configElement):
			if "fp" in SystemInfo["StandbyLED"]:
				patterns = [PATTERN_OFF, PATTERN_BLINK, PATTERN_ON, PATTERN_BLINK] if configElement.value else [PATTERN_OFF, PATTERN_OFF, PATTERN_OFF, PATTERN_OFF]
				ledPatterns.setLedPatterns(0, patterns)
			else:
				open(SystemInfo["StandbyLED"], "w").write(configElement.value and "on" or "off")
		config.usage.standbyLED = ConfigYesNo(default=True)
		config.usage.standbyLED.addNotifier(standbyLEDChanged)

	if SystemInfo["SuspendLED"]:
		def suspendLEDChanged(configElement):
			if "fp" in SystemInfo["SuspendLED"]:
				open(SystemInfo["SuspendLED"], "w").write(configElement.value and "1" or "0")
			else:
				open(SystemInfo["SuspendLED"], "w").write(configElement.value and "on" or "off")
		config.usage.suspendLED = ConfigYesNo(default=True)
		config.usage.suspendLED.addNotifier(suspendLEDChanged)

	if SystemInfo["PowerOffDisplay"]:
		def powerOffDisplayChanged(configElement):
			open(SystemInfo["PowerOffDisplay"], "w").write(configElement.value and "1" or "0")
		config.usage.powerOffDisplay = ConfigYesNo(default=True)
		config.usage.powerOffDisplay.addNotifier(powerOffDisplayChanged)

	if SystemInfo["LCDshow_symbols"]:
		def lcdShowSymbols(configElement):
			open(SystemInfo["LCDshow_symbols"], "w").write(configElement.value and "1" or "0")
		config.usage.lcd_show_symbols = ConfigYesNo(default=True)
		config.usage.lcd_show_symbols.addNotifier(lcdShowSymbols)

	if SystemInfo["WakeOnLAN"]:
		def wakeOnLANChanged(configElement):
			if "fp" in SystemInfo["WakeOnLAN"]:
				open(SystemInfo["WakeOnLAN"], "w").write(configElement.value and "enable" or "disable")
			else:
				open(SystemInfo["WakeOnLAN"], "w").write(configElement.value and "on" or "off")
		config.usage.wakeOnLAN = ConfigYesNo(default=False)
		config.usage.wakeOnLAN.addNotifier(wakeOnLANChanged)

	if SystemInfo["hasXcoreVFD"]:
		def set12to8characterVFD(configElement):
			open(SystemInfo["hasXcoreVFD"], "w").write(not configElement.value and "1" or "0")
		config.usage.toggle12to8characterVFD = ConfigYesNo(default=False)
		config.usage.toggle12to8characterVFD.addNotifier(set12to8characterVFD)

	if SystemInfo["LcdLiveTVMode"]:
		def setLcdLiveTVMode(configElement):
			open(SystemInfo["LcdLiveTVMode"], "w").write(configElement.value)
		config.usage.LcdLiveTVMode = ConfigSelection(default="0", choices=[str(x) for x in range(0, 9)])
		config.usage.LcdLiveTVMode.addNotifier(setLcdLiveTVMode)

	if SystemInfo["LcdLiveDecoder"]:
		def setLcdLiveDecoder(configElement):
			open(SystemInfo["LcdLiveDecoder"], "w").write(configElement.value)
		config.usage.LcdLiveDecoder = ConfigSelection(default="0", choices=[str(x) for x in range(0, 4)])
		config.usage.LcdLiveDecoder.addNotifier(setLcdLiveDecoder)

	config.usage.boolean_graphic = ConfigSelection(default="true", choices={"false": _("no"), "true": _("yes"), "only_bool": _("yes, but not in multi selections")})

	config.epg = ConfigSubsection()
	config.epg.eit = ConfigYesNo(default=True)
	config.epg.mhw = ConfigYesNo(default=False)
	config.epg.freesat = ConfigYesNo(default=True)
	config.epg.viasat = ConfigYesNo(default=True)
	config.epg.netmed = ConfigYesNo(default=True)
	config.epg.virgin = ConfigYesNo(default=False)
	config.epg.opentv = ConfigYesNo(default=False)
	config.misc.showradiopic = ConfigYesNo(default=True)

	def EpgSettingsChanged(configElement):
		from enigma import eEPGCache
		mask = 0xffffffff
		if not config.epg.eit.value:
			mask &= ~(eEPGCache.NOWNEXT | eEPGCache.SCHEDULE | eEPGCache.SCHEDULE_OTHER)
		if not config.epg.mhw.value:
			mask &= ~eEPGCache.MHW
		if not config.epg.freesat.value:
			mask &= ~(eEPGCache.FREESAT_NOWNEXT | eEPGCache.FREESAT_SCHEDULE | eEPGCache.FREESAT_SCHEDULE_OTHER)
		if not config.epg.viasat.value:
			mask &= ~eEPGCache.VIASAT
		if not config.epg.netmed.value:
			mask &= ~(eEPGCache.NETMED_SCHEDULE | eEPGCache.NETMED_SCHEDULE_OTHER)
		if not config.epg.virgin.value:
			mask &= ~(eEPGCache.VIRGIN_NOWNEXT | eEPGCache.VIRGIN_SCHEDULE)
		if not config.epg.opentv.value:
			mask &= ~eEPGCache.OPENTV
		eEPGCache.getInstance().setEpgSources(mask)
	config.epg.eit.addNotifier(EpgSettingsChanged)
	config.epg.mhw.addNotifier(EpgSettingsChanged)
	config.epg.freesat.addNotifier(EpgSettingsChanged)
	config.epg.viasat.addNotifier(EpgSettingsChanged)
	config.epg.netmed.addNotifier(EpgSettingsChanged)
	config.epg.virgin.addNotifier(EpgSettingsChanged)
	config.epg.opentv.addNotifier(EpgSettingsChanged)

	config.epg.histminutes = ConfigSelectionNumber(min=0, max=120, stepwidth=15, default=0, wraparound=True)

	def EpgHistorySecondsChanged(configElement):
		from enigma import eEPGCache
		eEPGCache.getInstance().setEpgHistorySeconds(config.epg.histminutes.getValue() * 60)
	config.epg.histminutes.addNotifier(EpgHistorySecondsChanged)

	choicelist = [("newline", _("new line")), ("2newlines", _("2 new lines")), ("space", _("space")), ("dot", " . "), ("dash", " - "), ("asterisk", " * "), ("nothing", _("nothing"))]
	config.epg.fulldescription_separator = ConfigSelection(default="2newlines", choices=choicelist)
	choicelist = [("no", _("no")), ("nothing", _("omit")), ("space", _("space")), ("dot", ". "), ("dash", " - "), ("asterisk", " * "), ("hashtag", " # ")]
	config.epg.replace_newlines = ConfigSelection(default="no", choices=choicelist)

	def setHDDStandby(configElement):
		for hdd in harddiskmanager.HDDList():
			hdd[1].setIdleTime(int(configElement.value))
	config.usage.hdd_standby.addNotifier(setHDDStandby, immediate_feedback=False)

	if SystemInfo["12V_Output"]:
		def set12VOutput(configElement):
			Misc_Options.getInstance().set_12V_output(configElement.value == "on" and 1 or 0)
		config.usage.output_12V.addNotifier(set12VOutput, immediate_feedback=False)

	config.usage.keymap = ConfigText(default=eEnv.resolve("${datadir}/enigma2/keymap.xml"))
	keytranslation = eEnv.resolve("${sysconfdir}/enigma2/keytranslation.xml")
	if not os.path.exists(keytranslation):
		keytranslation = eEnv.resolve("${datadir}/enigma2/keytranslation.xml")
	config.usage.keytrans = ConfigText(default=keytranslation)
	config.usage.alternative_imagefeed = ConfigText(default="", fixed_size=False)

	config.seek = ConfigSubsection()
	config.seek.selfdefined_13 = ConfigNumber(default=15)
	config.seek.selfdefined_46 = ConfigNumber(default=60)
	config.seek.selfdefined_79 = ConfigNumber(default=300)

	config.seek.speeds_forward = ConfigSet(default=[2, 4, 8, 16, 32, 64, 128], choices=[2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
	config.seek.speeds_backward = ConfigSet(default=[2, 4, 8, 16, 32, 64, 128], choices=[1, 2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
	config.seek.speeds_slowmotion = ConfigSet(default=[2, 4, 8], choices=[2, 4, 6, 8, 12, 16, 25])

	config.seek.enter_forward = ConfigSelection(default="2", choices=["2", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128"])
	config.seek.enter_backward = ConfigSelection(default="1", choices=["1", "2", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128"])

	config.seek.on_pause = ConfigSelection(default="play", choices=[
		("play", _("Play")),
		("step", _("Single step (GOP)")),
		("last", _("Last speed"))])

	config.usage.timerlist_finished_timer_position = ConfigSelection(default="end", choices=[("beginning", _("At beginning")), ("end", _("At end"))])

	def updateEnterForward(configElement):
		if not configElement.value:
			configElement.value = [2]
		updateChoices(config.seek.enter_forward, configElement.value)

	config.seek.speeds_forward.addNotifier(updateEnterForward, immediate_feedback=False)

	def updateEnterBackward(configElement):
		if not configElement.value:
			configElement.value = [2]
		updateChoices(config.seek.enter_backward, configElement.value)

	config.seek.speeds_backward.addNotifier(updateEnterBackward, immediate_feedback=False)

	def updateEraseSpeed(el):
		eBackgroundFileEraser.getInstance().setEraseSpeed(int(el.value))

	def updateEraseFlags(el):
		eBackgroundFileEraser.getInstance().setEraseFlags(int(el.value))
	config.misc.erase_speed = ConfigSelection(default="20", choices=[
		("10", _("10 MB/s")),
		("20", _("20 MB/s")),
		("50", _("50 MB/s")),
		("100", _("100 MB/s"))])
	config.misc.erase_speed.addNotifier(updateEraseSpeed, immediate_feedback=False)
	config.misc.erase_flags = ConfigSelection(default="1", choices=[
		("0", _("Disable")),
		("1", _("Internal hdd only")),
		("3", _("Everywhere"))])
	config.misc.erase_flags.addNotifier(updateEraseFlags, immediate_feedback=False)

	if SystemInfo["ZapMode"]:
		def setZapmode(el):
			open(SystemInfo["ZapMode"], "w").write(el.value)
		config.misc.zapmode = ConfigSelection(default="mute", choices=[
			("mute", _("Black screen")), ("hold", _("Hold screen")), ("mutetilllock", _("Black screen till locked")), ("holdtilllock", _("Hold till locked"))])
		config.misc.zapmode.addNotifier(setZapmode, immediate_feedback=False)

	if SystemInfo["VFD_scroll_repeats"]:
		def scroll_repeats(el):
			open(SystemInfo["VFD_scroll_repeats"], "w").write(el.value)
		choicelist = []
		for i in range(1, 11, 1):
			choicelist.append((str(i)))
		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"]:
		def scroll_delay(el):
			open(SystemInfo["VFD_scroll_delay"], "w").write(el.value)
		choicelist = []
		for i in range(0, 1001, 50):
			choicelist.append((str(i)))
		config.usage.vfd_scroll_delay = ConfigSelection(default="150", choices=choicelist)
		config.usage.vfd_scroll_delay.addNotifier(scroll_delay, immediate_feedback=False)

	if SystemInfo["VFD_initial_scroll_delay"]:
		def initial_scroll_delay(el):
			open(SystemInfo["VFD_initial_scroll_delay"], "w").write(el.value)
		choicelist = []
		for i in range(0, 20001, 500):
			choicelist.append((str(i)))
		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"]:
		def final_scroll_delay(el):
			open(SystemInfo["VFD_final_scroll_delay"], "w").write(el.value)
		choicelist = []
		for i in range(0, 20001, 500):
			choicelist.append((str(i)))
		config.usage.vfd_final_scroll_delay = ConfigSelection(default="1000", choices=choicelist)
		config.usage.vfd_final_scroll_delay.addNotifier(final_scroll_delay, immediate_feedback=False)

	config.subtitles = ConfigSubsection()
	config.subtitles.show = ConfigYesNo(default=True)
	config.subtitles.ttx_subtitle_colors = ConfigSelection(default="1", choices=[
		("0", _("original")),
		("1", _("white")),
		("2", _("yellow"))])
	config.subtitles.ttx_subtitle_original_position = ConfigYesNo(default=False)
	config.subtitles.subtitle_position = ConfigSelection(default="50", choices=["0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100", "150", "200", "250", "300", "350", "400", "450"])
	config.subtitles.subtitle_alignment = ConfigSelection(default="center", choices=[("left", _("left")), ("center", _("center")), ("right", _("right"))])
	config.subtitles.subtitle_rewrap = ConfigYesNo(default=False)
	config.subtitles.colourise_dialogs = ConfigYesNo(default=False)
	config.subtitles.subtitle_borderwidth = ConfigSelection(default="3", choices=["1", "2", "3", "4", "5"])
	config.subtitles.subtitle_fontsize = ConfigSelection(default="40", choices=["%d" % x for x in range(16, 101) if not x % 2])
	config.subtitles.showbackground = ConfigYesNo(default=False)

	subtitle_delay_choicelist = []
	for i in range(-900000, 1845000, 45000):
		if i == 0:
			subtitle_delay_choicelist.append(("0", _("No delay")))
		else:
			subtitle_delay_choicelist.append((str(i), _("%2.1f sec") % (i / 90000.)))
	config.subtitles.subtitle_noPTSrecordingdelay = ConfigSelection(default="315000", choices=subtitle_delay_choicelist)

	config.subtitles.dvb_subtitles_yellow = ConfigYesNo(default=False)
	config.subtitles.dvb_subtitles_original_position = ConfigSelection(default="0", choices=[("0", _("Original")), ("1", _("Fixed")), ("2", _("Relative"))])
	config.subtitles.dvb_subtitles_centered = ConfigYesNo(default=False)
	config.subtitles.subtitle_bad_timing_delay = ConfigSelection(default="0", choices=subtitle_delay_choicelist)
	config.subtitles.dvb_subtitles_backtrans = ConfigSelection(default="0", choices=[
		("0", _("No transparency")),
		("25", "10%"),
		("50", "20%"),
		("75", "30%"),
		("100", "40%"),
		("125", "50%"),
		("150", "60%"),
		("175", "70%"),
		("200", "80%"),
		("225", "90%"),
		("255", _("Full transparency"))])
	config.subtitles.pango_subtitle_colors = ConfigSelection(default="1", choices=[
		("0", _("alternative")),
		("1", _("white")),
		("2", _("yellow"))])
	config.subtitles.pango_subtitle_fontswitch = ConfigYesNo(default=True)
	config.subtitles.pango_subtitles_delay = ConfigSelection(default="0", choices=subtitle_delay_choicelist)
	config.subtitles.pango_subtitles_fps = ConfigSelection(default="1", choices=[
		("1", _("Original")),
		("23976", _("23.976")),
		("24000", _("24")),
		("25000", _("25")),
		("29970", _("29.97")),
		("30000", _("30"))])
	config.subtitles.pango_autoturnon = ConfigYesNo(default=True)

	config.autolanguage = ConfigSubsection()
	audio_language_choices = [
		("", _("None")),
		(originalAudioTracks, _("Original")),
		("ara", _("Arabic")),
		("eus baq", _("Basque")),
		("bul", _("Bulgarian")),
		("hrv", _("Croatian")),
		("chn sgp", _("Chinese - Simplified")),
		("twn hkn", _("Chinese - Traditional")),
		("ces cze", _("Czech")),
		("dan", _("Danish")),
		("dut ndl nld", _("Dutch")),
		("eng", _("English")),
		("est", _("Estonian")),
		("fin", _("Finnish")),
		("fra fre", _("French")),
		("deu ger", _("German")),
		("ell gre grc", _("Greek")),
		("heb", _("Hebrew")),
		("hun", _("Hungarian")),
		("ind", _("Indonesian")),
		("ita", _("Italian")),
		("lav", _("Latvian")),
		("lit", _("Lithuanian")),
		("ltz", _("Luxembourgish")),
		("nor", _("Norwegian")),
		("fas per fa pes", _("Persian")),
		("pol", _("Polish")),
		("por dub Dub DUB ud1", _("Portuguese")),
		("ron rum", _("Romanian")),
		("rus", _("Russian")),
		("srp", _("Serbian")),
		("slk slo", _("Slovak")),
		("slv", _("Slovenian")),
		("spa", _("Spanish")),
		("swe", _("Swedish")),
		("tha", _("Thai")),
		("tur Audio_TUR", _("Turkish")),
		("ukr Ukr", _("Ukrainian")),
		(visuallyImpairedCommentary, _("Audio description for the visually impaired"))]

	epg_language_choices = audio_language_choices[:1] + audio_language_choices[2:]

	def setEpgLanguage(configElement):
		eServiceEvent.setEPGLanguage(configElement.value)

	def setEpgLanguageAlternative(configElement):
		eServiceEvent.setEPGLanguageAlternative(configElement.value)

	def epglanguage(configElement):
		config.autolanguage.audio_epglanguage.setChoices([x for x in epg_language_choices if x[0] and x[0] != config.autolanguage.audio_epglanguage_alternative.value or not x[0] and not config.autolanguage.audio_epglanguage_alternative.value])
		config.autolanguage.audio_epglanguage_alternative.setChoices([x for x in epg_language_choices if x[0] and x[0] != config.autolanguage.audio_epglanguage.value or not x[0]])
	config.autolanguage.audio_epglanguage = ConfigSelection(epg_language_choices, default="")
	config.autolanguage.audio_epglanguage_alternative = ConfigSelection(epg_language_choices, default="")
	config.autolanguage.audio_epglanguage.addNotifier(setEpgLanguage)
	config.autolanguage.audio_epglanguage.addNotifier(epglanguage, initial_call=False)
	config.autolanguage.audio_epglanguage_alternative.addNotifier(setEpgLanguageAlternative)
	config.autolanguage.audio_epglanguage_alternative.addNotifier(epglanguage)

	def getselectedlanguages(range):
		return [eval("config.autolanguage.audio_autoselect%x.value" % x) for x in range]

	def autolanguage(configElement):
		config.autolanguage.audio_autoselect1.setChoices([x for x in audio_language_choices if x[0] and x[0] not in getselectedlanguages((2, 3, 4)) or not x[0] and not config.autolanguage.audio_autoselect2.value])
		config.autolanguage.audio_autoselect2.setChoices([x for x in audio_language_choices if x[0] and x[0] not in getselectedlanguages((1, 3, 4)) or not x[0] and not config.autolanguage.audio_autoselect3.value])
		config.autolanguage.audio_autoselect3.setChoices([x for x in audio_language_choices if x[0] and x[0] not in getselectedlanguages((1, 2, 4)) or not x[0] and not config.autolanguage.audio_autoselect4.value])
		config.autolanguage.audio_autoselect4.setChoices([x for x in audio_language_choices if x[0] and x[0] not in getselectedlanguages((1, 2, 3)) or not x[0]])
	config.autolanguage.audio_autoselect1 = ConfigSelection(choices=audio_language_choices, default="")
	config.autolanguage.audio_autoselect2 = ConfigSelection(choices=audio_language_choices, default="")
	config.autolanguage.audio_autoselect3 = ConfigSelection(choices=audio_language_choices, default="")
	config.autolanguage.audio_autoselect4 = ConfigSelection(choices=audio_language_choices, default="")
	config.autolanguage.audio_autoselect1.addNotifier(autolanguage, initial_call=False)
	config.autolanguage.audio_autoselect2.addNotifier(autolanguage, initial_call=False)
	config.autolanguage.audio_autoselect3.addNotifier(autolanguage, initial_call=False)
	config.autolanguage.audio_autoselect4.addNotifier(autolanguage)
	config.autolanguage.audio_defaultac3 = ConfigYesNo(default=True)
	config.autolanguage.audio_defaultddp = ConfigYesNo(default=False)
	config.autolanguage.audio_usecache = ConfigYesNo(default=True)

	subtitle_language_choices = audio_language_choices[:1] + audio_language_choices[2:]

	def getselectedsublanguages(range):
		return [eval("config.autolanguage.subtitle_autoselect%x.value" % x) for x in range]

	def autolanguagesub(configElement):
		config.autolanguage.subtitle_autoselect1.setChoices([x for x in subtitle_language_choices if x[0] and x[0] not in getselectedsublanguages((2, 3, 4)) or not x[0] and not config.autolanguage.subtitle_autoselect2.value])
		config.autolanguage.subtitle_autoselect2.setChoices([x for x in subtitle_language_choices if x[0] and x[0] not in getselectedsublanguages((1, 3, 4)) or not x[0] and not config.autolanguage.subtitle_autoselect3.value])
		config.autolanguage.subtitle_autoselect3.setChoices([x for x in subtitle_language_choices if x[0] and x[0] not in getselectedsublanguages((1, 2, 4)) or not x[0] and not config.autolanguage.subtitle_autoselect4.value])
		config.autolanguage.subtitle_autoselect4.setChoices([x for x in subtitle_language_choices if x[0] and x[0] not in getselectedsublanguages((1, 2, 3)) or not x[0]])
		choicelist = [('0', _("None"))]
		for y in range(1, 15 if config.autolanguage.subtitle_autoselect4.value else (7 if config.autolanguage.subtitle_autoselect3.value else(4 if config.autolanguage.subtitle_autoselect2.value else (2 if config.autolanguage.subtitle_autoselect1.value else 0)))):
			choicelist.append((str(y), ", ".join([eval("config.autolanguage.subtitle_autoselect%x.getText()" % x) for x in (y & 1, y & 2, y & 4 and 3, y & 8 and 4) if x])))
		if config.autolanguage.subtitle_autoselect3.value:
			choicelist.append((str(y + 1), "All"))
		config.autolanguage.equal_languages.setChoices(choicelist, default="0")
	config.autolanguage.equal_languages = ConfigSelection(default="0", choices=[str(x) for x in range(0, 16)])
	config.autolanguage.subtitle_autoselect1 = ConfigSelection(choices=subtitle_language_choices, default="")
	config.autolanguage.subtitle_autoselect2 = ConfigSelection(choices=subtitle_language_choices, default="")
	config.autolanguage.subtitle_autoselect3 = ConfigSelection(choices=subtitle_language_choices, default="")
	config.autolanguage.subtitle_autoselect4 = ConfigSelection(choices=subtitle_language_choices, default="")
	config.autolanguage.subtitle_autoselect1.addNotifier(autolanguagesub, initial_call=False)
	config.autolanguage.subtitle_autoselect2.addNotifier(autolanguagesub, initial_call=False)
	config.autolanguage.subtitle_autoselect3.addNotifier(autolanguagesub, initial_call=False)
	config.autolanguage.subtitle_autoselect4.addNotifier(autolanguagesub)
	config.autolanguage.subtitle_hearingimpaired = ConfigYesNo(default=False)
	config.autolanguage.subtitle_defaultimpaired = ConfigYesNo(default=False)
	config.autolanguage.subtitle_defaultdvb = ConfigYesNo(default=False)
	config.autolanguage.subtitle_usecache = ConfigYesNo(default=True)

	config.streaming = ConfigSubsection()
	config.streaming.stream_ecm = ConfigYesNo(default=False)
	config.streaming.descramble = ConfigYesNo(default=True)
	config.streaming.descramble_client = ConfigYesNo(default=False)
	config.streaming.stream_eit = ConfigYesNo(default=True)
	config.streaming.stream_ait = ConfigYesNo(default=True)
	config.streaming.authentication = ConfigYesNo(default=False)

	config.mediaplayer = ConfigSubsection()
	config.mediaplayer.useAlternateUserAgent = ConfigYesNo(default=False)
	config.mediaplayer.alternateUserAgent = ConfigText(default="")

	config.misc.softcam_setup = ConfigSubsection()
	config.misc.softcam_setup.extension_menu = ConfigYesNo(default=True)

	config.ntp = ConfigSubsection()

	def timesyncChanged(configElement):
		if configElement.value == "dvb" or not GetIPsFromNetworkInterfaces():
			eDVBLocalTimeHandler.getInstance().setUseDVBTime(True)
			eEPGCache.getInstance().timeUpdated()
			if configElement.value == "dvb" and os.path.islink('/etc/network/if-up.d/ntpdate-sync'):
				Console().ePopen("sed -i '/ntpdate-sync/d' /etc/cron/crontabs/root;unlink /etc/network/if-up.d/ntpdate-sync")
		else:
			eDVBLocalTimeHandler.getInstance().setUseDVBTime(False)
			eEPGCache.getInstance().timeUpdated()
			if not os.path.islink('/etc/network/if-up.d/ntpdate-sync'):
				Console().ePopen("echo '30 * * * *    /usr/bin/ntpdate-sync silent' >>/etc/cron/crontabs/root;ln -s /usr/bin/ntpdate-sync /etc/network/if-up.d/ntpdate-sync")
	config.ntp.timesync = ConfigSelection(default="auto", choices=[("auto", _("auto")), ("dvb", _("Transponder Time")), ("ntp", _("Internet (ntp)"))])
	config.ntp.timesync.addNotifier(timesyncChanged)
	config.ntp.server = ConfigText("pool.ntp.org", fixed_size=False)
示例#17
0
def InitUsageConfig():
    config.usage = ConfigSubsection()
    config.usage.subnetwork = ConfigYesNo(default=True)
    config.usage.subnetwork_cable = ConfigYesNo(default=True)
    config.usage.subnetwork_terrestrial = ConfigYesNo(default=True)
    config.usage.showdish = ConfigYesNo(default=True)
    config.misc.showrotorposition = ConfigSelection(
        default="no",
        choices=[("no", _("no")), ("yes", _("yes")),
                 ("withtext", _("with text")),
                 ("tunername", _("with tuner name"))])
    config.usage.multibouquet = ConfigYesNo(default=True)

    config.usage.alternative_number_mode = ConfigYesNo(default=False)

    def alternativeNumberModeChange(configElement):
        eDVBDB.getInstance().setNumberingMode(configElement.value)
        refreshServiceList()

    config.usage.alternative_number_mode.addNotifier(
        alternativeNumberModeChange)

    config.usage.hide_number_markers = ConfigYesNo(default=True)
    config.usage.hide_number_markers.addNotifier(refreshServiceList)

    config.usage.servicetype_icon_mode = ConfigSelection(
        default="0",
        choices=[("0", _("None")), ("1", _("Left from servicename")),
                 ("2", _("Right from servicename"))])
    config.usage.servicetype_icon_mode.addNotifier(refreshServiceList)
    config.usage.crypto_icon_mode = ConfigSelection(
        default="0",
        choices=[("0", _("None")), ("1", _("Left from servicename")),
                 ("2", _("Right from servicename"))])
    config.usage.crypto_icon_mode.addNotifier(refreshServiceList)
    config.usage.record_indicator_mode = ConfigSelection(
        default="0",
        choices=[("0", _("None")), ("1", _("Left from servicename")),
                 ("2", _("Right from servicename")), ("3", _("Red colored"))])
    config.usage.record_indicator_mode.addNotifier(refreshServiceList)

    choicelist = [("-1", _("Disable"))]
    for i in range(0, 1300, 100):
        choicelist.append(
            (str(i), ngettext("%d pixel wide", "%d pixels wide", i) % i))
    config.usage.servicelist_column = ConfigSelection(default="-1",
                                                      choices=choicelist)
    config.usage.servicelist_column.addNotifier(refreshServiceList)

    config.usage.service_icon_enable = ConfigYesNo(default=False)
    config.usage.service_icon_enable.addNotifier(refreshServiceList)
    config.usage.servicelist_cursor_behavior = ConfigSelection(
        default="standard",
        choices=[("standard", _("Standard")), ("keep", _("Keep service")),
                 ("reverseB", _("Reverse bouquet buttons")),
                 ("keep reverseB",
                  _("Keep service") + " + " + _("Reverse bouquet buttons"))])

    choicelist = [("by skin", _("As defined by the skin"))]
    for i in range(5, 41):
        choicelist.append((str(i)))
    config.usage.servicelist_number_of_services = ConfigSelection(
        default="by skin", choices=choicelist)
    config.usage.servicelist_number_of_services.addNotifier(refreshServiceList)

    config.usage.multiepg_ask_bouquet = ConfigYesNo(default=False)

    config.usage.quickzap_bouquet_change = ConfigYesNo(default=False)
    config.usage.e1like_radio_mode = ConfigYesNo(default=True)
    choicelist = [("0", _("No timeout"))]
    for i in range(1, 12):
        choicelist.append((str(i), ngettext("%d second", "%d seconds", i) % i))
    config.usage.infobar_timeout = ConfigSelection(default="5",
                                                   choices=choicelist)
    config.usage.show_infobar_on_zap = ConfigYesNo(default=True)
    config.usage.show_infobar_on_skip = ConfigYesNo(default=True)
    config.usage.show_infobar_on_event_change = ConfigYesNo(default=False)
    config.usage.show_second_infobar = ConfigSelection(
        default="0",
        choices=[("", _("None"))] + choicelist + [("EPG", _("EPG"))])
    config.usage.show_simple_second_infobar = ConfigYesNo(default=False)
    config.usage.infobar_frontend_source = ConfigSelection(
        default="settings",
        choices=[("settings", _("Settings")), ("tuner", _("Tuner"))])
    config.usage.oldstyle_zap_controls = ConfigYesNo(default=False)
    config.usage.oldstyle_channel_select_controls = ConfigYesNo(default=False)
    config.usage.zap_with_ch_buttons = ConfigYesNo(default=False)
    config.usage.ok_is_channelselection = ConfigYesNo(default=False)
    config.usage.volume_instead_of_channelselection = ConfigYesNo(
        default=False)
    config.usage.channelselection_preview = ConfigYesNo(default=False)
    config.usage.show_spinner = ConfigYesNo(default=True)
    config.usage.menu_sort_weight = ConfigDictionarySet(
        default={"mainmenu": {
            "submenu": {}
        }})
    config.usage.menu_sort_mode = ConfigSelection(
        default="default",
        choices=[
            ("a_z", _("alphabetical")),
            ("default", _("Default")),
            ("user", _("user defined")),
        ])
    config.usage.menu_show_numbers = ConfigYesNo(default=False)
    config.usage.menu_path = ConfigSelection(default="off",
                                             choices=[
                                                 ("off", _("Disabled")),
                                                 ("small", _("Small")),
                                                 ("large", _("Large")),
                                             ])
    config.usage.enable_tt_caching = ConfigYesNo(default=True)
    choicelist = []
    for i in (10, 30):
        choicelist.append((str(i), ngettext("%d second", "%d seconds", i) % i))
    for i in (60, 120, 300, 600, 1200, 1800):
        m = i / 60
        choicelist.append((str(i), ngettext("%d minute", "%d minutes", m) % m))
    for i in (3600, 7200, 14400):
        h = i / 3600
        choicelist.append((str(i), ngettext("%d hour", "%d hours", h) % h))
    config.usage.hdd_standby = ConfigSelection(
        default="300", choices=[("0", _("No standby"))] + choicelist)
    config.usage.output_12V = ConfigSelection(default="do not change",
                                              choices=[("do not change",
                                                        _("Do not change")),
                                                       ("off", _("Off")),
                                                       ("on", _("On"))])

    config.usage.pip_zero_button = ConfigSelection(
        default="standard",
        choices=[("standard", _("Standard")),
                 ("swap", _("Swap PiP and main picture")),
                 ("swapstop", _("Move PiP to main picture")),
                 ("stop", _("Stop PiP"))])
    config.usage.pip_hideOnExit = ConfigSelection(default="without popup",
                                                  choices=[("no", _("no")),
                                                           ("popup",
                                                            _("With popup")),
                                                           ("without popup",
                                                            _("Without popup"))
                                                           ])
    choicelist = [("-1", _("Disabled")), ("0", _("No timeout"))]
    for i in [60, 300, 600, 900, 1800, 2700, 3600]:
        m = i / 60
        choicelist.append((str(i), ngettext("%d minute", "%d minutes", m) % m))
    config.usage.pip_last_service_timeout = ConfigSelection(default="0",
                                                            choices=choicelist)

    config.usage.default_path = ConfigText(default="")
    config.usage.timer_path = ConfigText(default="<default>")
    config.usage.instantrec_path = ConfigText(default="<default>")
    config.usage.timeshift_path = ConfigText(default="/media/hdd/")
    config.usage.allowed_timeshift_paths = ConfigLocations(
        default=["/media/hdd/"])

    config.usage.movielist_trashcan = ConfigYesNo(default=True)
    config.usage.movielist_trashcan_days = ConfigNumber(default=8)
    config.usage.movielist_trashcan_reserve = ConfigNumber(default=40)
    config.usage.on_movie_start = ConfigSelection(
        default="resume",
        choices=[
            ("ask yes", _("Ask user") + " " + _("default") + " " + _("yes")),
            ("ask no", _("Ask user") + " " + _("default") + " " + _("no")),
            ("resume", _("Resume from last position")),
            ("beginning", _("Start from the beginning"))
        ])
    config.usage.on_movie_stop = ConfigSelection(
        default="movielist",
        choices=[("ask", _("Ask user")),
                 ("movielist", _("Return to movie list")),
                 ("quit", _("Return to previous service"))])
    config.usage.on_movie_eof = ConfigSelection(
        default="movielist",
        choices=[("ask", _("Ask user")),
                 ("movielist", _("Return to movie list")),
                 ("quit", _("Return to previous service")),
                 ("pause", _("Pause movie at end")),
                 ("playlist", _("Play next (return to movie list)")),
                 ("playlistquit", _("Play next (return to previous service)")),
                 ("loop", _("Continues play (loop)")),
                 ("repeatcurrent", _("Repeat"))])
    config.usage.next_movie_msg = ConfigYesNo(default=True)
    config.usage.last_movie_played = ConfigText()
    config.usage.leave_movieplayer_onExit = ConfigSelection(
        default="popup",
        choices=[("no", _("no")), ("popup", _("With popup")),
                 ("without popup", _("Without popup")),
                 ("movielist", _("Return to movie list"))])

    config.usage.setup_level = ConfigSelection(default="simple",
                                               choices=[
                                                   ("simple", _("Normal")),
                                                   ("intermediate",
                                                    _("Advanced")),
                                                   ("expert", _("Expert"))
                                               ])

    config.usage.startup_to_standby = ConfigSelection(
        default="no",
        choices=[("no", _("no")), ("yes", _("yes")),
                 ("except", _("No, except Wakeup timer"))])

    config.usage.wakeup_enabled = ConfigSelection(
        default="no",
        choices=[("no", _("no")), ("yes", _("yes")),
                 ("standby", _("Yes, only from standby")),
                 ("deepstandby", _("Yes, only from deep standby"))])
    config.usage.wakeup_day = ConfigSubDict()
    config.usage.wakeup_time = ConfigSubDict()
    for i in range(7):
        config.usage.wakeup_day[i] = ConfigEnableDisable(default=False)
        config.usage.wakeup_time[i] = ConfigClock(default=((6 * 60 + 0) * 60))

    choicelist = [("0", _("Do nothing"))]
    for i in range(3600, 21601, 3600):
        h = abs(i / 3600)
        h = ngettext("%d hour", "%d hours", h) % h
        choicelist.append((str(i), _("Standby in ") + h))
    config.usage.inactivity_timer = ConfigSelection(default="0",
                                                    choices=choicelist)
    config.usage.inactivity_timer_blocktime = ConfigYesNo(default=True)
    config.usage.inactivity_timer_blocktime_begin = ConfigClock(
        default=time.mktime((0, 0, 0, 18, 0, 0, 0, 0, 0)))
    config.usage.inactivity_timer_blocktime_end = ConfigClock(
        default=time.mktime((0, 0, 0, 23, 0, 0, 0, 0, 0)))
    config.usage.inactivity_timer_blocktime_extra = ConfigYesNo(default=False)
    config.usage.inactivity_timer_blocktime_extra_begin = ConfigClock(
        default=time.mktime((0, 0, 0, 6, 0, 0, 0, 0, 0)))
    config.usage.inactivity_timer_blocktime_extra_end = ConfigClock(
        default=time.mktime((0, 0, 0, 9, 0, 0, 0, 0, 0)))
    config.usage.inactivity_timer_blocktime_by_weekdays = ConfigYesNo(
        default=False)
    config.usage.inactivity_timer_blocktime_day = ConfigSubDict()
    config.usage.inactivity_timer_blocktime_begin_day = ConfigSubDict()
    config.usage.inactivity_timer_blocktime_end_day = ConfigSubDict()
    config.usage.inactivity_timer_blocktime_extra_day = ConfigSubDict()
    config.usage.inactivity_timer_blocktime_extra_begin_day = ConfigSubDict()
    config.usage.inactivity_timer_blocktime_extra_end_day = ConfigSubDict()
    for i in range(7):
        config.usage.inactivity_timer_blocktime_day[i] = ConfigYesNo(
            default=False)
        config.usage.inactivity_timer_blocktime_begin_day[i] = ConfigClock(
            default=time.mktime((0, 0, 0, 18, 0, 0, 0, 0, 0)))
        config.usage.inactivity_timer_blocktime_end_day[i] = ConfigClock(
            default=time.mktime((0, 0, 0, 23, 0, 0, 0, 0, 0)))
        config.usage.inactivity_timer_blocktime_extra_day[i] = ConfigYesNo(
            default=False)
        config.usage.inactivity_timer_blocktime_extra_begin_day[
            i] = ConfigClock(default=time.mktime((0, 0, 0, 6, 0, 0, 0, 0, 0)))
        config.usage.inactivity_timer_blocktime_extra_end_day[i] = ConfigClock(
            default=time.mktime((0, 0, 0, 9, 0, 0, 0, 0, 0)))

    choicelist = [("0", _("Disabled")),
                  ("event_standby", _("Standby after current event"))]
    for i in range(900, 7201, 900):
        m = abs(i / 60)
        m = ngettext("%d minute", "%d minutes", m) % m
        choicelist.append((str(i), _("Standby in ") + m))
    config.usage.sleep_timer = ConfigSelection(default="0", choices=choicelist)

    choicelist = [("0", _("Disabled"))]
    for i in [300, 600] + range(900, 7201, 900):
        m = abs(i / 60)
        m = ngettext("%d minute", "%d minutes", m) % m
        choicelist.append((str(i), _("after ") + m))
    config.usage.standby_to_shutdown_timer = ConfigSelection(
        default="0", choices=choicelist)
    config.usage.standby_to_shutdown_timer_blocktime = ConfigYesNo(
        default=False)
    config.usage.standby_to_shutdown_timer_blocktime_begin = ConfigClock(
        default=time.mktime((0, 0, 0, 6, 0, 0, 0, 0, 0)))
    config.usage.standby_to_shutdown_timer_blocktime_end = ConfigClock(
        default=time.mktime((0, 0, 0, 23, 0, 0, 0, 0, 0)))

    choicelist = [("0", _("Disabled"))]
    for m in (1, 5, 10, 15, 30, 60):
        choicelist.append(
            (str(m * 60), ngettext("%d minute", "%d minutes", m) % m))
    config.usage.screen_saver = ConfigSelection(default="300",
                                                choices=choicelist)

    config.usage.check_timeshift = ConfigYesNo(default=True)

    choicelist = [("0", _("Disabled"))]
    for i in (2, 3, 4, 5, 10, 20, 30):
        choicelist.append((str(i), ngettext("%d second", "%d seconds", i) % i))
    for i in (60, 120, 300):
        m = i / 60
        choicelist.append((str(i), ngettext("%d minute", "%d minutes", m) % m))
    config.usage.timeshift_start_delay = ConfigSelection(default="0",
                                                         choices=choicelist)

    config.usage.alternatives_priority = ConfigSelection(
        default="0",
        choices=[("0", "DVB-S/-C/-T"), ("1", "DVB-S/-T/-C"),
                 ("2", "DVB-C/-S/-T"), ("3", "DVB-C/-T/-S"),
                 ("4", "DVB-T/-C/-S"), ("5", "DVB-T/-S/-C"),
                 ("127", _("No priority"))])

    def remote_fallback_changed(configElement):
        if configElement.value:
            configElement.value = "%s%s" % (
                not configElement.value.startswith("http://") and "http://"
                or "", configElement.value)
            configElement.value = "%s%s" % (configElement.value,
                                            configElement.value.count(":") == 1
                                            and ":8001" or "")

    config.usage.remote_fallback_enabled = ConfigYesNo(default=False)
    config.usage.remote_fallback = ConfigText(default="", fixed_size=False)
    config.usage.remote_fallback.addNotifier(remote_fallback_changed,
                                             immediate_feedback=False)
    config.usage.remote_fallback_import = ConfigSelection(
        default="",
        choices=[("", _("No")), ("channels", _("Channels only")),
                 ("channels_epg", _("Channels and EPG")),
                 ("epg", _("EPG only"))])
    config.usage.remote_fallback_import_restart = ConfigYesNo(default=False)
    config.usage.remote_fallback_import_standby = ConfigYesNo(default=False)
    config.usage.remote_fallback_ok = ConfigYesNo(default=False)
    config.usage.remote_fallback_nok = ConfigYesNo(default=False)
    config.usage.remote_fallback_extension_menu = ConfigYesNo(default=False)

    config.usage.show_timer_conflict_warning = ConfigYesNo(default=True)

    dvbs_nims = [("-2", _("Disabled"))]
    dvbt_nims = [("-2", _("Disabled"))]
    dvbc_nims = [("-2", _("Disabled"))]
    atsc_nims = [("-2", _("Disabled"))]

    nims = [("-1", _("auto"))]
    for x in nimmanager.nim_slots:
        if x.isCompatible("DVB-S"):
            dvbs_nims.append((str(x.slot), x.getSlotName()))
        elif x.isCompatible("DVB-T"):
            dvbt_nims.append((str(x.slot), x.getSlotName()))
        elif x.isCompatible("DVB-C"):
            dvbc_nims.append((str(x.slot), x.getSlotName()))
        elif x.isCompatible("ATSC"):
            atsc_nims.append((str(x.slot), x.getSlotName()))
        nims.append((str(x.slot), x.getSlotName()))

    config.usage.frontend_priority = ConfigSelection(default="-1",
                                                     choices=list(nims))
    nims.insert(0, ("-2", _("Disabled")))
    config.usage.recording_frontend_priority = ConfigSelection(default="-2",
                                                               choices=nims)
    config.usage.frontend_priority_dvbs = ConfigSelection(
        default="-2", choices=list(dvbs_nims))
    dvbs_nims.insert(1, ("-1", _("auto")))
    config.usage.recording_frontend_priority_dvbs = ConfigSelection(
        default="-2", choices=dvbs_nims)
    config.usage.frontend_priority_dvbt = ConfigSelection(
        default="-2", choices=list(dvbt_nims))
    dvbt_nims.insert(1, ("-1", _("auto")))
    config.usage.recording_frontend_priority_dvbt = ConfigSelection(
        default="-2", choices=dvbt_nims)
    config.usage.frontend_priority_dvbc = ConfigSelection(
        default="-2", choices=list(dvbc_nims))
    dvbc_nims.insert(1, ("-1", _("auto")))
    config.usage.recording_frontend_priority_dvbc = ConfigSelection(
        default="-2", choices=dvbc_nims)
    config.usage.frontend_priority_atsc = ConfigSelection(
        default="-2", choices=list(atsc_nims))
    atsc_nims.insert(1, ("-1", _("auto")))
    config.usage.recording_frontend_priority_atsc = ConfigSelection(
        default="-2", choices=atsc_nims)

    SystemInfo["DVB-S_priority_tuner_available"] = len(dvbs_nims) > 3 and any(
        len(i) > 2 for i in (dvbt_nims, dvbc_nims, atsc_nims))
    SystemInfo["DVB-T_priority_tuner_available"] = len(dvbt_nims) > 3 and any(
        len(i) > 2 for i in (dvbs_nims, dvbc_nims, atsc_nims))
    SystemInfo["DVB-C_priority_tuner_available"] = len(dvbc_nims) > 3 and any(
        len(i) > 2 for i in (dvbs_nims, dvbt_nims, atsc_nims))
    SystemInfo["ATSC_priority_tuner_available"] = len(atsc_nims) > 3 and any(
        len(i) > 2 for i in (dvbs_nims, dvbc_nims, dvbt_nims))

    config.misc.disable_background_scan = ConfigYesNo(default=False)
    config.usage.show_event_progress_in_servicelist = ConfigSelection(
        default='barright',
        choices=[('barleft', _("Progress bar left")),
                 ('barright', _("Progress bar right")),
                 ('percleft', _("Percentage left")),
                 ('percright', _("Percentage right")), ('no', _("no"))])
    config.usage.show_channel_numbers_in_servicelist = ConfigYesNo(
        default=True)
    config.usage.show_event_progress_in_servicelist.addNotifier(
        refreshServiceList)
    config.usage.show_channel_numbers_in_servicelist.addNotifier(
        refreshServiceList)

    config.usage.blinking_display_clock_during_recording = ConfigYesNo(
        default=False)

    config.usage.show_message_when_recording_starts = ConfigYesNo(default=True)

    config.usage.load_length_of_movies_in_moviellist = ConfigYesNo(
        default=True)
    config.usage.show_icons_in_movielist = ConfigSelection(
        default='i',
        choices=[
            ('o', _("Off")),
            ('p', _("Progress")),
            ('s', _("Small progress")),
            ('i', _("Icons")),
        ])
    config.usage.movielist_unseen = ConfigYesNo(default=False)

    config.usage.swap_snr_on_osd = ConfigYesNo(default=False)

    def SpinnerOnOffChanged(configElement):
        setSpinnerOnOff(int(configElement.value))

    config.usage.show_spinner.addNotifier(SpinnerOnOffChanged)

    def EnableTtCachingChanged(configElement):
        setEnableTtCachingOnOff(int(configElement.value))

    config.usage.enable_tt_caching.addNotifier(EnableTtCachingChanged)

    def TunerTypePriorityOrderChanged(configElement):
        setTunerTypePriorityOrder(int(configElement.value))

    config.usage.alternatives_priority.addNotifier(
        TunerTypePriorityOrderChanged, immediate_feedback=False)

    def PreferredTunerChanged(configElement):
        setPreferredTuner(int(configElement.value))

    config.usage.frontend_priority.addNotifier(PreferredTunerChanged)

    config.usage.show_picon_in_display = ConfigYesNo(default=True)
    config.usage.hide_zap_errors = ConfigYesNo(default=False)
    config.usage.show_cryptoinfo = ConfigYesNo(default=True)
    config.usage.show_eit_nownext = ConfigYesNo(default=True)
    config.usage.show_vcr_scart = ConfigYesNo(default=False)
    config.usage.show_update_disclaimer = ConfigYesNo(default=True)
    config.usage.pic_resolution = ConfigSelection(
        default=None,
        choices=[
            (None, _("Same resolution as skin")), ("(720, 576)", "720x576"),
            ("(1280, 720)", "1280x720"), ("(1920, 1080)", "1920x1080")
        ][:SystemInfo["HasFullHDSkinSupport"] and 4 or 3])

    if SystemInfo["Fan"]:
        choicelist = [('off', _("Off")), ('on', _("On")), ('auto', _("Auto"))]
        if os.path.exists("/proc/stb/fp/fan_choices"):
            choicelist = [
                x for x in choicelist if x[0] in open(
                    "/proc/stb/fp/fan_choices", "r").read().strip().split(" ")
            ]
        config.usage.fan = ConfigSelection(choicelist)

        def fanChanged(configElement):
            open(SystemInfo["Fan"], "w").write(configElement.value)

        config.usage.fan.addNotifier(fanChanged)

    if SystemInfo["FanPWM"]:

        def fanSpeedChanged(configElement):
            open(SystemInfo["FanPWM"], "w").write(hex(configElement.value)[2:])

        config.usage.fanspeed = ConfigSlider(default=127,
                                             increment=8,
                                             limits=(0, 255))
        config.usage.fanspeed.addNotifier(fanSpeedChanged)

    if SystemInfo["StandbyLED"]:

        def standbyLEDChanged(configElement):
            open(SystemInfo["StandbyLED"],
                 "w").write(configElement.value and "on" or "off")

        config.usage.standbyLED = ConfigYesNo(default=True)
        config.usage.standbyLED.addNotifier(standbyLEDChanged)

    if SystemInfo["PowerOffDisplay"]:

        def powerOffDisplayChanged(configElement):
            open(SystemInfo["PowerOffDisplay"],
                 "w").write(configElement.value and "1" or "0")

        config.usage.powerOffDisplay = ConfigYesNo(default=True)
        config.usage.powerOffDisplay.addNotifier(powerOffDisplayChanged)

    if SystemInfo["LCDshow_symbols"]:

        def lcdShowSymbols(configElement):
            open(SystemInfo["LCDshow_symbols"],
                 "w").write(configElement.value and "1" or "0")

        config.usage.lcd_show_symbols = ConfigYesNo(default=True)
        config.usage.lcd_show_symbols.addNotifier(lcdShowSymbols)

    if SystemInfo["WakeOnLAN"]:

        def wakeOnLANChanged(configElement):
            if "fp" in SystemInfo["WakeOnLAN"]:
                open(SystemInfo["WakeOnLAN"],
                     "w").write(configElement.value and "enable" or "disable")
            else:
                open(SystemInfo["WakeOnLAN"],
                     "w").write(configElement.value and "on" or "off")

        config.usage.wakeOnLAN = ConfigYesNo(default=False)
        config.usage.wakeOnLAN.addNotifier(wakeOnLANChanged)

    if SystemInfo["hasXcoreVFD"]:

        def set12to8characterVFD(configElement):
            open(SystemInfo["hasXcoreVFD"],
                 "w").write(not configElement.value and "1" or "0")

        config.usage.toggle12to8characterVFD = ConfigYesNo(default=False)
        config.usage.toggle12to8characterVFD.addNotifier(set12to8characterVFD)

    if SystemInfo["LcdLiveTVMode"]:

        def setLcdLiveTVMode(configElement):
            open(SystemInfo["LcdLiveTVMode"], "w").write(configElement.value)

        config.usage.LcdLiveTVMode = ConfigSelection(
            default="0", choices=[str(x) for x in range(0, 9)])
        config.usage.LcdLiveTVMode.addNotifier(setLcdLiveTVMode)

    config.epg = ConfigSubsection()
    config.epg.eit = ConfigYesNo(default=True)
    config.epg.mhw = ConfigYesNo(default=False)
    config.epg.freesat = ConfigYesNo(default=True)
    config.epg.viasat = ConfigYesNo(default=True)
    config.epg.netmed = ConfigYesNo(default=True)
    config.epg.virgin = ConfigYesNo(default=False)
    config.misc.showradiopic = ConfigYesNo(default=True)

    def EpgSettingsChanged(configElement):
        from enigma import eEPGCache
        mask = 0xffffffff
        if not config.epg.eit.value:
            mask &= ~(eEPGCache.NOWNEXT | eEPGCache.SCHEDULE
                      | eEPGCache.SCHEDULE_OTHER)
        if not config.epg.mhw.value:
            mask &= ~eEPGCache.MHW
        if not config.epg.freesat.value:
            mask &= ~(eEPGCache.FREESAT_NOWNEXT | eEPGCache.FREESAT_SCHEDULE
                      | eEPGCache.FREESAT_SCHEDULE_OTHER)
        if not config.epg.viasat.value:
            mask &= ~eEPGCache.VIASAT
        if not config.epg.netmed.value:
            mask &= ~(eEPGCache.NETMED_SCHEDULE
                      | eEPGCache.NETMED_SCHEDULE_OTHER)
        if not config.epg.virgin.value:
            mask &= ~(eEPGCache.VIRGIN_NOWNEXT | eEPGCache.VIRGIN_SCHEDULE)
        eEPGCache.getInstance().setEpgSources(mask)

    config.epg.eit.addNotifier(EpgSettingsChanged)
    config.epg.mhw.addNotifier(EpgSettingsChanged)
    config.epg.freesat.addNotifier(EpgSettingsChanged)
    config.epg.viasat.addNotifier(EpgSettingsChanged)
    config.epg.netmed.addNotifier(EpgSettingsChanged)
    config.epg.virgin.addNotifier(EpgSettingsChanged)

    config.epg.histminutes = ConfigSelectionNumber(min=0,
                                                   max=120,
                                                   stepwidth=15,
                                                   default=0,
                                                   wraparound=True)

    def EpgHistorySecondsChanged(configElement):
        from enigma import eEPGCache
        eEPGCache.getInstance().setEpgHistorySeconds(
            config.epg.histminutes.getValue() * 60)

    config.epg.histminutes.addNotifier(EpgHistorySecondsChanged)

    def setHDDStandby(configElement):
        for hdd in harddiskmanager.HDDList():
            hdd[1].setIdleTime(int(configElement.value))

    config.usage.hdd_standby.addNotifier(setHDDStandby,
                                         immediate_feedback=False)

    if SystemInfo["12V_Output"]:

        def set12VOutput(configElement):
            Misc_Options.getInstance().set_12V_output(
                configElement.value == "on" and 1 or 0)

        config.usage.output_12V.addNotifier(set12VOutput,
                                            immediate_feedback=False)

    config.usage.keymap = ConfigText(
        default=eEnv.resolve("${datadir}/enigma2/keymap.xml"))
    config.usage.keytrans = ConfigText(
        default=eEnv.resolve("${datadir}/enigma2/keytranslation.xml"))

    config.seek = ConfigSubsection()
    config.seek.selfdefined_13 = ConfigNumber(default=15)
    config.seek.selfdefined_46 = ConfigNumber(default=60)
    config.seek.selfdefined_79 = ConfigNumber(default=300)

    config.seek.speeds_forward = ConfigSet(
        default=[2, 4, 8, 16, 32, 64, 128],
        choices=[2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
    config.seek.speeds_backward = ConfigSet(
        default=[2, 4, 8, 16, 32, 64, 128],
        choices=[1, 2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
    config.seek.speeds_slowmotion = ConfigSet(default=[2, 4, 8],
                                              choices=[2, 4, 6, 8, 12, 16, 25])

    config.seek.enter_forward = ConfigSelection(default="2",
                                                choices=[
                                                    "2", "4", "6", "8", "12",
                                                    "16", "24", "32", "48",
                                                    "64", "96", "128"
                                                ])
    config.seek.enter_backward = ConfigSelection(default="1",
                                                 choices=[
                                                     "1", "2", "4", "6", "8",
                                                     "12", "16", "24", "32",
                                                     "48", "64", "96", "128"
                                                 ])

    config.seek.on_pause = ConfigSelection(default="play",
                                           choices=[("play", _("Play")),
                                                    ("step",
                                                     _("Single step (GOP)")),
                                                    ("last", _("Last speed"))])

    config.usage.timerlist_finished_timer_position = ConfigSelection(
        default="end",
        choices=[("beginning", _("At beginning")), ("end", _("At end"))])

    def updateEnterForward(configElement):
        if not configElement.value:
            configElement.value = [2]
        updateChoices(config.seek.enter_forward, configElement.value)

    config.seek.speeds_forward.addNotifier(updateEnterForward,
                                           immediate_feedback=False)

    def updateEnterBackward(configElement):
        if not configElement.value:
            configElement.value = [2]
        updateChoices(config.seek.enter_backward, configElement.value)

    config.seek.speeds_backward.addNotifier(updateEnterBackward,
                                            immediate_feedback=False)

    def updateEraseSpeed(el):
        eBackgroundFileEraser.getInstance().setEraseSpeed(int(el.value))

    def updateEraseFlags(el):
        eBackgroundFileEraser.getInstance().setEraseFlags(int(el.value))

    config.misc.erase_speed = ConfigSelection(default="20",
                                              choices=[("10", _("10 MB/s")),
                                                       ("20", _("20 MB/s")),
                                                       ("50", _("50 MB/s")),
                                                       ("100", _("100 MB/s"))])
    config.misc.erase_speed.addNotifier(updateEraseSpeed,
                                        immediate_feedback=False)
    config.misc.erase_flags = ConfigSelection(default="1",
                                              choices=[
                                                  ("0", _("Disable")),
                                                  ("1",
                                                   _("Internal hdd only")),
                                                  ("3", _("Everywhere"))
                                              ])
    config.misc.erase_flags.addNotifier(updateEraseFlags,
                                        immediate_feedback=False)

    if SystemInfo["ZapMode"]:

        def setZapmode(el):
            open(SystemInfo["ZapMode"], "w").write(el.value)

        config.misc.zapmode = ConfigSelection(
            default="mute",
            choices=[("mute", _("Black screen")), ("hold", _("Hold screen")),
                     ("mutetilllock", _("Black screen till locked")),
                     ("holdtilllock", _("Hold till locked"))])
        config.misc.zapmode.addNotifier(setZapmode, immediate_feedback=False)

    if SystemInfo["VFD_scroll_repeats"]:

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

        choicelist = []
        for i in range(1, 11, 1):
            choicelist.append((str(i)))
        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"]:

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

        choicelist = []
        for i in range(0, 1001, 50):
            choicelist.append((str(i)))
        config.usage.vfd_scroll_delay = ConfigSelection(default="150",
                                                        choices=choicelist)
        config.usage.vfd_scroll_delay.addNotifier(scroll_delay,
                                                  immediate_feedback=False)

    if SystemInfo["VFD_initial_scroll_delay"]:

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

        choicelist = []
        for i in range(0, 20001, 500):
            choicelist.append((str(i)))
        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"]:

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

        choicelist = []
        for i in range(0, 20001, 500):
            choicelist.append((str(i)))
        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 SystemInfo["HasForceLNBOn"]:

        def forceLNBPowerChanged(configElement):
            open(SystemInfo["HasForceLNBOn"], "w").write(configElement.value)

        config.misc.forceLnbPower = ConfigSelection(default="on",
                                                    choices=[("on", _("yes")),
                                                             ("off", _("no"))])
        config.misc.forceLnbPower.addNotifier(forceLNBPowerChanged)

    if SystemInfo["HasForceToneburst"]:

        def forceToneBurstChanged(configElement):
            open(SystemInfo["HasForceToneburst"],
                 "w").write(configElement.value)

        config.misc.forceToneBurst = ConfigSelection(default="enable",
                                                     choices=[
                                                         ("enable", _("yes")),
                                                         ("disable", _("no"))
                                                     ])
        config.misc.forceToneBurst.addNotifier(forceToneBurstChanged)

    if SystemInfo["HasBypassEdidChecking"]:

        def setHasBypassEdidChecking(configElement):
            open(SystemInfo["HasBypassEdidChecking"],
                 "w").write(configElement.value)

        config.av.bypassEdidChecking = ConfigSelection(default="00000000",
                                                       choices=[("00000001",
                                                                 _("yes")),
                                                                ("00000000",
                                                                 _("no"))])
        config.av.bypassEdidChecking.addNotifier(setHasBypassEdidChecking)

    if SystemInfo["HasColorspace"]:

        def setHaveColorspace(configElement):
            open(SystemInfo["HasColorspace"], "w").write(configElement.value)

        if SystemInfo["HasColorspaceSimple"]:
            config.av.hdmicolorspace = ConfigSelection(default="Edid(Auto)",
                                                       choices={
                                                           "Edid(Auto)":
                                                           _("Auto"),
                                                           "Hdmi_Rgb":
                                                           _("RGB"),
                                                           "444":
                                                           _("YCbCr444"),
                                                           "422":
                                                           _("YCbCr422"),
                                                           "420": _("YCbCr420")
                                                       })
        else:
            config.av.hdmicolorspace = ConfigSelection(default="auto",
                                                       choices={
                                                           "auto": _("auto"),
                                                           "rgb": _("rgb"),
                                                           "420": _("420"),
                                                           "422": _("422"),
                                                           "444": _("444")
                                                       })
        config.av.hdmicolorspace.addNotifier(setHaveColorspace)

    if SystemInfo["HasColordepth"]:

        def setHaveColordepth(configElement):
            open(SystemInfo["HasColordepth"], "w").write(configElement.value)

        config.av.hdmicolordepth = ConfigSelection(default="auto",
                                                   choices={
                                                       "auto": _("Auto"),
                                                       "8bit": _("8bit"),
                                                       "10bit": _("10bit"),
                                                       "12bit": _("12bit")
                                                   })
        config.av.hdmicolordepth.addNotifier(setHaveColordepth)

    if SystemInfo["HasHDMIpreemphasis"]:

        def setHDMIpreemphasis(configElement):
            open(SystemInfo["HasHDMIpreemphasis"],
                 "w").write(configElement.value)

        config.av.hdmipreemphasis = ConfigSelection(default="off",
                                                    choices=[("on", _("yes")),
                                                             ("off", _("no"))])
        config.av.hdmipreemphasis.addNotifier(setHDMIpreemphasis)

    if SystemInfo["HasColorimetry"]:

        def setColorimetry(configElement):
            open(SystemInfo["HasColorimetry"], "w").write(configElement.value)

        config.av.hdmicolorimetry = ConfigSelection(
            default="auto",
            choices=[("auto", _("Auto")), ("bt2020ncl", _("BT 2020 NCL")),
                     ("bt2020cl", _("BT 2020 CL")), ("bt709", _("BT 709"))])
        config.av.hdmicolorimetry.addNotifier(setColorimetry)

    config.subtitles = ConfigSubsection()
    config.subtitles.ttx_subtitle_colors = ConfigSelection(
        default="1",
        choices=[("0", _("original")), ("1", _("white")), ("2", _("yellow"))])
    config.subtitles.ttx_subtitle_original_position = ConfigYesNo(
        default=False)
    config.subtitles.subtitle_position = ConfigSelection(choices=[
        "0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100",
        "150", "200", "250", "300", "350", "400", "450"
    ],
                                                         default="50")
    config.subtitles.subtitle_alignment = ConfigSelection(choices=[
        ("left", _("left")), ("center", _("center")), ("right", _("right"))
    ],
                                                          default="center")
    config.subtitles.subtitle_rewrap = ConfigYesNo(default=False)
    config.subtitles.colourise_dialogs = ConfigYesNo(default=False)
    config.subtitles.subtitle_borderwidth = ConfigSelection(
        choices=["1", "2", "3", "4", "5"], default="3")
    config.subtitles.subtitle_fontsize = ConfigSelection(
        choices=["%d" % x for x in range(16, 101) if not x % 2], default="40")
    config.subtitles.showbackground = ConfigYesNo(default=False)

    subtitle_delay_choicelist = []
    for i in range(-900000, 1845000, 45000):
        if i == 0:
            subtitle_delay_choicelist.append(("0", _("No delay")))
        else:
            subtitle_delay_choicelist.append(
                (str(i), _("%2.1f sec") % (i / 90000.)))
    config.subtitles.subtitle_noPTSrecordingdelay = ConfigSelection(
        default="315000", choices=subtitle_delay_choicelist)

    config.subtitles.dvb_subtitles_yellow = ConfigYesNo(default=False)
    config.subtitles.dvb_subtitles_original_position = ConfigSelection(
        default="0",
        choices=[("0", _("Original")), ("1", _("Fixed")),
                 ("2", _("Relative"))])
    config.subtitles.dvb_subtitles_centered = ConfigYesNo(default=False)
    config.subtitles.subtitle_bad_timing_delay = ConfigSelection(
        default="0", choices=subtitle_delay_choicelist)
    config.subtitles.dvb_subtitles_backtrans = ConfigSelection(
        default="0",
        choices=[("0", _("No transparency")), ("25", "10%"), ("50", "20%"),
                 ("75", "30%"), ("100", "40%"), ("125", "50%"), ("150", "60%"),
                 ("175", "70%"), ("200", "80%"), ("225", "90%"),
                 ("255", _("Full transparency"))])
    config.subtitles.pango_subtitle_colors = ConfigSelection(
        default="1",
        choices=[("0", _("alternative")), ("1", _("white")),
                 ("2", _("yellow"))])
    config.subtitles.pango_subtitle_fontswitch = ConfigYesNo(default=True)
    config.subtitles.pango_subtitles_delay = ConfigSelection(
        default="0", choices=subtitle_delay_choicelist)
    config.subtitles.pango_subtitles_fps = ConfigSelection(
        default="1",
        choices=[("1", _("Original")), ("23976", _("23.976")),
                 ("24000", _("24")), ("25000", _("25")), ("29970", _("29.97")),
                 ("30000", _("30"))])
    config.subtitles.pango_autoturnon = ConfigYesNo(default=True)

    config.autolanguage = ConfigSubsection()
    audio_language_choices = [
        ("---", _("None")),
        ("orj dos ory org esl qaa und mis mul ORY ORJ Audio_ORJ",
         _("Original")), ("ara", _("Arabic")), ("eus baq", _("Basque")),
        ("bul", _("Bulgarian")), ("hrv", _("Croatian")),
        ("chn sgp", _("Chinese - Simplified")),
        ("twn hkn", _("Chinese - Traditional")), ("ces cze", _("Czech")),
        ("dan", _("Danish")), ("dut ndl nld", _("Dutch")),
        ("eng qaa", _("English")), ("est", _("Estonian")), ("fin",
                                                            _("Finnish")),
        ("fra fre", _("French")), ("deu ger", _("German")),
        ("ell gre", _("Greek")), ("heb", _("Hebrew")), ("hun", _("Hungarian")),
        ("ind", _("Indonesian")), ("ita", _("Italian")), ("lav", _("Latvian")),
        ("lit", _("Lithuanian")), ("ltz", _("Luxembourgish")),
        ("nor", _("Norwegian")), ("fas per fa pes", _("Persian")),
        ("pol", _("Polish")), ("por dub Dub DUB ud1", _("Portuguese")),
        ("ron rum", _("Romanian")),
        ("rus", _("Russian")), ("srp", _("Serbian")), ("slk slo", _("Slovak")),
        ("slv", _("Slovenian")), ("spa", _("Spanish")), ("swe", _("Swedish")),
        ("tha", _("Thai")), ("tur Audio_TUR", _("Turkish")),
        ("ukr Ukr", _("Ukrainian"))
    ]

    def setEpgLanguage(configElement):
        eServiceEvent.setEPGLanguage(configElement.value)

    config.autolanguage.audio_epglanguage = ConfigSelection(
        audio_language_choices[:1] + audio_language_choices[2:], default="---")
    config.autolanguage.audio_epglanguage.addNotifier(setEpgLanguage)

    def setEpgLanguageAlternative(configElement):
        eServiceEvent.setEPGLanguageAlternative(configElement.value)

    config.autolanguage.audio_epglanguage_alternative = ConfigSelection(
        audio_language_choices[:1] + audio_language_choices[2:], default="---")
    config.autolanguage.audio_epglanguage_alternative.addNotifier(
        setEpgLanguageAlternative)

    config.autolanguage.audio_autoselect1 = ConfigSelection(
        choices=audio_language_choices, default="---")
    config.autolanguage.audio_autoselect2 = ConfigSelection(
        choices=audio_language_choices, default="---")
    config.autolanguage.audio_autoselect3 = ConfigSelection(
        choices=audio_language_choices, default="---")
    config.autolanguage.audio_autoselect4 = ConfigSelection(
        choices=audio_language_choices, default="---")
    config.autolanguage.audio_defaultac3 = ConfigYesNo(default=False)
    config.autolanguage.audio_defaultddp = ConfigYesNo(default=False)
    config.autolanguage.audio_usecache = ConfigYesNo(default=True)

    subtitle_language_choices = audio_language_choices[:
                                                       1] + audio_language_choices[
                                                           2:]
    config.autolanguage.subtitle_autoselect1 = ConfigSelection(
        choices=subtitle_language_choices, default="---")
    config.autolanguage.subtitle_autoselect2 = ConfigSelection(
        choices=subtitle_language_choices, default="---")
    config.autolanguage.subtitle_autoselect3 = ConfigSelection(
        choices=subtitle_language_choices, default="---")
    config.autolanguage.subtitle_autoselect4 = ConfigSelection(
        choices=subtitle_language_choices, default="---")
    config.autolanguage.subtitle_hearingimpaired = ConfigYesNo(default=False)
    config.autolanguage.subtitle_defaultimpaired = ConfigYesNo(default=False)
    config.autolanguage.subtitle_defaultdvb = ConfigYesNo(default=False)
    config.autolanguage.subtitle_usecache = ConfigYesNo(default=True)
    config.autolanguage.equal_languages = ConfigSelection(default="15",
                                                          choices=[
                                                              ("0", _("None")),
                                                              ("1", "1"),
                                                              ("2", "2"),
                                                              ("3", "1,2"),
                                                              ("4", "3"),
                                                              ("5", "1,3"),
                                                              ("6", "2,3"),
                                                              ("7", "1,2,3"),
                                                              ("8", "4"),
                                                              ("9", "1,4"),
                                                              ("10", "2,4"),
                                                              ("11", "1,2,4"),
                                                              ("12", "3,4"),
                                                              ("13", "1,3,4"),
                                                              ("14", "2,3,4"),
                                                              ("15", _("All"))
                                                          ])

    config.streaming = ConfigSubsection()
    config.streaming.stream_ecm = ConfigYesNo(default=False)
    config.streaming.descramble = ConfigYesNo(default=True)
    config.streaming.descramble_client = ConfigYesNo(default=False)
    config.streaming.stream_eit = ConfigYesNo(default=True)
    config.streaming.stream_ait = ConfigYesNo(default=True)
    config.streaming.authentication = ConfigYesNo(default=False)

    config.mediaplayer = ConfigSubsection()
    config.mediaplayer.useAlternateUserAgent = ConfigYesNo(default=False)
    config.mediaplayer.alternateUserAgent = ConfigText(default="")

    config.misc.softcam_setup = ConfigSubsection()
    config.misc.softcam_setup.extension_menu = ConfigYesNo(default=True)
示例#18
0
def InitUsageConfig():
	config.usage = ConfigSubsection()
	config.usage.showdish = ConfigYesNo(default = True)
	config.misc.showrotorposition = ConfigSelection(default = "no", choices = [("no", _("no")), ("yes", _("yes")), ("withtext", _("with text")), ("tunername", _("with tuner name"))])
	config.usage.multibouquet = ConfigYesNo(default = True)
	config.usage.volumestep = ConfigSelection(default = "2", choices = [("2"), ("5")])
	config.usage.alternative_number_mode = ConfigYesNo(default = False)

	config.usage.hide_number_markers = ConfigYesNo(default = True)

	config.usage.servicetype_icon_mode = ConfigSelection(default = "0", choices = [("0", _("None")), ("1", _("Left from servicename")), ("2", _("Right from servicename"))])
	config.usage.crypto_icon_mode = ConfigSelection(default = "0", choices = [("0", _("None")), ("1", _("Left from servicename")), ("2", _("Right from servicename"))])
	config.usage.record_indicator_mode = ConfigSelection(default = "0", choices = [("0", _("None")), ("1", _("Left from servicename")), ("2", _("Right from servicename")), ("3", _("Red colored"))])

	choicelist = [("-1", _("Disable"))]
	for i in range(0,1300,100):
		choicelist.append((str(i), ngettext("%d pixel wide", "%d pixels wide", i) % i))
	config.usage.servicelist_column = ConfigSelection(default="-1", choices=choicelist)

	config.usage.service_icon_enable = ConfigYesNo(default = False)
	config.usage.servicelist_cursor_behavior = ConfigSelection(default = "standard", choices = [
		("standard", _("Standard")),
		("keep", _("Keep service")),
		("reverseB", _("Reverse bouquet buttons")),
		("keep reverseB", _("Keep service") + " + " + _("Reverse bouquet buttons"))])

	config.usage.multiepg_ask_bouquet = ConfigYesNo(default = False)

	config.usage.quickzap_bouquet_change = ConfigYesNo(default = False)
	config.usage.e1like_radio_mode = ConfigYesNo(default = True)
	choicelist = [("0", _("No timeout"))]
	for i in range(1, 12):
		choicelist.append((str(i), ngettext("%d second", "%d seconds", i) % i))
	config.usage.infobar_timeout = ConfigSelection(default = "5", choices = choicelist)
	config.usage.show_infobar_on_zap = ConfigYesNo(default = True)
	config.usage.show_infobar_on_skip = ConfigYesNo(default = True)
	config.usage.show_infobar_on_event_change = ConfigYesNo(default = False)
	config.usage.show_second_infobar = ConfigSelection(default = None, choices = [(None, _("None"))] + choicelist + [("EPG",_("EPG"))])
	config.usage.show_simple_second_infobar = ConfigYesNo(default = True)
	config.usage.infobar_frontend_source = ConfigSelection(default = "tuner", choices = [("settings", _("Settings")), ("tuner", _("Tuner"))])
	config.usage.oldstyle_zap_controls = ConfigYesNo(default = False)
	config.usage.oldstyle_channel_select_controls = ConfigYesNo(default = False)
	config.usage.zap_with_ch_buttons = ConfigYesNo(default = True)
	config.usage.ok_is_channelselection = ConfigYesNo(default = True)
	config.usage.volume_instead_of_channelselection = ConfigYesNo(default = False)
	config.usage.channelselection_preview = ConfigYesNo(default = False)
	config.usage.show_spinner = ConfigYesNo(default = True)
	config.usage.enable_tt_caching = ConfigYesNo(default = True)
	choicelist = []
	for i in (10, 30):
		choicelist.append((str(i), ngettext("%d second", "%d seconds", i) % i))
	for i in (60, 120, 300, 600, 1200, 1800):
		m = i / 60
		choicelist.append((str(i), ngettext("%d minute", "%d minutes", m) % m))
	for i in (3600, 7200, 14400):
		h = i / 3600
		choicelist.append((str(i), ngettext("%d hour", "%d hours", h) % h))
	config.usage.hdd_standby = ConfigSelection(default = "300", choices = [("0", _("No standby"))] + choicelist)
	config.usage.output_12V = ConfigSelection(default = "do not change", choices = [
		("do not change", _("Do not change")), ("off", _("Off")), ("on", _("On")) ])

	config.usage.pip_zero_button = ConfigSelection(default = "standard", choices = [
		("standard", _("Standard")), ("swap", _("Swap PiP and main picture")),
		("swapstop", _("Move PiP to main picture")), ("stop", _("Stop PiP")) ])
	config.usage.pip_hideOnExit = ConfigSelection(default = "without popup", choices = [
		("no", _("No")), ("popup", _("With popup")), ("without popup", _("Without popup")) ])
	choicelist = [("-1", _("Disabled")), ("0", _("No timeout"))]
	for i in [60, 300, 600, 900, 1800, 2700, 3600]:
		m = i/60
		choicelist.append((str(i), ngettext("%d minute", "%d minutes", m) % m))
	config.usage.pip_last_service_timeout = ConfigSelection(default = "0", choices = choicelist)

	config.usage.default_path = ConfigText(default = resolveFilename(SCOPE_HDD))
	config.usage.timer_path = ConfigText(default = "<default>")
	config.usage.instantrec_path = ConfigText(default = "<default>")
	config.usage.timeshift_path = ConfigText(default = "/media/hdd/")
	config.usage.allowed_timeshift_paths = ConfigLocations(default = ["/media/hdd/"])

	config.usage.movielist_trashcan = ConfigYesNo(default=True)
	config.usage.movielist_trashcan_days = ConfigNumber(default=8)
	config.usage.movielist_trashcan_reserve = ConfigNumber(default=40)
	config.usage.on_movie_start = ConfigSelection(default = "resume", choices = [
		("ask yes", _("Ask user") + " " + _("default") + " " + _("yes")),
		("ask no", _("Ask user") + " " + _("default") + " " + _("no")),
		("resume", _("Resume from last position")),
		("beginning", _("Start from the beginning"))])
	config.usage.on_movie_stop = ConfigSelection(default = "movielist", choices = [
		("ask", _("Ask user")), ("movielist", _("Return to movie list")), ("quit", _("Return to previous service")) ])
	config.usage.on_movie_eof = ConfigSelection(default = "movielist", choices = [
		("ask", _("Ask user")), ("movielist", _("Return to movie list")), ("quit", _("Return to previous service")), ("pause", _("Pause movie at end")), ("playlist", _("Play next (return to movie list)")),
		("playlistquit", _("Play next (return to previous service)")), ("loop", _("Continues play (loop)")), ("repeatcurrent", _("Repeat"))])
	config.usage.next_movie_msg = ConfigYesNo(default = True)
	config.usage.last_movie_played = ConfigText()
	config.usage.leave_movieplayer_onExit = ConfigSelection(default = "popup", choices = [
		("no", _("No")), ("popup", _("With popup")), ("without popup", _("Without popup")), ("movielist", _("Return to movie list")) ])

	config.usage.setup_level = ConfigSelection(default = "expert", choices = [
		("simple", _("Simple")),
		("intermediate", _("Intermediate")),
		("expert", _("Expert")) ])

	config.usage.startup_to_standby = ConfigSelection(default = "no", choices = [
		("no", _("No")),
		("yes", _("Yes")),
		("except", _("No, except Wakeup timer")) ])

	config.usage.wakeup_menu = ConfigNothing()
	config.usage.wakeup_enabled = ConfigYesNo(default = False)
	config.usage.wakeup_day = ConfigSubDict()
	config.usage.wakeup_time = ConfigSubDict()
	for i in range(7):
		config.usage.wakeup_day[i] = ConfigEnableDisable(default = False)
		config.usage.wakeup_time[i] = ConfigClock(default = ((6 * 60 + 0) * 60))

	config.usage.on_long_powerpress = ConfigSelection(default = "show_menu", choices = [
		("show_menu", _("Show shutdown menu")),
		("shutdown", _("Immediate shutdown")),
		("standby", _("Standby")) ] )

	config.usage.on_short_powerpress = ConfigSelection(default = "standby", choices = [
		("show_menu", _("Show shutdown menu")),
		("shutdown", _("Immediate shutdown")),
		("standby", _("Standby")) ] )

	choicelist = [("0", _("Do nothing"))]
	for i in range(3600, 21601, 3600):
		h = abs(i / 3600)
		h = ngettext("%d hour", "%d hours", h) % h
		choicelist.append((str(i), _("Standby in ") + h))
	config.usage.inactivity_timer = ConfigSelection(default = "0", choices = choicelist)
	config.usage.inactivity_timer_blocktime = ConfigYesNo(default = True)
	config.usage.inactivity_timer_blocktime_begin = ConfigClock(default = time.mktime((0, 0, 0, 18, 0, 0, 0, 0, 0)))
	config.usage.inactivity_timer_blocktime_end = ConfigClock(default = time.mktime((0, 0, 0, 23, 0, 0, 0, 0, 0)))
	config.usage.inactivity_timer_blocktime_extra = ConfigYesNo(default = False)
	config.usage.inactivity_timer_blocktime_extra_begin = ConfigClock(default = time.mktime((0, 0, 0, 6, 0, 0, 0, 0, 0)))
	config.usage.inactivity_timer_blocktime_extra_end = ConfigClock(default = time.mktime((0, 0, 0, 9, 0, 0, 0, 0, 0)))

	choicelist = [("0", _("Disabled")),("event_standby", _("Standby after current event"))]
	for i in range(900, 7201, 900):
		m = abs(i / 60)
		m = ngettext("%d minute", "%d minutes", m) % m
		choicelist.append((str(i), _("Standby in ") + m))
	config.usage.sleep_timer = ConfigSelection(default = "0", choices = choicelist)

	choicelist = [("0", _("Disabled"))]
	for i in [60, 300, 600] + range(900, 7201, 900):
		m = abs(i / 60)
		m = ngettext("%d minute", "%d minutes", m) % m
		choicelist.append((str(i), _("after ") + m))
	config.usage.standby_to_shutdown_timer = ConfigSelection(default = "0", choices = choicelist)
	config.usage.standby_to_shutdown_timer_blocktime = ConfigYesNo(default = True)
	config.usage.standby_to_shutdown_timer_blocktime_begin = ConfigClock(default = time.mktime((0, 0, 0, 6, 0, 0, 0, 0, 0)))
	config.usage.standby_to_shutdown_timer_blocktime_end = ConfigClock(default = time.mktime((0, 0, 0, 23, 0, 0, 0, 0, 0)))

	choicelist = [("0", _("Disabled"))]
	for m in (1, 5, 10, 15, 30, 60):
		choicelist.append((str(m * 60), ngettext("%d minute", "%d minutes", m) % m))
	config.usage.screen_saver = ConfigSelection(default = "300", choices = choicelist)

	config.usage.check_timeshift = ConfigYesNo(default = True)

	choicelist = [("0", _("Disabled"))]
	for i in (2, 3, 4, 5, 10, 20, 30):
		choicelist.append((str(i), ngettext("%d second", "%d seconds", i) % i))
	for i in (60, 120, 300):
		m = i / 60
		choicelist.append((str(i), ngettext("%d minute", "%d minutes", m) % m))
	config.usage.timeshift_start_delay = ConfigSelection(default = "0", choices = choicelist)

	config.usage.alternatives_priority = ConfigSelection(default = "0", choices = [
		("0", "DVB-S/-C/-T"),
		("1", "DVB-S/-T/-C"),
		("2", "DVB-C/-S/-T"),
		("3", "DVB-C/-T/-S"),
		("4", "DVB-T/-C/-S"),
		("5", "DVB-T/-S/-C"),
		("127", _("No priority")) ])

	config.usage.remote_fallback_enabled = ConfigYesNo(default = False)
	config.usage.remote_fallback_recording_enabled = ConfigYesNo(default = False)
	config.usage.remote_fallback = ConfigText(default = "", fixed_size = False)
	config.usage.show_timer_conflict_warning = ConfigYesNo(default = True)

	dvbs_nims = [("-2", _("Disabled"))]
	dvbt_nims = [("-2", _("Disabled"))]
	dvbc_nims = [("-2", _("Disabled"))]
	nims = [("-1", _("auto"))]
	config.usage.frontend_priority = ConfigSelection(default = "-1", choices = list(nims))
	nims.insert(0,("-2", _("Disabled")))
	config.usage.recording_frontend_priority = ConfigSelection(default = "-2", choices = nims)
	config.usage.frontend_priority_dvbs = ConfigSelection(default = "-2", choices = list(dvbs_nims))
	dvbs_nims.insert(1,("-1", _("auto")))
	config.usage.recording_frontend_priority_dvbs = ConfigSelection(default = "-2", choices = dvbs_nims)
	config.usage.frontend_priority_dvbt = ConfigSelection(default = "-2", choices = list(dvbt_nims))
	dvbt_nims.insert(1,("-1", _("auto")))
	config.usage.recording_frontend_priority_dvbt = ConfigSelection(default = "-2", choices = dvbt_nims)
	config.usage.frontend_priority_dvbc = ConfigSelection(default = "-2", choices = list(dvbc_nims))
	dvbc_nims.insert(1,("-1", _("auto")))
	config.usage.recording_frontend_priority_dvbc = ConfigSelection(default = "-2", choices = dvbc_nims)
	SystemInfo["DVB-S_priority_tuner_available"] = len(dvbs_nims) > 3 and (len(dvbt_nims) > 2 or len(dvbc_nims) > 2)
	SystemInfo["DVB-T_priority_tuner_available"] = len(dvbt_nims) > 3 and (len(dvbs_nims) > 2 or len(dvbc_nims) > 2)
	SystemInfo["DVB-C_priority_tuner_available"] = len(dvbc_nims) > 3 and (len(dvbs_nims) > 2 or len(dvbt_nims) > 2)

	config.misc.disable_background_scan = ConfigYesNo(default = False)
	config.usage.show_event_progress_in_servicelist = ConfigSelection(default = 'barright', choices = [
		('barleft', _("Progress bar left")),
		('barright', _("Progress bar right")),
		('percleft', _("Percentage left")),
		('percright', _("Percentage right")),
		('no', _("No")) ])
	config.usage.show_channel_numbers_in_servicelist = ConfigYesNo(default = True)

	config.usage.blinking_display_clock_during_recording = ConfigYesNo(default = False)

	config.usage.show_message_when_recording_starts = ConfigYesNo(default = True)

	config.usage.load_length_of_movies_in_moviellist = ConfigYesNo(default = True)
	config.usage.show_icons_in_movielist = ConfigSelection(default = 'i', choices = [
		('o', _("Off")),
		('p', _("Progress")),
		('s', _("Small progress")),
		('i', _("Icons")),
	])
	config.usage.movielist_unseen = ConfigYesNo(default = False)

	config.usage.swap_snr_on_osd = ConfigYesNo(default = False)

	config.usage.hide_zap_errors = ConfigYesNo(default = False)
	config.usage.hide_ci_messages = ConfigYesNo(default = True)
	config.usage.show_cryptoinfo = ConfigYesNo(default = True)
	config.usage.show_eit_nownext = ConfigYesNo(default = True)
	config.usage.show_vcr_scart = ConfigYesNo(default = False)
	config.usage.show_update_disclaimer = ConfigYesNo(default = True)
	config.usage.pic_resolution = ConfigSelection(default = None, choices = [(None, _("Same resolution as skin")), ("(720, 576)","720x576"), ("(1280, 720)", "1280x720"), ("(1920, 1080)", "1920x1080")])

	if SystemInfo["Fan"]:
		choicelist = [('off', _("Off")), ('on', _("On")), ('auto', _("Auto"))]
		if os.path.exists("/proc/stb/fp/fan_choices"):
			choicelist = [x for x in choicelist if x[0] in open("/proc/stb/fp/fan_choices", "r").read().strip().split(" ")]
		config.usage.fan = ConfigSelection(choicelist)

	if SystemInfo["FanPWM"]:
		config.usage.fanspeed = ConfigSlider(default=127, increment=8, limits=(0, 255))

	if SystemInfo["StandbyLED"]:
		config.usage.standbyLED = ConfigYesNo(default = True)

	if SystemInfo["WakeOnLAN"]:
		config.usage.wakeOnLAN = ConfigYesNo(default = False)

	config.epg = ConfigSubsection()
	config.epg.eit = ConfigYesNo(default = True)
	config.epg.mhw = ConfigYesNo(default = False)
	config.epg.freesat = ConfigYesNo(default = True)
	config.epg.viasat = ConfigYesNo(default = True)
	config.epg.netmed = ConfigYesNo(default = True)
	config.epg.virgin = ConfigYesNo(default = False)
	config.misc.showradiopic = ConfigYesNo(default = True)

	config.epg.histminutes = ConfigSelectionNumber(min = 0, max = 120, stepwidth = 15, default = 0, wraparound = True)

	config.usage.keymap = ConfigText(default = resolveFilename(SCOPE_SKIN , "keymap.xml"))
	config.usage.keytrans = ConfigText(default = resolveFilename(SCOPE_SKIN ,"keytranslation.xml"))

	config.seek = ConfigSubsection()
	config.seek.selfdefined_13 = ConfigNumber(default=15)
	config.seek.selfdefined_46 = ConfigNumber(default=60)
	config.seek.selfdefined_79 = ConfigNumber(default=300)

	config.seek.speeds_forward = ConfigSet(default=[2, 4, 8, 16, 32, 64, 128], choices=[2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
	config.seek.speeds_backward = ConfigSet(default=[2, 4, 8, 16, 32, 64, 128], choices=[1, 2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
	config.seek.speeds_slowmotion = ConfigSet(default=[2, 4, 8], choices=[2, 4, 6, 8, 12, 16, 25])

	config.seek.enter_forward = ConfigSelection(default = "2", choices = ["2", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128"])
	config.seek.enter_backward = ConfigSelection(default = "1", choices = ["1", "2", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128"])

	config.seek.on_pause = ConfigSelection(default = "play", choices = [
		("play", _("Play")),
		("step", _("Single step (GOP)")),
		("last", _("Last speed")) ])

	config.usage.timerlist_finished_timer_position = ConfigSelection(default = "end", choices = [("beginning", _("At beginning")), ("end", _("At end"))])

	config.misc.erase_speed = ConfigSelection(default="20", choices = [
		("10", "10 MB/s"),
		("20", "20 MB/s"),
		("50", "50 MB/s"),
		("100", "100 MB/s")])
	config.misc.erase_flags = ConfigSelection(default="1", choices = [
		("0", _("Disable")),
		("1", _("Internal hdd only")),
		("3", _("Everywhere"))])

	if SystemInfo["ZapMode"]:
		config.misc.zapmode = ConfigSelection(default = "mute", choices = [
			("mute", _("Black screen")), ("hold", _("Hold screen")), ("mutetilllock", _("Black screen till locked")), ("holdtilllock", _("Hold till locked"))])

	if SystemInfo["VFD_scroll_repeats"]:
		choicelist = []
		for i in range(1, 11, 1):
			choicelist.append((str(i)))
		config.usage.vfd_scroll_repeats = ConfigSelection(default = "3", choices = choicelist)

	if SystemInfo["VFD_scroll_delay"]:
		choicelist = []
		for i in range(0, 1001, 50):
			choicelist.append((str(i)))
		config.usage.vfd_scroll_delay = ConfigSelection(default = "150", choices = choicelist)

	if SystemInfo["VFD_initial_scroll_delay"]:
		choicelist = []
		for i in range(0, 20001, 500):
			choicelist.append((str(i)))
		config.usage.vfd_initial_scroll_delay = ConfigSelection(default = "1000", choices = choicelist)

	if SystemInfo["VFD_final_scroll_delay"]:
		choicelist = []
		for i in range(0, 20001, 500):
			choicelist.append((str(i)))
		config.usage.vfd_final_scroll_delay = ConfigSelection(default = "1000", choices = choicelist)

	config.subtitles = ConfigSubsection()
	config.subtitles.ttx_subtitle_colors = ConfigSelection(default = "1", choices = [
		("0", _("original")),
		("1", _("white")),
		("2", _("yellow")) ])
	config.subtitles.ttx_subtitle_original_position = ConfigYesNo(default = False)
	config.subtitles.subtitle_position = ConfigSelection( choices = ["0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100", "150", "200", "250", "300", "350", "400", "450"], default = "50")
	config.subtitles.subtitle_alignment = ConfigSelection(choices = [("left", _("left")), ("center", _("center")), ("right", _("right"))], default = "center")
	config.subtitles.subtitle_rewrap = ConfigYesNo(default = False)
	config.subtitles.colourise_dialogs = ConfigYesNo(default = False)
	config.subtitles.subtitle_borderwidth = ConfigSelection(choices = ["1", "2", "3", "4", "5"], default = "3")
	config.subtitles.subtitle_fontsize  = ConfigSelection(choices = ["%d" % x for x in range(16,101) if not x % 2], default = "40")
	config.subtitles.showbackground = ConfigYesNo(default = False)

	subtitle_delay_choicelist = []
	for i in range(-900000, 1845000, 45000):
		if i == 0:
			subtitle_delay_choicelist.append(("0", _("No delay")))
		else:
			subtitle_delay_choicelist.append((str(i), "%2.1f sec" % (i / 90000.)))
	config.subtitles.subtitle_noPTSrecordingdelay = ConfigSelection(default = "315000", choices = subtitle_delay_choicelist)

	config.subtitles.dvb_subtitles_yellow = ConfigYesNo(default = False)
	config.subtitles.dvb_subtitles_original_position = ConfigSelection(default = "0", choices = [("0", _("Original")), ("1", _("Fixed")), ("2", _("Relative"))])
	config.subtitles.dvb_subtitles_centered = ConfigYesNo(default = True)
	config.subtitles.subtitle_bad_timing_delay = ConfigSelection(default = "0", choices = subtitle_delay_choicelist)
	config.subtitles.dvb_subtitles_backtrans = ConfigSelection(default = "0", choices = [
		("0", _("No transparency")),
		("25", "10%"),
		("50", "20%"),
		("75", "30%"),
		("100", "40%"),
		("125", "50%"),
		("150", "60%"),
		("175", "70%"),
		("200", "80%"),
		("225", "90%"),
		("255", _("Full transparency"))])
	config.subtitles.pango_subtitle_colors = ConfigSelection(default = "1", choices = [
		("0", _("alternative")),
		("1", _("white")),
		("2", _("yellow")) ])
	config.subtitles.pango_subtitle_fontswitch = ConfigYesNo(default = True)
	config.subtitles.pango_subtitles_delay = ConfigSelection(default = "0", choices = subtitle_delay_choicelist)
	config.subtitles.pango_subtitles_fps = ConfigSelection(default = "1", choices = [
		("1", _("Original")),
		("23976", _("23.976")),
		("24000", _("24")),
		("25000", _("25")),
		("29970", _("29.97")),
		("30000", _("30"))])
	config.subtitles.pango_autoturnon = ConfigYesNo(default = True)

	config.autolanguage = ConfigSubsection()
	audio_language_choices=[
		("---", _("None")),
		("orj dos ory org esl qaa und mis mul ORY ORJ Audio_ORJ", _("Original")),
		("ara", _("Arabic")),
		("eus baq", _("Basque")),
		("bul", _("Bulgarian")),
		("hrv", _("Croatian")),
		("ces cze", _("Czech")),
		("dan", _("Danish")),
		("dut ndl", _("Dutch")),
		("eng qaa", _("English")),
		("est", _("Estonian")),
		("fin", _("Finnish")),
		("fra fre", _("French")),
		("deu ger", _("German")),
		("ell gre", _("Greek")),
		("heb", _("Hebrew")),
		("hun", _("Hungarian")),
		("ita", _("Italian")),
		("lav", _("Latvian")),
		("lit", _("Lithuanian")),
		("ltz", _("Luxembourgish")),
		("nor", _("Norwegian")),
		("pol", _("Polish")),
		("por dub DUB", _("Portuguese")),
		("fas per", _("Persian")),
		("ron rum", _("Romanian")),
		("rus", _("Russian")),
		("srp", _("Serbian")),
		("slk slo", _("Slovak")),
		("slv", _("Slovenian")),
		("spa", _("Spanish")),
		("swe", _("Swedish")),
		("tha", _("Thai")),
		("tur Audio_TUR", _("Turkish")),
		("ukr Ukr", _("Ukrainian"))]

	config.autolanguage.audio_epglanguage = ConfigSelection(audio_language_choices[:1] + audio_language_choices [2:], default="---")

	config.autolanguage.audio_epglanguage_alternative = ConfigSelection(audio_language_choices[:1] + audio_language_choices [2:], default="---")

	config.autolanguage.audio_autoselect1 = ConfigSelection(choices=audio_language_choices, default="---")
	config.autolanguage.audio_autoselect2 = ConfigSelection(choices=audio_language_choices, default="---")
	config.autolanguage.audio_autoselect3 = ConfigSelection(choices=audio_language_choices, default="---")
	config.autolanguage.audio_autoselect4 = ConfigSelection(choices=audio_language_choices, default="---")
	config.autolanguage.audio_defaultac3 = ConfigYesNo(default = False)
	config.autolanguage.audio_defaultddp = ConfigYesNo(default = False)
	config.autolanguage.audio_usecache = ConfigYesNo(default = True)

	subtitle_language_choices = audio_language_choices[:1] + audio_language_choices [2:]
	config.autolanguage.subtitle_autoselect1 = ConfigSelection(choices=subtitle_language_choices, default="---")
	config.autolanguage.subtitle_autoselect2 = ConfigSelection(choices=subtitle_language_choices, default="---")
	config.autolanguage.subtitle_autoselect3 = ConfigSelection(choices=subtitle_language_choices, default="---")
	config.autolanguage.subtitle_autoselect4 = ConfigSelection(choices=subtitle_language_choices, default="---")
	config.autolanguage.subtitle_hearingimpaired = ConfigYesNo(default = False)
	config.autolanguage.subtitle_defaultimpaired = ConfigYesNo(default = False)
	config.autolanguage.subtitle_defaultdvb = ConfigYesNo(default = False)
	config.autolanguage.subtitle_usecache = ConfigYesNo(default = True)
	config.autolanguage.equal_languages = ConfigSelection(default = "15", choices = [
		("0", _("None")),("1", "1"),("2", "2"),("3", "1,2"),
		("4", "3"),("5", "1,3"),("6", "2,3"),("7", "1,2,3"),
		("8", "4"),("9", "1,4"),("10", "2,4"),("11", "1,2,4"),
		("12", "3,4"),("13", "1,3,4"),("14", "2,3,4"),("15", _("All"))])

	config.streaming = ConfigSubsection()
	config.streaming.stream_ecm = ConfigYesNo(default = False)
	config.streaming.descramble = ConfigYesNo(default = True)
	config.streaming.descramble_client = ConfigYesNo(default = False)
	config.streaming.stream_eit = ConfigYesNo(default = True)
	config.streaming.stream_ait = ConfigYesNo(default = True)
	config.streaming.authentication = ConfigYesNo(default = False)
示例#19
0
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.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.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)
        elif config.av.videoport and config.av.videoport.value in ("RCA"):
            iAVSwitch.setColorFormat(0)
        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 SystemInfo["Canedidchecking"]:

        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="00000000")
        config.av.bypass_edid_checking.addNotifier(setEDIDBypass)
    else:
        config.av.bypass_edid_checking = ConfigNothing()

    if SystemInfo["havecolorspace"]:

        def setHDMIColorspace(configElement):
            try:
                f = open("/proc/stb/video/hdmi_colorspace", "w")
                f.write(configElement.value)
                f.close()
            except:
                pass

        if getBoxType() in ('vuzero4k', 'vusolo4k', 'vuuno4k', 'vuuno4kse',
                            'vuultimo4k'):
            config.av.hdmicolorspace = ConfigSelection(choices={
                "Edid(Auto)": _("Auto"),
                "Hdmi_Rgb": _("RGB"),
                "444": _("YCbCr444"),
                "422": _("YCbCr422"),
                "420": _("YCbCr420")
            },
                                                       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 SystemInfo["havecolorimetry"]:

        def setHDMIColorimetry(configElement):
            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 SystemInfo["haveboxmode"]:

        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":
            _("PIP enabled, no HDR"),
            "1":
            _("HDR, 12bit 4:2:0/4:2:2, no PIP")
        },
                                            default="12")
        config.av.boxmode.addNotifier(setBoxmode)
    else:
        config.av.boxmode = ConfigNothing()

    if SystemInfo["havehdmicolordepth"]:

        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 SystemInfo["Canaudiosource"]:

        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 SystemInfo["Can3DSurround"]:

        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 SystemInfo["Can3DSpeaker"]:

        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 SystemInfo["CanAutoVolume"]:

        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()

    if SystemInfo["supportPcmMultichannel"]:

        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)

    if SystemInfo["CanDownmixAC3"]:

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

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

    if SystemInfo["CanDownmixDTS"]:

        def setDTSDownmix(configElement):
            open("/proc/stb/audio/dts",
                 "w").write(configElement.value and "downmix" or "passthrough")

        config.av.downmix_dts = ConfigYesNo(default=True)
        config.av.downmix_dts.addNotifier(setDTSDownmix)

    if SystemInfo["CanDownmixAAC"]:

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

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

    if SystemInfo["CanAACTranscode"]:

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

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

    if SystemInfo["HasScaler_sharpness"]:

        def setScaler_sharpness(config):
            myval = int(config.value)
            try:
                print "[VideoHardware] 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 "[VideoHardware] 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()
示例#20
0
def InitAVSwitch():
    config.av = ConfigSubsection()
    config.av.yuvenabled = ConfigBoolean(default=False)
    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.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="4_3_letterbox")

    config.av.aspect = ConfigSelection(choices={
        "4_3": _("4:3"),
        "16_9": _("16:9"),
        "16_10": _("16:10"),
        "auto": _("Automatic")
    },
                                       default="auto")
    config.av.policy_169 = ConfigSelection(
        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")
        },
        default="letterbox")
    config.av.policy_43 = ConfigSelection(
        choices={
            # TRANSLATORS: (aspect ratio policy: black bars on left/right) in doubt, keep english term.
            "pillarbox": _("Pillarbox"),
            # TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term
            "panscan": _("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)
            "scale": _("Just Scale")
        },
        default="pillarbox")
    config.av.tvsystem = ConfigSelection(choices={
        "pal": _("PAL"),
        "ntsc": _("NTSC"),
        "multinorm": _("multinorm")
    },
                                         default="pal")
    config.av.wss = ConfigEnableDisable(default=True)
    config.av.defaultac3 = ConfigYesNo(default=False)
    config.av.generalAC3delay = ConfigNumber(default=0)
    config.av.generalPCMdelay = ConfigNumber(default=0)
    config.av.vcrswitch = ConfigEnableDisable(default=False)

    iAVSwitch = AVSwitch()

    def setColorFormat(configElement):
        map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
        iAVSwitch.setColorFormat(map[configElement.value])

    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])

    def setSystem(configElement):
        map = {"pal": 0, "ntsc": 1, "multinorm": 2}
        iAVSwitch.setSystem(map[configElement.value])

    def setWSS(configElement):
        iAVSwitch.setAspectWSS()

    # this will call the "setup-val" initial
    config.av.colorformat.addNotifier(setColorFormat)
    config.av.aspectratio.addNotifier(setAspectRatio)
    config.av.tvsystem.addNotifier(setSystem)
    config.av.wss.addNotifier(setWSS)

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

    try:
        can_downmix = open("/proc/stb/audio/ac3_choices",
                           "r").read()[:-1].find("downmix") != -1
    except:
        can_downmix = False

    SystemInfo["CanDownmixAC3"] = can_downmix
    if can_downmix:

        def setAC3Downmix(configElement):
            open("/proc/stb/audio/ac3",
                 "w").write(configElement.value and "downmix" or "passthrough")

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

    try:
        can_osd_alpha = open("/proc/stb/video/alpha", "r") and True or False
    except:
        can_osd_alpha = False

    SystemInfo["CanChangeOsdAlpha"] = can_osd_alpha

    def setAlpha(config):
        open("/proc/stb/video/alpha", "w").write(str(config.value))

    if can_osd_alpha:
        config.av.osd_alpha = ConfigSlider(default=255, limits=(0, 255))
        config.av.osd_alpha.addNotifier(setAlpha)
示例#21
0
def InitAVSwitch():
    config.av = ConfigSubsection()
    if getBoxType() == "vuduo" or getBoxType().startswith("ixuss"):
        config.av.yuvenabled = ConfigBoolean(default=False)
    else:
        config.av.yuvenabled = ConfigBoolean(default=True)
    colorformat_choices = {"cvbs": _("CVBS")}

    # when YUV, Scart or S-Video is not support by HW, don't let the user select it
    if SystemInfo["HasYPbPr"]:
        colorformat_choices["yuv"] = _("YPbPr")
    if SystemInfo["HasScart"]:
        colorformat_choices["rgb"] = _("RGB")
    if SystemInfo["HasSVideo"]:
        colorformat_choices["svideo"] = _("S-Video")

    config.av.colorformat = ConfigSelection(choices=colorformat_choices,
                                            default="cvbs")
    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="auto")
    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: scale as close to fullscreen as possible)
        "scale": _("Just scale")
    }
    try:
        if "full" in open("/proc/stb/video/policy2_choices").read():
            # TRANSLATORS: (aspect ratio policy: display as fullscreen, even if the content aspect ratio does not match the screen ratio)
            policy2_choices.update({"full": _("Full screen")})
    except:
        pass
    try:
        if "auto" in open("/proc/stb/video/policy2_choices").read():
            # TRANSLATORS: (aspect ratio policy: automatically select the best aspect ratio mode)
            policy2_choices.update({"auto": _("Auto")})
    except:
        pass
    config.av.policy_169 = ConfigSelection(choices=policy2_choices,
                                           default="scale")
    policy_choices = {
        # TRANSLATORS: (aspect ratio policy: black bars on left/right) in doubt, keep english term.
        "pillarbox": _("Pillarbox"),
        # TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term
        "panscan": _("Pan&scan"),
        # TRANSLATORS: (aspect ratio policy: scale as close to fullscreen as possible)
        "scale": _("Just scale")
    }
    try:
        if "nonlinear" in open("/proc/stb/video/policy_choices").read():
            # TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching the left/right)
            policy_choices.update({"nonlinear": _("Nonlinear")})
    except:
        pass
    try:
        if "full" in open("/proc/stb/video/policy_choices").read():
            # TRANSLATORS: (aspect ratio policy: display as fullscreen, even if the content aspect ratio does not match the screen ratio)
            policy_choices.update({"full": _("Full screen")})
    except:
        pass
    try:
        if "auto" in open("/proc/stb/video/policy_choices").read():
            # TRANSLATORS: (aspect ratio policy: automatically select the best aspect ratio mode)
            policy_choices.update({"auto": _("Auto")})
    except:
        pass
    config.av.policy_43 = ConfigSelection(choices=policy_choices,
                                          default="scale")
    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)

    iAVSwitch = AVSwitch()

    def setColorFormat(configElement):
        if getBoxType() == "et6x00":
            map = {"cvbs": 3, "rgb": 3, "svideo": 2, "yuv": 3}
        elif SystemInfo["GigaBlueQuad"] 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])

    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])

    def setSystem(configElement):
        map = {"pal": 0, "ntsc": 1, "multinorm": 2}
        iAVSwitch.setSystem(map[configElement.value])

    def setWSS(configElement):
        iAVSwitch.setAspectWSS()

    # this will call the "setup-val" initial
    config.av.colorformat.addNotifier(setColorFormat)
    config.av.aspectratio.addNotifier(setAspectRatio)
    config.av.tvsystem.addNotifier(setSystem)
    config.av.wss.addNotifier(setWSS)

    iAVSwitch.setInput("ENCODER")  # init on startup
    if SystemInfo["GigaBlueQuad"] or getBoxType() in (
            "et5x00", "et6x00", "ixussone", "ixusszero", "axodin", "axodinc",
            "starsatlx", "galaxym6", "geniuse3hd", "evoe3hd", "axase3",
            "axase3c", "optimussos1", "optimussos2", "gb800seplus",
            "gb800ueplus", "gbultrase", "gbultraue", "gbultraueh",
            "twinboxlcd"):
        detected = False
    else:
        detected = eAVSwitch.getInstance().haveScartSwitch()

    SystemInfo["ScartSwitch"] = detected

    if SystemInfo["CanDownmixAC3"]:

        def setAC3Downmix(configElement):
            if SystemInfo["DreamBoxAudio"]:
                open("/proc/stb/audio/ac3", "w").write(configElement.value)
            else:
                open("/proc/stb/audio/ac3",
                     "w").write(configElement.value and "downmix"
                                or "passthrough")

        if SystemInfo["DreamBoxAudio"]:
            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 SystemInfo["CanAC3plusTranscode"]:

        def setAC3plusTranscode(configElement):
            open("/proc/stb/audio/ac3plus", "w").write(configElement.value)

        if SystemInfo["DreamBoxAudio"]:
            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 SystemInfo["GigaBlueAudio"]:
            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)

    if SystemInfo["CanDownmixDTS"]:

        def setDTSDownmix(configElement):
            open("/proc/stb/audio/dts",
                 "w").write(configElement.value and "downmix" or "passthrough")

        config.av.downmix_dts = ConfigYesNo(default=True)
        config.av.downmix_dts.addNotifier(setDTSDownmix)

    if SystemInfo["CanDTSHD"]:

        def setDTSHD(configElement):
            open("/proc/stb/audio/dtshd", "w").write(configElement.value)

        if SystemInfo["DreamBoxDTSAudio"]:
            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)

    if SystemInfo["CanWMAPRO"]:

        def setWMAPRO(configElement):
            open("/proc/stb/audio/wmapro", "w").write(configElement.value)

        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)

    if SystemInfo["CanDownmixAAC"]:

        def setAACDownmix(configElement):
            if SystemInfo["DreamBoxAudio"] or SystemInfo["GigaBlueAudio"]:
                open("/proc/stb/audio/aac", "w").write(configElement.value)
            else:
                open("/proc/stb/audio/aac",
                     "w").write(configElement.value and "downmix"
                                or "passthrough")

        if SystemInfo["DreamBoxAudio"]:
            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 SystemInfo["GigaBlueAudio"]:
            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)

    if SystemInfo["CanDownmixAACPlus"]:

        def setAACDownmixPlus(configElement):
            open("/proc/stb/audio/aacplus", "w").write(configElement.value)

        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 SystemInfo["CanAACTranscode"]:

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

        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 SystemInfo["CanBTAudio"]:

        def setBTAudio(configElement):
            open("/proc/stb/audio/btaudio", "w").write(configElement.value)

        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 SystemInfo["CanBTAudioDelay"]:

        def setBTAudioDelay(configElement):
            open("/proc/stb/audio/btaudio",
                 "w").write(format(configElement.value * 90, "x"))

        config.av.btaudiodelay = ConfigSelectionNumber(-1000,
                                                       1000,
                                                       5,
                                                       default=0)
        config.av.btaudiodelay.addNotifier(setBTAudioDelay)
    else:
        config.av.btaudiodelay = ConfigNothing()

    if SystemInfo["CanChangeOsdAlpha"]:

        def setAlpha(config):
            open("/proc/stb/video/alpha", "w").write(str(config.value))

        config.av.osd_alpha = ConfigSlider(default=255, limits=(0, 255))
        config.av.osd_alpha.addNotifier(setAlpha)

    if SystemInfo["ScalerSharpness"]:

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

        if SystemInfo["GigaBlueQuad"]:
            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())

    if SystemInfo["HasMultichannelPCM"]:

        def setMultichannelPCM(configElement):
            open(SystemInfo["HasMultichannelPCM"],
                 "w").write(configElement.value and "enable" or "disable")

        config.av.multichannel_pcm = ConfigYesNo(default=False)
        config.av.multichannel_pcm.addNotifier(setMultichannelPCM)

    if SystemInfo["HasAutoVolume"]:

        def setAutoVolume(configElement):
            open(SystemInfo["HasAutoVolume"], "w").write(configElement.value)

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

    if SystemInfo["HasAutoVolumeLevel"]:

        def setAutoVolumeLevel(configElement):
            open(SystemInfo["HasAutoVolumeLevel"],
                 "w").write(configElement.value and "enabled" or "disabled")

        config.av.autovolumelevel = ConfigYesNo(default=False)
        config.av.autovolumelevel.addNotifier(setAutoVolumeLevel)

    if SystemInfo["Has3DSurround"]:

        def set3DSurround(configElement):
            open(SystemInfo["Has3DSurround"], "w").write(configElement.value)

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

    if SystemInfo["Has3DSpeaker"]:

        def set3DSpeaker(configElement):
            open(SystemInfo["Has3DSpeaker"], "w").write(configElement.value)

        config.av.speaker_3d = ConfigSelection(default="center",
                                               choices=[("center",
                                                         _("center")),
                                                        ("wide", _("wide")),
                                                        ("extrawide",
                                                         _("extra wide"))])
        config.av.speaker_3d.addNotifier(set3DSpeaker)

    if SystemInfo["Has3DSurroundSpeaker"]:

        def set3DSurroundSpeaker(configElement):
            open(SystemInfo["Has3DSurroundSpeaker"],
                 "w").write(configElement.value)

        config.av.surround_3d_speaker = ConfigSelection(
            default="disabled",
            choices=[("disabled", _("off")), ("center", _("center")),
                     ("wide", _("wide")), ("extrawide", _("extra wide"))])
        config.av.surround_3d_speaker.addNotifier(set3DSurroundSpeaker)

    if SystemInfo["Has3DSurroundSoftLimiter"]:

        def set3DSurroundSoftLimiter(configElement):
            open(SystemInfo["Has3DSurroundSoftLimiter"],
                 "w").write(configElement.value and "enabled" or "disabled")

        config.av.surround_softlimiter_3d = ConfigYesNo(default=False)
        config.av.surround_softlimiter_3d.addNotifier(set3DSurroundSoftLimiter)

    if SystemInfo["HDMIAudioSource"]:

        def setHDMIAudioSource(configElement):
            open(SystemInfo["HDMIAudioSource"], "w").write(configElement.value)

        config.av.hdmi_audio_source = ConfigSelection(default="pcm",
                                                      choices=[
                                                          ("pcm", _("PCM")),
                                                          ("spdif", _("SPDIF"))
                                                      ])
        config.av.hdmi_audio_source.addNotifier(setHDMIAudioSource)

    def setVolumeStepsize(configElement):
        eDVBVolumecontrol.getInstance().setVolumeSteps(int(
            configElement.value))

    config.av.volume_stepsize = ConfigSelectionNumber(1, 10, 1, default=5)
    config.av.volume_stepsize.addNotifier(setVolumeStepsize)
示例#22
0
def InitAVSwitch():
    config.av = ConfigSubsection()
    config.av.yuvenabled = ConfigBoolean(default=True)
    colorformat_choices = {"cvbs": "CVBS"}

    # when YUV, Scart or S-Video is not support by HW, don't let the user select it
    if SystemInfo["HasYPbPr"]:
        colorformat_choices["yuv"] = "YPbPr"
    if SystemInfo["HasScart"]:
        colorformat_choices["rgb"] = "RGB"
    if SystemInfo["HasSVideo"]:
        colorformat_choices["svideo"] = "S-Video"

    config.av.colorformat = ConfigSelection(choices=colorformat_choices,
                                            default="cvbs")
    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="auto")
    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: scale as close to fullscreen as possible)
        "scale": _("Just scale")
    }
    try:
        if "full" in open("/proc/stb/video/policy2_choices").read():
            # TRANSLATORS: (aspect ratio policy: display as fullscreen, even if the content aspect ratio does not match the screen ratio)
            policy2_choices.update({"full": _("Full screen")})
    except:
        pass
    try:
        if "auto" in open("/proc/stb/video/policy2_choices").read():
            # TRANSLATORS: (aspect ratio policy: automatically select the best aspect ratio mode)
            policy2_choices.update({"auto": _("Auto")})
    except:
        pass
    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.
        "pillarbox": _("Pillarbox"),
        # TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term
        "panscan": _("Pan&scan"),
        # TRANSLATORS: (aspect ratio policy: scale as close to fullscreen as possible)
        "scale": _("Just scale")
    }
    try:
        if "nonlinear" in open("/proc/stb/video/policy_choices").read():
            # TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching the left/right)
            policy_choices.update({"nonlinear": _("Nonlinear")})
    except:
        pass
    try:
        if "full" in open("/proc/stb/video/policy_choices").read():
            # TRANSLATORS: (aspect ratio policy: display as fullscreen, even if the content aspect ratio does not match the screen ratio)
            policy_choices.update({"full": _("Full screen")})
    except:
        pass
    try:
        if "auto" in open("/proc/stb/video/policy_choices").read():
            # TRANSLATORS: (aspect ratio policy: automatically select the best aspect ratio mode)
            policy_choices.update({"auto": _("Auto")})
    except:
        pass
    config.av.policy_43 = ConfigSelection(choices=policy_choices,
                                          default="pillarbox")
    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)

    iAVSwitch = AVSwitch()

    def setColorFormat(configElement):
        map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
        iAVSwitch.setColorFormat(map[configElement.value])

    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])

    def setSystem(configElement):
        map = {"pal": 0, "ntsc": 1, "multinorm": 2}
        iAVSwitch.setSystem(map[configElement.value])

    def setWSS(configElement):
        iAVSwitch.setAspectWSS()

    # this will call the "setup-val" initial
    config.av.colorformat.addNotifier(setColorFormat)
    config.av.aspectratio.addNotifier(setAspectRatio)
    config.av.tvsystem.addNotifier(setSystem)
    config.av.wss.addNotifier(setWSS)

    iAVSwitch.setInput("ENCODER")  # init on startup

    if getMachineBuild() in ('gb7325', ):
        detected = eAVSwitch.getInstance().haveScartSwitch()
    else:
        detected = False

    SystemInfo["ScartSwitch"] = detected

    if SystemInfo["HasMultichannelPCM"]:

        def setPCMMultichannel(configElement):
            open(SystemInfo["HasMultichannelPCM"],
                 "w").write(configElement.value and "enable" or "disable")

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

    if SystemInfo["CanDownmixAC3"]:

        def setAC3Downmix(configElement):
            open("/proc/stb/audio/ac3",
                 "w").write(configElement.value and "downmix" or "passthrough")

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

    if SystemInfo["CanDownmixAC3Plus"]:

        def setAC3PlusDownmix(configElement):
            open("/proc/stb/audio/ac3plus",
                 "w").write(configElement.value and "downmix" or "passthrough")

        config.av.downmix_ac3plus = ConfigYesNo(default=True)
        config.av.downmix_ac3plus.addNotifier(setAC3PlusDownmix)

    if SystemInfo["CanDownmixDTS"]:

        def setDTSDownmix(configElement):
            open("/proc/stb/audio/dts",
                 "w").write(configElement.value and "downmix" or "passthrough")

        config.av.downmix_dts = ConfigYesNo(default=True)
        config.av.downmix_dts.addNotifier(setDTSDownmix)

    if SystemInfo["CanDownmixDTSHD"]:

        def setDTSHDDownmix(configElement):
            open("/proc/stb/audio/dtshd",
                 "w").write(configElement.value and "downmix" or "passthrough")

        config.av.downmix_dtshd = ConfigYesNo(default=True)
        config.av.downmix_dtshd.addNotifier(setDTSHDDownmix)

    if SystemInfo["CanDownmixAAC"]:

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

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

    if SystemInfo["CanDownmixAACPlus"]:

        def setAACPlusDownmix(configElement):
            open("/proc/stb/audio/aacplus",
                 "w").write(configElement.value and "downmix" or "passthrough")

        config.av.downmix_aacplus = ConfigYesNo(default=True)
        config.av.downmix_aacplus.addNotifier(setAACPlusDownmix)

    if SystemInfo["CanDownmixWMApro"]:

        def setWMAproDownmix(configElement):
            open("/proc/stb/audio/wmapro", "w").write(configElement.value)

        config.av.downmix_wmapro = ConfigSelection(
            default="downmix",
            choices=[("downmix", _("Downmix")),
                     ("passthrough", _("Passthrough")),
                     ("multichannel", _("convert to multi channel PCM")),
                     ("hdmi_best", _("use best, controlled by HDMI"))])
        config.av.downmix_wmapro.addNotifier(setWMAproDownmix)

    if SystemInfo["CanAACTranscode"]:

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

        config.av.transcode_aac = ConfigSelection(default="off",
                                                  choices=[("off", _("off")),
                                                           ("ac3", _("AC3")),
                                                           ("dts", _("DTS"))])
        config.av.transcode_aac.addNotifier(setAACTranscode)

    try:
        SystemInfo["CanChangeOsdAlpha"] = open("/proc/stb/video/alpha",
                                               "r") and True or False
    except:
        SystemInfo["CanChangeOsdAlpha"] = False

    if SystemInfo["CanChangeOsdAlpha"]:

        def setAlpha(config):
            open("/proc/stb/video/alpha", "w").write(str(config.value))

        config.av.osd_alpha = ConfigSlider(default=255,
                                           increment=5,
                                           limits=(20, 255))
        config.av.osd_alpha.addNotifier(setAlpha)

    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
                open("/proc/stb/vmpeg/0/pep_scaler_sharpness",
                     "w").write("%0.8X" % myval)
                open("/proc/stb/vmpeg/0/pep_apply", "w").write("1")
            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())

    if SystemInfo["HasMultichannelPCM"]:

        def setMultichannelPCM(configElement):
            open(SystemInfo["HasMultichannelPCM"],
                 "w").write(configElement.value and "enable" or "disable")

        config.av.multichannel_pcm = ConfigYesNo(default=False)
        config.av.multichannel_pcm.addNotifier(setMultichannelPCM)

    if SystemInfo["HasAutoVolume"]:

        def setAutoVolume(configElement):
            open(SystemInfo["HasAutoVolume"], "w").write(configElement.value)

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

    if SystemInfo["HasAutoVolumeLevel"]:

        def setAutoVolumeLevel(configElement):
            open(SystemInfo["HasAutoVolumeLevel"],
                 "w").write(configElement.value and "enabled" or "disabled")

        config.av.autovolumelevel = ConfigYesNo(default=False)
        config.av.autovolumelevel.addNotifier(setAutoVolumeLevel)

    if SystemInfo["Has3DSurround"]:

        def set3DSurround(configElement):
            open(SystemInfo["Has3DSurround"], "w").write(configElement.value)

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

    if SystemInfo["Has3DSpeaker"]:

        def set3DSpeaker(configElement):
            open(SystemInfo["Has3DSpeaker"], "w").write(configElement.value)

        config.av.speaker_3d = ConfigSelection(default="center",
                                               choices=[("center",
                                                         _("center")),
                                                        ("wide", _("wide")),
                                                        ("extrawide",
                                                         _("extra wide"))])
        config.av.speaker_3d.addNotifier(set3DSpeaker)

    if SystemInfo["Has3DSurroundSpeaker"]:

        def set3DSurroundSpeaker(configElement):
            open(SystemInfo["Has3DSurroundSpeaker"],
                 "w").write(configElement.value)

        config.av.surround_3d_speaker = ConfigSelection(
            default="disabled",
            choices=[("disabled", _("off")), ("center", _("center")),
                     ("wide", _("wide")), ("extrawide", _("extra wide"))])
        config.av.surround_3d_speaker.addNotifier(set3DSurroundSpeaker)

    if SystemInfo["Has3DSurroundSoftLimiter"]:

        def set3DSurroundSoftLimiter(configElement):
            open(SystemInfo["Has3DSurroundSoftLimiter"],
                 "w").write(configElement.value and "enabled" or "disabled")

        config.av.surround_softlimiter_3d = ConfigYesNo(default=False)
        config.av.surround_softlimiter_3d.addNotifier(set3DSurroundSoftLimiter)

    if SystemInfo["HDMIAudioSource"]:

        def setHDMIAudioSource(configElement):
            open(SystemInfo["HDMIAudioSource"], "w").write(configElement.value)

        config.av.hdmi_audio_source = ConfigSelection(default="pcm",
                                                      choices=[("pcm", "PCM"),
                                                               ("spdif",
                                                                "SPDIF")])
        config.av.hdmi_audio_source.addNotifier(setHDMIAudioSource)
示例#23
0
def InitAVSwitch():
    config.av = ConfigSubsection()
    config.av.yuvenabled = ConfigBoolean(default=True)
    colorformat_choices = {"cvbs": "CVBS"}

    # when YUV, Scart or S-Video is not support by HW, don't let the user select it
    if SystemInfo["HasYPbPr"]:
        colorformat_choices["yuv"] = "YPbPr"
    if SystemInfo["HasScart"]:
        colorformat_choices["rgb"] = "RGB"
    if SystemInfo["HasSVideo"]:
        colorformat_choices["svideo"] = "S-Video"

    config.av.colorformat = ConfigSelection(choices=colorformat_choices,
                                            default="cvbs")
    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="auto")
    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: scale as close to fullscreen as possible)
        "scale": _("Just scale")
    }
    try:
        if "full" in open("/proc/stb/video/policy2_choices").read():
            # TRANSLATORS: (aspect ratio policy: display as fullscreen, even if the content aspect ratio does not match the screen ratio)
            policy2_choices.update({"full": _("Full screen")})
    except:
        pass
    try:
        if "auto" in open("/proc/stb/video/policy2_choices").read():
            # TRANSLATORS: (aspect ratio policy: automatically select the best aspect ratio mode)
            policy2_choices.update({"auto": _("Auto")})
    except:
        pass
    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.
        "pillarbox": _("Pillarbox"),
        # TRANSLATORS: (aspect ratio policy: cropped content on left/right) in doubt, keep english term
        "panscan": _("Pan&scan"),
        # TRANSLATORS: (aspect ratio policy: scale as close to fullscreen as possible)
        "scale": _("Just scale")
    }
    try:
        if "nonlinear" in open("/proc/stb/video/policy_choices").read():
            # TRANSLATORS: (aspect ratio policy: display as fullscreen, with stretching the left/right)
            policy_choices.update({"nonlinear": _("Nonlinear")})
    except:
        pass
    try:
        if "full" in open("/proc/stb/video/policy_choices").read():
            # TRANSLATORS: (aspect ratio policy: display as fullscreen, even if the content aspect ratio does not match the screen ratio)
            policy_choices.update({"full": _("Full screen")})
    except:
        pass
    try:
        if "auto" in open("/proc/stb/video/policy_choices").read():
            # TRANSLATORS: (aspect ratio policy: automatically select the best aspect ratio mode)
            policy_choices.update({"auto": _("Auto")})
    except:
        pass
    config.av.policy_43 = ConfigSelection(choices=policy_choices,
                                          default="pillarbox")
    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)

    iAVSwitch = AVSwitch()

    def setColorFormat(configElement):
        map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
        iAVSwitch.setColorFormat(map[configElement.value])

    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])

    def setSystem(configElement):
        map = {"pal": 0, "ntsc": 1, "multinorm": 2}
        iAVSwitch.setSystem(map[configElement.value])

    def setWSS(configElement):
        iAVSwitch.setAspectWSS()

    # this will call the "setup-val" initial
    config.av.colorformat.addNotifier(setColorFormat)
    config.av.aspectratio.addNotifier(setAspectRatio)
    config.av.tvsystem.addNotifier(setSystem)
    config.av.wss.addNotifier(setWSS)

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

    def ch(node):
        return node, pnD.get(node) if pnD.get(node) else node

    # dictionary ... "proc_node_name" : _("human translatable texts"),
    pnD = {
        "ac3": _("AC3"),
        "dac": _("DAC"),
        "dts": _("DTS"),
        "downmix": _("Downmix"),
        "extrawide": _("extrawide"),
        "force_ac3": _("convert to AC3"),
        "force_dts": _("convert to DTS"),
        "hdmi": _("HDMI"),
        "hdmi_best": _("use best / controlled by HDMI"),
        "multichannel": _("convert to multi-channel PCM"),
        "none": _("off"),
        "off": _("Off"),
        "on": _("On"),
        "passthrough": _("Passthrough"),
        "spdif": _("SPDIF"),
        "use_hdmi_cacenter": _("use HDMI cacenter"),
        "use_hdmi_caps": _("controlled by HDMI"),
        "wide": _("wide"),
    }

    def readChoices(procx, choices, default):
        try:
            with open(procx, "r") as myfile:
                procChoices = myfile.read().strip()
        except:
            procChoices = ""
        if procChoices:
            choiceslist = procChoices.split(" ")
            choices = [(ch(item)) for item in choiceslist]
            default = choiceslist[0]
        return (choices, default)

    if SystemInfo["HasMultichannelPCM"]:

        def setMultichannelPCM(configElement):
            open(SystemInfo["HasMultichannelPCM"],
                 "w").write(configElement.value and "enable" or "disable")

        config.av.multichannel_pcm = ConfigYesNo(default=False)
        config.av.multichannel_pcm.addNotifier(setMultichannelPCM)

    if SystemInfo["CanDownmixAC3"]:

        def setAC3Downmix(configElement):
            open("/proc/stb/audio/ac3", "w").write(configElement.value)

        choices = [(ch("downmix")), (ch("passthrough"))]
        default = "downmix"
        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/ac3_choices"
            (choices, default) = readChoices(f, choices, default)
        config.av.downmix_ac3 = ConfigSelection(choices=choices,
                                                default=default)
        config.av.downmix_ac3.addNotifier(setAC3Downmix)

    if SystemInfo["CanAC3Transcode"]:

        def setAC3plusTranscode(configElement):
            open("/proc/stb/audio/ac3plus", "w").write(configElement.value)

        choices = [(ch("use_hdmi_caps")), (ch("force_ac3"))]
        default = "force_ac3"
        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/ac3plus_choices"
            (choices, default) = readChoices(f, choices, default)
        config.av.transcodeac3plus = ConfigSelection(choices=choices,
                                                     default=default)
        config.av.transcodeac3plus.addNotifier(setAC3plusTranscode)

    if SystemInfo["CanDownmixDTS"]:

        def setDTSDownmix(configElement):
            open("/proc/stb/audio/dts", "w").write(configElement.value)

        choices = [(ch("downmix")), (ch("passthrough"))]
        default = "downmix"
        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/dts_choices"
            (choices, default) = readChoices(f, choices, default)
        config.av.downmix_dts = ConfigSelection(choices=choices,
                                                default=default)
        config.av.downmix_dts.addNotifier(setDTSDownmix)

    if SystemInfo["CanDTSHD"]:

        def setDTSHD(configElement):
            open("/proc/stb/audio/dtshd", "w").write(configElement.value)

        choices = [(ch("downmix")), (ch("force_dts")), (ch("use_hdmi_caps")),
                   (ch("multichannel")), (ch("hdmi_best"))]
        default = "downmix"
        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/dtshd_choices"
            (choices, default) = readChoices(f, choices, default)
        config.av.dtshd = ConfigSelection(choices=choices, default=default)
        config.av.dtshd.addNotifier(setDTSHD)

    if SystemInfo["CanDownmixAAC"]:

        def setAACDownmix(configElement):
            open("/proc/stb/audio/aac", "w").write(configElement.value)

        choices = [(ch("downmix")), (ch("passthrough"))]
        default = "downmix"
        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/aac_choices"
            (choices, default) = readChoices(f, choices, default)
        config.av.downmix_aac = ConfigSelection(choices=choices,
                                                default=default)
        config.av.downmix_aac.addNotifier(setAACDownmix)

    if SystemInfo["CanDownmixAACPlus"]:

        def setAACDownmixPlus(configElement):
            open("/proc/stb/audio/aacplus", "w").write(configElement.value)

        choices = [(ch("downmix")), (ch("passthrough")), (ch("multichannel")),
                   (ch("force_ac3")), (ch("force_dts")),
                   (ch("use_hdmi_cacenter")), (ch("wide")), (ch("extrawide"))]
        default = "downmix"
        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/aacplus_choices"
            (choices, default) = readChoices(f, choices, default)
        config.av.downmix_aacplus = ConfigSelection(choices=choices,
                                                    default=default)
        config.av.downmix_aacplus.addNotifier(setAACDownmixPlus)

    if SystemInfo["CanAACTranscode"]:

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

        choices = [(ch("off")), (ch("ac3")), (ch("dts"))]
        default = "off"
        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/aac_transcode_choices"
            (choices, default) = readChoices(f, choices, default)
        config.av.transcodeaac = ConfigSelection(choices=choices,
                                                 default=default)
        config.av.transcodeaac.addNotifier(setAACTranscode)

    if SystemInfo["CanWMAPRO"]:

        def setWMAPRO(configElement):
            open("/proc/stb/audio/wmapro", "w").write(configElement.value)

        choices = [(ch("downmix")), (ch("passthrough")), (ch("multichannel")),
                   (ch("hdmi_best"))]
        default = "downmix"
        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/wmapro_choices"
            (choices, default) = readChoices(f, choices, default)
        config.av.wmapro = ConfigSelection(choices=choices, default=default)
        config.av.wmapro.addNotifier(setWMAPRO)

    if SystemInfo["CanBTAudio"]:

        def setBTAudio(configElement):
            open("/proc/stb/audio/btaudio", "w").write(configElement.value)

        choices = [(ch("off")), (ch("on"))]
        default = "off"
        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/btaudio_choices"
            (choices, default) = readChoices(f, choices, default)
        config.av.btaudio = ConfigSelection(choices=choices, default="off")
        config.av.btaudio.addNotifier(setBTAudio)

    if SystemInfo["CanBTAudioDelay"]:

        def setBTAudioDelay(configElement):
            try:
                with open(SystemInfo["CanBTAudioDelay"], "w") as fd:
                    fd.write(format(configElement.value * 90, "x"))
            except:
                SystemInfo["CanBTAudioDelay"] = False

        config.av.btaudiodelay = ConfigSelectionNumber(-1000,
                                                       1000,
                                                       5,
                                                       default=0)
        config.av.btaudiodelay.addNotifier(setBTAudioDelay)

    try:
        SystemInfo["CanChangeOsdAlpha"] = open("/proc/stb/video/alpha",
                                               "r") and True or False
    except:
        SystemInfo["CanChangeOsdAlpha"] = False

    if SystemInfo["CanChangeOsdAlpha"]:

        def setAlpha(config):
            open("/proc/stb/video/alpha", "w").write(str(config.value))

        config.av.osd_alpha = ConfigSlider(default=255, limits=(0, 255))
        config.av.osd_alpha.addNotifier(setAlpha)

    if SystemInfo["HasScaler_sharpness"]:

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

        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 SystemInfo["HasAutoVolume"]:

        def setAutoVolume(configElement):
            open(SystemInfo["HasAutoVolume"], "w").write(configElement.value)

        choices = [(ch("none")), (ch("hdmi")), (ch("spdif")), (ch("dac"))]
        default = "none"
        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/avl_choices"
            (choices, default) = readChoices(f, choices, default)
        config.av.autovolume = ConfigSelection(choices=choices,
                                               default=default)
        config.av.autovolume.addNotifier(setAutoVolume)

    if SystemInfo["HasAutoVolumeLevel"]:

        def setAutoVolumeLevel(configElement):
            open(SystemInfo["HasAutoVolumeLevel"],
                 "w").write(configElement.value and "enabled" or "disabled")

        config.av.autovolumelevel = ConfigYesNo(default=False)
        config.av.autovolumelevel.addNotifier(setAutoVolumeLevel)

    if SystemInfo["Has3DSurround"]:

        def set3DSurround(configElement):
            open(SystemInfo["Has3DSurround"], "w").write(configElement.value)

        choices = [(ch("none")), (ch("hdmi")), (ch("spdif")), (ch("dac"))]
        default = "none"
        if SystemInfo["CanProc"]:
            f = "/proc/stb/audio/3d_surround_choices"
            (choices, default) = readChoices(f, choices, default)
        config.av.surround_3d = ConfigSelection(choices=choices,
                                                default=default)
        config.av.surround_3d.addNotifier(set3DSurround)

    if SystemInfo["Has3DSpeaker"]:

        def set3DSpeaker(configElement):
            open(SystemInfo["Has3DSpeaker"], "w").write(configElement.value)

        config.av.speaker_3d = ConfigSelection(default="center",
                                               choices=[("center",
                                                         _("center")),
                                                        ("wide", _("wide")),
                                                        ("extrawide",
                                                         _("extra wide"))])
        config.av.speaker_3d.addNotifier(set3DSpeaker)

    if SystemInfo["Has3DSurroundSpeaker"]:

        def set3DSurroundSpeaker(configElement):
            open(SystemInfo["Has3DSurroundSpeaker"],
                 "w").write(configElement.value)

        config.av.surround_3d_speaker = ConfigSelection(
            default="disabled",
            choices=[("disabled", _("off")), ("center", _("center")),
                     ("wide", _("wide")), ("extrawide", _("extra wide"))])
        config.av.surround_3d_speaker.addNotifier(set3DSurroundSpeaker)

    if SystemInfo["Has3DSurroundSoftLimiter"]:

        def set3DSurroundSoftLimiter(configElement):
            open(SystemInfo["Has3DSurroundSoftLimiter"],
                 "w").write(configElement.value and "enabled" or "disabled")

        config.av.surround_softlimiter_3d = ConfigYesNo(default=False)
        config.av.surround_softlimiter_3d.addNotifier(set3DSurroundSoftLimiter)

    if SystemInfo["HDMIAudioSource"]:

        def setHDMIAudioSource(configElement):
            open(SystemInfo["HDMIAudioSource"], "w").write(configElement.value)

        config.av.hdmi_audio_source = ConfigSelection(default="pcm",
                                                      choices=[("pcm", "PCM"),
                                                               ("spdif",
                                                                "SPDIF")])
        config.av.hdmi_audio_source.addNotifier(setHDMIAudioSource)

    def setVolumeStepsize(configElement):
        eDVBVolumecontrol.getInstance().setVolumeSteps(int(
            configElement.value))

    config.av.volume_stepsize = ConfigSelectionNumber(1, 10, 1, default=5)
    config.av.volume_stepsize.addNotifier(setVolumeStepsize)

    if SystemInfo["HasBypassEdidChecking"]:

        def setHasBypassEdidChecking(configElement):
            open(SystemInfo["HasBypassEdidChecking"],
                 "w").write("00000001" if configElement.value else "00000000")

        config.av.bypassEdidChecking = ConfigYesNo(default=False)
        config.av.bypassEdidChecking.addNotifier(setHasBypassEdidChecking)

    if SystemInfo["HasColorspace"]:

        def setHaveColorspace(configElement):
            open(SystemInfo["HasColorspace"], "w").write(configElement.value)

        if SystemInfo["HasColorspaceSimple"]:
            choices = [("Edid(Auto)", "auto"), ("Hdmi_Rgb", "RGB"),
                       ("444", "YCbCr 4:4:4"), ("422", "YCbCr 4:2:2"),
                       ("420", "YCbCr 4:2:0")]
            default = "Edid(Auto)"
        else:
            choices = [("auto", "auto"), ("rgb", "RGB"), ("420", "4:2:0"),
                       ("422", "4:2:2"), ("444", "4:4:4")]
            default = "auto"
        if os.path.exists("/proc/stb/video/hdmi_colorspace_choices"
                          ) and SystemInfo["CanProc"]:
            f = "/proc/stb/video/hdmi_colorspace_choices"
            (choices, default) = readChoices(f, choices, default)
        config.av.hdmicolorspace = ConfigSelection(choices=choices,
                                                   default=default)
        config.av.hdmicolorspace.addNotifier(setHaveColorspace)

    if SystemInfo["HasColordepth"]:

        def setHaveColordepth(configElement):
            open(SystemInfo["HasColordepth"], "w").write(configElement.value)

        choices = [("auto", "auto"), ("8bit", "8bit"), ("10bit", "10bit"),
                   ("12bit", "12bit")]
        default = "auto"
        if os.path.exists("/proc/stb/video/hdmi_colordepth_choices"
                          ) and SystemInfo["CanProc"]:
            f = "/proc/stb/video/hdmi_colordepth_choices"
            (choices, default) = readChoices(f, choices, default)
        config.av.hdmicolordepth = ConfigSelection(choices=choices,
                                                   default=default)
        config.av.hdmicolordepth.addNotifier(setHaveColordepth)

    if SystemInfo["HasHDMIpreemphasis"]:

        def setHDMIpreemphasis(configElement):
            open(SystemInfo["HasHDMIpreemphasis"],
                 "w").write("on" if configElement.value else "off")

        config.av.hdmipreemphasis = ConfigYesNo(default=False)
        config.av.hdmipreemphasis.addNotifier(setHDMIpreemphasis)

    if SystemInfo["HasColorimetry"]:

        def setColorimetry(configElement):
            open(SystemInfo["HasColorimetry"], "w").write(configElement.value)

        choices = [("auto", "auto"), ("bt2020ncl", "BT 2020 NCL"),
                   ("bt2020cl", "BT 2020 CL"), ("bt709", "BT 709")]
        default = "auto"
        if os.path.exists("/proc/stb/video/hdmi_colorimetry_choices"
                          ) and SystemInfo["CanProc"]:
            f = "/proc/stb/video/hdmi_colorimetry_choices"
            (choices, default) = readChoices(f, choices, default)
        config.av.hdmicolorimetry = ConfigSelection(choices=choices,
                                                    default=default)
        config.av.hdmicolorimetry.addNotifier(setColorimetry)

    if SystemInfo["HasHdrType"]:

        def setHdmiHdrType(configElement):
            open(SystemInfo["HasHdrType"], "w").write(configElement.value)

        config.av.hdmihdrtype = ConfigSelection(default="auto",
                                                choices={
                                                    "auto": _("auto"),
                                                    "none": "SDR",
                                                    "hdr10": "HDR10",
                                                    "hlg": "HLG",
                                                    "dolby": "Dolby Vision"
                                                })
        config.av.hdmihdrtype.addNotifier(setHdmiHdrType)

    if SystemInfo["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("1" if configElement.value else "0")

        config.av.allow_12bit = ConfigYesNo(default=False)
        config.av.allow_12bit.addNotifier(setDisable12Bit)

        def setDisable10Bit(configElement):
            open("/proc/stb/video/disable_10bit",
                 "w").write("1" if configElement.value else "0")

        config.av.allow_10bit = ConfigYesNo(default=False)
        config.av.allow_10bit.addNotifier(setDisable10Bit)
示例#24
0
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, limits=(0, 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 = ConfigEnableDisable()
    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=500,
                                                    max=15000,
                                                    stepwidth=500,
                                                    default=1000,
                                                    wraparound=True)

    # SD - 480 / 576, standard definition
    # ED - 720, enhanced definition
    # HD - 1080, high definition

    # Supported conversions:
    #    * -> 1080i60, 720p60, 480i60, 480p60
    # *?50 -> 1080i50, 720p50, 576i50, 576p50
    # *p25 -> 1080i50, 720p50, 576i50, 576p50 (1080p25 ?)
    # *p30 -> 1080p30
    # *p24 -> 1080p24

    if iAVSwitch.supports2160p:
        conv_60 = ["2160p", "1080p", "1080i", "720p", "480p", "480i"]
        conv_50 = ["2160p50", "1080p50", "1080i50", "720p50", "576p", "576i"
                   ] + conv_60
        conv_30 = ["2160p30", "1080p30"] + conv_60
        conv_24 = ["2160p24", "1080p24"] + conv_60
    elif iAVSwitch.supports1080p:
        conv_60 = ["1080p", "1080i", "720p", "480p", "480i"]
        conv_50 = ["1080p50", "1080i50", "720p50", "576p", "576i"] + conv_60
        conv_30 = ["1080p30"] + conv_60
        conv_24 = ["1080p24"] + conv_60
    else:
        conv_60 = ["1080i", "720p", "480p", "480i"]
        conv_50 = ["1080i50", "720p50", "576p", "576i"] + conv_60
        conv_30 = ["1080p30"] + conv_60
        conv_24 = ["1080p24"] + conv_60

    config.av.autores_sd24 = ConfigSelection(choices=conv_24)
    config.av.autores_sd25 = ConfigSelection(choices=conv_50)
    config.av.autores_sd30 = ConfigSelection(choices=conv_30)
    config.av.autores_sd50i = ConfigSelection(choices=conv_50)
    config.av.autores_sd50p = ConfigSelection(choices=conv_50)
    config.av.autores_sd60i = ConfigSelection(choices=conv_60)
    config.av.autores_sd60p = ConfigSelection(choices=conv_60)
    config.av.autores_ed24 = ConfigSelection(choices=conv_24)
    config.av.autores_ed25 = ConfigSelection(choices=conv_50)
    config.av.autores_ed30 = ConfigSelection(choices=conv_30)
    config.av.autores_ed50 = ConfigSelection(choices=conv_50)
    config.av.autores_ed60 = ConfigSelection(choices=conv_60)
    config.av.autores_hd24 = ConfigSelection(choices=conv_24)
    config.av.autores_hd25 = ConfigSelection(choices=conv_50)
    config.av.autores_hd30 = ConfigSelection(choices=conv_30)
    config.av.autores_hd50 = ConfigSelection(choices=conv_50)
    config.av.autores_hd60 = ConfigSelection(choices=conv_60)
    config.av.autores_uhd24 = ConfigSelection(choices=conv_24)
    config.av.autores_uhd25 = ConfigSelection(choices=conv_50)
    config.av.autores_uhd30 = ConfigSelection(choices=conv_30)
    config.av.autores_uhd50 = ConfigSelection(choices=conv_50)
    config.av.autores_uhd60 = ConfigSelection(choices=conv_60)

    # some boxes do not support YPbPr
    try:
        config.av.colorformat = ConfigSelection(choices=colorformat_choices,
                                                default="yuv")
    except:
        config.av.colorformat = ConfigSelection(choices=colorformat_choices,
                                                default="cvbs")

    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)
        elif config.av.videoport and config.av.videoport.value in ("RCA", ):
            iAVSwitch.setColorFormat(0)
        else:
            if getBoxType() == 'et6x00':
                colmap = {"cvbs": 3, "rgb": 3, "svideo": 2, "yuv": 3}
            elif getBoxType() == 'gbquad' or getBoxType(
            ) == 'gbquadplus' or getBoxType().startswith('et'):
                colmap = {"cvbs": 0, "rgb": 3, "svideo": 2, "yuv": 3}
            else:
                colmap = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
            iAVSwitch.setColorFormat(colmap[configElement.value])

    config.av.colorformat.addNotifier(setColorFormat)

    def setAspectRatio(configElement):
        iAVSwitch.setAspectRatio({
            "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
        }[configElement.value])

    iAVSwitch.setInput("ENCODER")  # init on startup
    if (getBoxType() in ('gbquad', 'gbquadplus', 'et5x00', 'ixussone',
                         'ixusszero', 'axodin', 'axodinc', 'starsatlx',
                         'geniuse3hd', 'evoe3hd', 'axase3', 'axase3c',
                         'omtimussos1', 'omtimussos2', 'gb800seplus',
                         'gb800ueplus')) 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")
                f.write(configElement.value)
                f.close()
            except:
                pass

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

    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', 'vuultimo4k'):
            config.av.hdmicolorspace = ConfigSelection(choices={
                "Edid(Auto)": _("Auto"),
                "Hdmi_Rgb": _("RGB"),
                "444": _("YCbCr444"),
                "422": _("YCbCr422"),
                "420": _("YCbCr420")
            },
                                                       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):
            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":
            _("PIP enabled, no HDR"),
            "1":
            _("HDR, 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 Vision"),
            "hdr10": _("HDR10"),
            "hlg": _("HLG"),
            "none": _("Off")
        },
                                                default="auto")
        config.av.hdmihdrtype.addNotifier(setHdmiHdrType)
    else:
        config.av.hdmihdrtype = ConfigNothing()

    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):
            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)

    def hasDownmix(target):
        try:
            f = open(os.path.join("/proc/stb/audio", target + "_choices"), "r")
            choices = f.read().strip()
            f.close()
            return "downmix" in choices
        except:
            return False

    def setDownmix(target, value):
        f = open(os.path.join("/proc/stb/audio", target), "w")
        textval = value and "downmix" or "passthrough"
        print "[AVSwitch] setting %s to %s" % (target.upper(), textval)
        f.write(textval)
        f.close()

    can_downmix_ac3 = hasDownmix("ac3")

    SystemInfo["CanDownmixAC3"] = can_downmix_ac3
    if can_downmix_ac3:

        def setAC3Downmix(configElement):
            setDownmix("ac3", configElement.value)
            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)

    can_downmix_dts = hasDownmix("dts")

    defective_dts_downmix = getBoxType() == "beyonwizu4"

    SystemInfo["CanDownmixDTS"] = can_downmix_dts and not defective_dts_downmix
    if can_downmix_dts:
        if not defective_dts_downmix:

            def setDTSDownmix(configElement):
                setDownmix("dts", configElement.value)

            config.av.downmix_dts = ConfigYesNo(default=True)
            config.av.downmix_dts.addNotifier(setDTSDownmix)
        else:
            setDownmix("dts", False)

    can_downmix_aac = hasDownmix("aac")

    SystemInfo["CanDownmixAAC"] = can_downmix_aac
    if can_downmix_aac:

        def setAACDownmix(configElement):
            setDownmix("aac", configElement.value)

        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 "[VideoHardware] 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 "[VideoHardware] 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()