Exemple #1
0
def getCurrentImageMode():
    global bootArgs
    return bool(bootSlots) and BoxInfo.getItem("canMode12") and int(
        bootArgs.split("=")[-1])
Exemple #2
0
from Components.Label import Label
from Components.ConfigList import ConfigListScreen
from Components.ActionMap import ActionMap
from Components.config import config, getConfigListEntry, ConfigText, ConfigSubsection, ConfigYesNo
from Components.MenuList import MenuList
from Components.ServiceEventTracker import ServiceEventTracker
from Tools.Directories import resolveFilename, SCOPE_CURRENT_PLUGIN
from bluetoothctl import iBluetoothctl, Bluetoothctl
import os
import time
import signal
from datetime import datetime, timedelta
from Components.Console import Console
from Components.SystemInfo import BoxInfo

brand = BoxInfo.getItem("brand")


class TaskManager:
    def __init__(self):
        self.taskIdx = 0
        self.taskList = []
        self.gTaskInstance = None
        self.occurError = False
        self.cbSetStatusCB = None

    def append(self, command, cbDataFunc, cbCloseFunc):
        self.taskList.append([command + '\n', cbDataFunc, cbCloseFunc])

    def dump(self):
        print("############### TASK ###############")
Exemple #3
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
from Components.config import config, ConfigSelection, ConfigSubDict, ConfigYesNo
from Components.SystemInfo import BoxInfo
from Tools.CList import CList
import os
from enigma import getDesktop
from Components.About import about
from Tools.Directories import fileExists
from Components.Console import Console
import re

brand = BoxInfo.getItem("brand")
platform = BoxInfo.getItem("platform")
socfamily = BoxInfo.getItem("socfamily").replace('bcm', '').replace('hisi', '')
chipsetstring = about.getChipSetString()
has_hdmi = BoxInfo.getItem("hdmi")
has_scart = BoxInfo.getItem("scart")
has_yuv = BoxInfo.getItem("yuv")
has_rca = BoxInfo.getItem("rca")
has_avjack = BoxInfo.getItem("avjack")

# The "VideoHardware" is the interface to /proc/stb/video.
# It generates hotplug events, and gives you the list of
# available and preferred modes, as well as handling the currently
# selected mode. No other strict checking is done.

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

Exemple #4
0
 def setExternalPiP(self, onoff):
     if BoxInfo.getItem("HasExternalPIP"):
         open(BoxInfo.getItem("HasExternalPIP"), "w").write(onoff and "on"
                                                            or "off")
class hotkey:
    functions = None
    hotkeys = [(_("Red") + " " + _("long"), "red_long", ""),
               (_("Green") + " " + _("long"), "green_long", ""),
               (_("Yellow") + " " + _("long"), "yellow_long",
                "Plugins/Extensions/GraphMultiEPG/1"),
               (_("Blue") + " " + _("long"), "blue_long", "SoftcamSetup"),
               ("F1", "f1", ""), ("F1" + " " + _("long"), "f1_long", ""),
               ("F2", "f2", ""), ("F2" + " " + _("long"), "f2_long", ""),
               ("F3", "f3", ""), ("F3" + " " + _("long"), "f3_long", ""),
               ("PIP", "f6", ""), ("PIP" + " " + _("long"), "f6_long", ""),
               (_("Red"), "red", ""), (_("Green"), "green", ""),
               (_("Yellow"), "yellow", ""), (_("Blue"), "blue", ""),
               ("Rec", "rec", ""),
               ("Rec" + " " + _("long"), "rec_long", "Infobar/instantRecord"),
               ("Radio", "radio", ""),
               ("Radio" + " " + _("long"), "radio_long", ""),
               ("TV", "showTv", ""),
               ("TV" + " " + _("long"), "showTv_long",
                BoxInfo.getItem("LcdLiveTV") and "Infobar/ToggleLCDLiveTV"
                or ""), ("TV2", "toggleTvRadio", ""),
               ("TV2" + " " + _("long"), "toggleTvRadio_long",
                BoxInfo.getItem("LcdLiveTV") and "Infobar/ToggleLCDLiveTV"
                or ""), ("Teletext", "text", ""), ("Help", "displayHelp", ""),
               ("Help" + " " + _("long"), "displayHelp_long", ""),
               ("Subtitle", "subtitle", ""),
               ("Subtitle" + " " + _("long"), "subtitle_long", ""),
               ("Menu", "mainMenu", ""),
               ("Info (EPG)", "info", "Infobar/openEventView"),
               ("Info (EPG)" + " " + _("long"), "info_long",
                "Infobar/showEventInfoPlugins"), ("List/Fav/PVR", "list", ""),
               ("List/Fav/PVR" + " " + _("long"), "list_long",
                "Plugins/Extensions/Kodi/1"), ("List/File", "file", ""),
               ("List/File" + " " + _("long"), "file_long", ""),
               ("Back/Recall", "back", ""),
               ("Back/Recall" + " " + _("long"), "back_long", ""),
               ("End", "end", ""),
               ("EPG/Guide", "epg", "Plugins/Extensions/GraphMultiEPG/1"),
               ("EPG/Guide" + " " + _("long"), "epg_long",
                "Infobar/showEventInfoPlugins"), ("Left", "cross_left", ""),
               ("Right", "cross_right", ""), ("Up", "cross_up", ""),
               ("Down", "cross_down", ""), ("Ok", "ok", ""),
               ("Channel up", "channelup", ""),
               ("Channel down", "channeldown", ""), ("Page up", "pageUp", ""),
               ("Page up" + " " + _("long"), "pageUp_long", ""),
               ("Page down", "pageDown", ""),
               ("Page down" + " " + _("long"), "pageDown_long", ""),
               ("Next", "next", ""), ("Previous", "previous", ""),
               ("Audio", "audio", ""), ("Play", "play", ""),
               ("Playpause", "playpause", ""), ("Stop", "stop", ""),
               ("Pause", "pause", ""), ("Rewind", "rewind", ""),
               ("Fastforward", "fastforward", ""),
               ("Skip back", "skip_back", ""),
               ("Skip forward", "skip_forward", ""),
               ("Activate PiP", "activatePiP", ""),
               ("Activate PiP long", "activatePiP_long", ""),
               ("Timer", "timer", ""),
               ("Timer" + " " + _("long"), "timer_long", ""),
               ("Playlist", "playlist", ""), ("Timeshift", "timeshift", ""),
               ("Search", "search", ""),
               ("Search" + " " + _("long"), "search_long", ""),
               ("Slow", "slow", ""), ("Mark/Portal/Playlist", "mark", ""),
               ("Mark/Portal/Playlist" + " " + _("long"), "mark_long", ""),
               ("Sleep", "sleep", ""),
               ("Sleep" + " " + _("long"), "sleep_long", ""),
               ("Context", "contextmenu", ""),
               ("Context" + " " + _("long"), "contextmenu_long", ""),
               ("Video Mode", "vmode", ""),
               ("Video Mode" + " " + _("long"), "vmode_long", ""),
               ("Home", "home", ""),
               ("Power", "power", "Module/Screens.Standby/Standby"),
               ("Power" + " " + _("long"), "power_long", "Menu/shutdown"),
               ("HDMIin", "HDMIin", "Infobar/HDMIIn"),
               ("HDMIin" + " " + _("long"), "HDMIin_long", ""),
               ("Media", "media", ""),
               ("Media" + " " + _("long"), "media_long", ""),
               ("Open", "open", ""),
               ("Open" + " " + _("long"), "open_long", ""),
               ("Option", "option", ""),
               ("Option" + " " + _("long"), "option_long", ""),
               ("Favorites", "favorites", "Infobar/openFavouritesList"),
               ("Favorites" + " " + _("long"), "favorites_long", ""),
               ("Mouse", "mouse", ""),
               ("Mouse" + " " + _("long"), "mouse_long", ""),
               ("Directory", "directory", ""),
               ("Directory" + " " + _("long"), "directory_long", ""),
               ("Sat", "sat", ""), ("Sat" + " " + _("long"), "sat_long", ""),
               ("Prov", "prov", ""),
               ("Prov" + " " + _("long"), "prov_long", ""), ("LAN", "lan", ""),
               ("LAN" + " " + _("long"), "lan_long", ""), ("PC", "pc", ""),
               ("PC" + " " + _("long"), "pc_long", ""),
               ("Homepage", "homepage", ""),
               ("Homepage" + " " + _("long"), "homepage_long", ""),
               ("EjectCD", "ejectcd", ""),
               ("EjectCD" + " " + _("long"), "ejectcd_long", ""),
               ("VOD", "vod", ""), ("VOD" + " " + _("long"), "vod_long", ""),
               ("WWW Portal", "www", ""),
               ("WWW Portal" + " " + _("long"), "www_long", ""),
               ("ZOOM", "zoom", ""),
               ("ZOOM" + " " + _("long"), "zoom_long", "")]
###################################################
from Plugins.Extensions.IPTVPlayer.tools.iptvtools import printDBG, printExc, GetE2VideoAspectChoices, GetE2VideoAspect, GetE2VideoPolicyChoices, GetE2VideoPolicy, GetE2AudioCodecMixChoices, IsExecutable
from Plugins.Extensions.IPTVPlayer.components.configbase import ConfigBaseWidget, ConfigIPTVFileSelection, COLORS_DEFINITONS
from Plugins.Extensions.IPTVPlayer.components.iptvplayerinit import TranslateTXT as _
###################################################

###################################################
# FOREIGN import
###################################################
import skin
from enigma import eLabel, getDesktop
from Screens.MessageBox import MessageBox
from Components.config import config, ConfigSelection, ConfigYesNo, Config, ConfigInteger, getConfigListEntry, configfile
from Components.SystemInfo import BoxInfo

architecture = BoxInfo.getItem("architecture")
###################################################
config.plugins.iptvplayer.extplayer_summary = ConfigSelection(
    default="yes",
    choices=[('auto', _('Auto')), ('yes', _('Yes')), ('no', _('No'))])
config.plugins.iptvplayer.use_clear_iframe = ConfigYesNo(default=False)
config.plugins.iptvplayer.show_iframe = ConfigYesNo(default=True)
config.plugins.iptvplayer.iframe_file = ConfigIPTVFileSelection(
    fileMatch="^.*\.mvi$", default="/usr/share/enigma2/radio.mvi")
config.plugins.iptvplayer.clear_iframe_file = ConfigIPTVFileSelection(
    fileMatch="^.*\.mvi$", default="/usr/share/enigma2/black.mvi")

config.plugins.iptvplayer.remember_last_position = ConfigYesNo(default=False)
config.plugins.iptvplayer.remember_last_position_time = ConfigInteger(
    0, (0, 99))
config.plugins.iptvplayer.fakeExtePlayer3 = ConfigSelection(default="fake",
Exemple #7
0
    def getImagesList(self):
        def getImages(path, files):
            for file in [
                    x for x in files
                    if os.path.splitext(x)[1] == ".zip" and box in x
            ]:
                try:
                    if checkimagefiles([
                            x.split(os.sep)[-1]
                            for x in zipfile.ZipFile(file).namelist()
                    ]):
                        imagetyp = _("Downloaded Images")
                        if 'backup' in file.split(os.sep)[-1]:
                            imagetyp = _("Fullbackup Images")
                        if imagetyp not in self.imagesList:
                            self.imagesList[imagetyp] = {}
                        self.imagesList[imagetyp][file] = {
                            'link': file,
                            'name': file.split(os.sep)[-1]
                        }
                except:
                    pass

        if not self.imagesList:
            box = GetBoxName()
            if not self.jsonlist:
                try:
                    self.jsonlist = dict(
                        json.load(urlopen('%s/%s' % (feedurl, box))))
                    #if config.usage.alternative_imagefeed.value:
                    #	self.jsonlist.update(dict(json.load(urlopen('%s%s' % (config.usage.alternative_imagefeed.value, box)))))
                except:
                    pass
            self.imagesList = dict(self.jsonlist)

            for media in ['/media/%s' % x for x in os.listdir('/media')] + ([
                    '/media/net/%s' % x for x in os.listdir('/media/net')
            ] if os.path.isdir('/media/net') else []):
                if not (BoxInfo.getItem('HasMMC')
                        and "/mmc" in media) and os.path.isdir(media):
                    getImages(media, [
                        os.path.join(media, x) for x in os.listdir(media)
                        if os.path.splitext(x)[1] == ".zip" and box in x
                    ])
                    for folder in [
                            "images", "downloaded_images", "imagebackups"
                    ]:
                        if folder in os.listdir(media):
                            subfolder = os.path.join(media, folder)
                            if os.path.isdir(subfolder) and not os.path.islink(
                                    subfolder) and not os.path.ismount(
                                        subfolder):
                                getImages(subfolder, [
                                    os.path.join(subfolder, x)
                                    for x in os.listdir(subfolder)
                                    if os.path.splitext(x)[1] == ".zip"
                                    and box in x
                                ])
                                for dir in [
                                        dir for dir in [
                                            os.path.join(subfolder, dir)
                                            for dir in os.listdir(subfolder)
                                        ] if os.path.isdir(dir) and
                                        os.path.splitext(dir)[1] == ".unzipped"
                                ]:
                                    shutil.rmtree(dir)

        _list = []
        for catagorie in reversed(sorted(self.imagesList.keys())):
            if catagorie in self.expanded:
                _list.append(
                    ChoiceEntryComponent('expanded',
                                         ((str(catagorie)), "Expander")))
                for image in reversed(
                        sorted(list(self.imagesList[catagorie].keys()),
                               key=lambda x: x.split(os.sep)[-1])):
                    _list.append(
                        ChoiceEntryComponent(
                            'verticalline',
                            ((str(self.imagesList[catagorie][image]['name'])),
                             str(self.imagesList[catagorie][image]['link']))))
            else:
                for image in list(self.imagesList[catagorie].keys()):
                    _list.append(
                        ChoiceEntryComponent('expandable',
                                             ((str(catagorie)), "Expander")))
                    break
        if _list:
            self["list"].setList(_list)
            if self.setIndex:
                self["list"].moveToIndex(self.setIndex if self.setIndex < len(
                    _list) else len(_list) - 1)
                if self["list"].l.getCurrentSelection()[0][1] == "Expander":
                    self.setIndex -= 1
                    if self.setIndex:
                        self["list"].moveToIndex(self.setIndex if self.setIndex
                                                 < len(_list) else len(_list) -
                                                 1)
                self.setIndex = 0
            self.selectionChanged()
        else:
            self.session.openWithCallback(
                self.close,
                MessageBox,
                _("Cannot find images - please try later"),
                type=MessageBox.TYPE_ERROR,
                timeout=3)
Exemple #8
0
    def Recording(self):
        if fileExists("/proc/stb/lcd/symbol_circle"):
            recordings = len(
                NavigationInstance.instance.getRecordings(
                    False,
                    Components.RecordingConfig.recType(
                        config.recording.show_rec_symbol_for_rec_types.
                        getValue())))
            if recordings > 0:
                open("/proc/stb/lcd/symbol_circle", "w").write("3")
            else:
                open("/proc/stb/lcd/symbol_circle", "w").write("0")
        elif BoxInfo.getItem("model") in (
                'alphatriple', 'mixosf5', 'mixoslumi', 'mixosf7', 'gi9196m',
                'sf3038') and fileExists("/proc/stb/lcd/symbol_recording"):
            recordings = len(
                NavigationInstance.instance.getRecordings(
                    False,
                    Components.RecordingConfig.recType(
                        config.recording.show_rec_symbol_for_rec_types.
                        getValue())))
            if recordings > 0:
                open("/proc/stb/lcd/symbol_recording", "w").write("1")
            else:
                open("/proc/stb/lcd/symbol_recording", "w").write("0")
        elif getMachineBuild() == 'u41' and fileExists(
                "/proc/stb/lcd/symbol_pvr2"):
            recordings = len(
                NavigationInstance.instance.getRecordings(
                    False,
                    Components.RecordingConfig.recType(
                        config.recording.show_rec_symbol_for_rec_types.
                        getValue())))
            if recordings > 0:
                open("/proc/stb/lcd/symbol_pvr2", "w").write("1")
            else:
                open("/proc/stb/lcd/symbol_pvr2", "w").write("0")
        elif BoxInfo.getItem("model") in (
                'alien5', 'osninopro', 'wetekplay', 'wetekplay2', 'wetekhub',
                'ixussone', 'ixusszero', '9910lx', '9911lx', 'osnino',
                'osninoplus',
                '9920lx') and fileExists("/proc/stb/lcd/powerled"):
            recordings = len(
                NavigationInstance.instance.getRecordings(
                    False,
                    Components.RecordingConfig.recType(
                        config.recording.show_rec_symbol_for_rec_types.
                        getValue())))
            self.blink = not self.blink
            if recordings > 0:
                if self.blink:
                    open("/proc/stb/lcd/powerled", "w").write("1")
                    self.led = "1"
                else:
                    open("/proc/stb/lcd/powerled", "w").write("0")
                    self.led = "0"
            elif self.led == "1":
                open("/proc/stb/lcd/powerled", "w").write("0")
        elif BoxInfo.getItem("model") in (
                'mbmicrov2', 'mbmicro', 'e4hd',
                'e4hdhybrid') and fileExists("/proc/stb/lcd/powerled"):
            recordings = len(
                NavigationInstance.instance.getRecordings(
                    False,
                    Components.RecordingConfig.recType(
                        config.recording.show_rec_symbol_for_rec_types.
                        getValue())))
            self.blink = not self.blink
            if recordings > 0:
                if self.blink:
                    open("/proc/stb/lcd/powerled", "w").write("0")
                    self.led = "1"
                else:
                    open("/proc/stb/lcd/powerled", "w").write("1")
                    self.led = "0"
            elif self.led == "1":
                open("/proc/stb/lcd/powerled", "w").write("1")
        elif BoxInfo.getItem("model") in (
                'dm7020hd',
                'dm7020hdv2') and fileExists("/proc/stb/fp/led_set"):
            recordings = len(
                NavigationInstance.instance.getRecordings(
                    False,
                    Components.RecordingConfig.recType(
                        config.recording.show_rec_symbol_for_rec_types.
                        getValue())))
            self.blink = not self.blink
            if recordings > 0:
                if self.blink:
                    open("/proc/stb/fp/led_set", "w").write("0x00000000")
                    self.led = "1"
                else:
                    open("/proc/stb/fp/led_set", "w").write("0xffffffff")
                    self.led = "0"
            else:
                open("/proc/stb/fp/led_set", "w").write("0xffffffff")
        elif getMachineBuild() in (
                'dags7362', 'dags73625',
                'dags5') or BoxInfo.getItem("model") in (
                    'tmtwin4k', 'revo4k',
                    'force3uhd') and fileExists("/proc/stb/lcd/symbol_rec"):
            recordings = len(
                NavigationInstance.instance.getRecordings(
                    False,
                    Components.RecordingConfig.recType(
                        config.recording.show_rec_symbol_for_rec_types.
                        getValue())))
            self.blink = not self.blink
            if recordings > 0:
                if self.blink:
                    open("/proc/stb/lcd/symbol_rec", "w").write("1")
                    self.led = "1"
                else:
                    open("/proc/stb/lcd/symbol_rec", "w").write("0")
                    self.led = "0"
            elif self.led == "1":
                open("/proc/stb/lcd/symbol_rec", "w").write("0")
        elif getMachineBuild() in (
                'sf8008', 'sf8008m', 'sf8008opt', 'cc1', 'ustym4kpro',
                'beyonwizv2', 'viper4k',
                'dagsmv200') and fileExists("/proc/stb/fp/ledpowercolor"):
            import Screens.Standby
            recordings = len(
                NavigationInstance.instance.getRecordings(
                    False,
                    Components.RecordingConfig.recType(
                        config.recording.show_rec_symbol_for_rec_types.
                        getValue())))
            self.blink = not self.blink
            if recordings > 0:
                if self.blink:
                    open("/proc/stb/fp/ledpowercolor", "w").write("0")
                    self.led = "1"
                else:
                    if Screens.Standby.inStandby:
                        open("/proc/stb/fp/ledpowercolor",
                             "w").write(config.usage.lcd_ledstandbycolor.value)
                    else:
                        open("/proc/stb/fp/ledpowercolor",
                             "w").write(config.usage.lcd_ledpowercolor.value)
                    self.led = "0"
            elif self.led == "1":
                if Screens.Standby.inStandby:
                    open("/proc/stb/fp/ledpowercolor",
                         "w").write(config.usage.lcd_ledstandbycolor.value)
                else:
                    open("/proc/stb/fp/ledpowercolor",
                         "w").write(config.usage.lcd_ledpowercolor.value)
        else:
            if not fileExists(
                    "/proc/stb/lcd/symbol_recording") or not fileExists(
                        "/proc/stb/lcd/symbol_record_1") or not fileExists(
                            "/proc/stb/lcd/symbol_record_2"):
                return

            recordings = len(
                NavigationInstance.instance.getRecordings(
                    False,
                    Components.RecordingConfig.recType(
                        config.recording.show_rec_symbol_for_rec_types.
                        getValue())))

            if recordings > 0:
                open("/proc/stb/lcd/symbol_recording", "w").write("1")
                if recordings == 1:
                    open("/proc/stb/lcd/symbol_record_1", "w").write("1")
                    open("/proc/stb/lcd/symbol_record_2", "w").write("0")
                elif recordings >= 2:
                    open("/proc/stb/lcd/symbol_record_1", "w").write("1")
                    open("/proc/stb/lcd/symbol_record_2", "w").write("1")
            else:
                open("/proc/stb/lcd/symbol_recording", "w").write("0")
                open("/proc/stb/lcd/symbol_record_1", "w").write("0")
                open("/proc/stb/lcd/symbol_record_2", "w").write("0")
Exemple #9
0
from Components.config import *
from Components.ConfigList import ConfigList, ConfigListScreen
from Components.Sources.StaticText import StaticText
from Screens.Screen import Screen
from Components.SystemInfo import BoxInfo

try:
    DisplayType = evfd.getInstance().getVfdType()
    if DisplayType != 6:
        DisplayType = None
except:
    DisplayType = None
DisplayTypevfd = DisplayType

if DisplayTypevfd is None:
    if BoxInfo.getItem("model") == "fortis_hdbox":
        DisplayType = 6
    else:
        DisplayType = None

config.plugins.vfdicon = ConfigSubsection()
config.plugins.vfdicon.displayshow = ConfigSelection(
    default="channel",
    choices=[("nothing", _("blank")), ("channel number", _("channel number")),
             ("channel", _("channel name")),
             ("channel namenumber", _("channel number and name")),
             ("time", _("time")), ("date", _("date")),
             ("time_date", _("time and date")),
             ("day_date", _("day and date"))])
config.plugins.vfdicon.stbshow = ConfigSelection(default="time_date",
                                                 choices=[("nothing",
Exemple #10
0
def getFlashType():
    if BoxInfo.getItem("SmallFlash"):
        return _("Small - Tiny image")
    elif BoxInfo.getItem("MiddleFlash"):
        return _("Middle - Lite image")
    return _("Normal - Standard image")
Exemple #11
0
def getUpdateDateString():
    build = BoxInfo.getItem("compiledate")
    if build and build.isdigit():
        return "%s-%s-%s" % (build[:4], build[4:6], build[6:])
    return _("Unknown")
Exemple #12
0
def getCPUArch():
    if BoxInfo.getItem("ArchIsARM64"):
        return _("ARM64")
    elif BoxInfo.getItem("ArchIsARM"):
        return _("ARM")
    return _("Mipsel")
Exemple #13
0
from os import popen, stat
from os.path import isfile
from re import search
from socket import AF_INET, SOCK_DGRAM, inet_ntoa, socket
from struct import pack, unpack
from subprocess import PIPE, Popen
from sys import maxsize, modules, version as pyversion
from time import localtime, strftime

from boxbranding import getBoxType, getMachineBuild, getImageVersion
from Components.SystemInfo import BoxInfo
from Tools.Directories import fileReadLine, fileReadLines

MODULE_NAME = __name__.split(".")[-1]

socfamily = BoxInfo.getItem("socfamily")


def getModelString():
    model = getBoxType()
    return model


def _ifinfo(sock, addr, ifname):
    iface = pack('256s', bytes(ifname[:15], 'utf-8'))
    info = ioctl(sock.fileno(), addr, iface)
    if addr == 0x8927:
        return ''.join(['%02x:' % ord(chr(char))
                        for char in info[18:24]])[:-1].upper()
    else:
        return inet_ntoa(info[20:24])
Exemple #14
0
def getMultiBootSlots():
    global bootSlots, startupDevice
    bootSlots = {}
    mode12Found = False
    if startupDevice is None:
        startupDevice = getMultiBootStartupDevice()
    if startupDevice:
        tempDir = mkdtemp(prefix=PREFIX)
        Console().ePopen((MOUNT, MOUNT, startupDevice, tempDir))
        for file in glob(pathjoin(tempDir, "STARTUP_*")):
            if "STARTUP_RECOVERY" in file:
                BoxInfo.setItem("RecoveryMode", True)
                print("[MultiBoot] Recovery mode is set to True.")
            if "MODE_" in file:
                mode12Found = True
                slotNumber = file.rsplit("_", 3)[1]
            else:
                slotNumber = file.rsplit("_", 1)[1]
            if slotNumber.isdigit() and slotNumber not in bootSlots:
                lines = fileReadLines(file, source=MODULE_NAME)
                if lines:
                    slot = {}
                    for line in lines:
                        if "root=" in line:
                            device = getArgValue(line, "root")
                            if exists(device):
                                slot["device"] = device
                                slot["startupfile"] = basename(file)
                                if "rootsubdir" in line:
                                    BoxInfo.setItem("HasRootSubdir", True)
                                    slot["kernel"] = getArgValue(
                                        line, "kernel")
                                    slot["rootsubdir"] = getArgValue(
                                        line, "rootsubdir")
                                elif "sda" in line:
                                    slot["kernel"] = getArgValue(
                                        line, "kernel")
                                    slot["rootsubdir"] = None
                                else:
                                    slot["kernel"] = "%sp%s" % (device.split(
                                        "p")[0], int(device.split("p")[1]) - 1)
                                bootSlots[int(slotNumber)] = slot
                            break
                else:
                    print(
                        "[MultiBoot] Warning: No content in file '%s' for slot number '%s'!"
                        % (file, slotNumber))
            else:
                print(
                    "[MultiBoot] Warning: Unexpected slot number '%s' in file '%s'!"
                    % (slotNumber, file))
        Console().ePopen((UMOUNT, UMOUNT, tempDir))
        if not ismount(tempDir):
            rmdir(tempDir)
        if not mode12Found and BoxInfo.getItem("canMode12"):
            # The boot device has ancient content and does not contain the correct STARTUP files!
            for slot in range(1, 5):
                bootSlots[slot] = {
                    "device": "/dev/mmcblk0p%s" % (slot * 2 + 1),
                    "startupfile": None
                }
    if bootSlots:
        for slot in sorted(list(bootSlots.keys())):
            print("[MultiBoot] Boot slot %d: %s" %
                  (slot, str(bootSlots[slot])))
    else:
        print("[MultiBoot] No boot slots found.")
    return bootSlots
 def setHDMIAudioSource(configElement):
     print("[AVSwitch] Write to /proc/stb/hdmi/audio_source")
     open(BoxInfo.getItem("HDMIAudioSource"),
          "w").write(configElement.value)
Exemple #16
0
from Components.config import config, configfile, ConfigSubList, getConfigListEntry, ConfigSubsection, ConfigSelection, ConfigInteger, integer_limits, NoSave
from Components.ActionMap import ActionMap
from Components.SystemInfo import BoxInfo
from Screens.MessageBox import MessageBox
from Components.Label import Label
from Components.Button import Button
from Components.Pixmap import Pixmap
from Components.Sources.Boolean import Boolean
from Components.Sources.StaticText import StaticText
from Plugins.Plugin import PluginDescriptor
from Tools.Directories import fileExists
from enigma import eTimer
from os import path as os_path, listdir as os_listdir
from Components.Console import Console

model = BoxInfo.getItem("model")
platform = BoxInfo.getItem("platform")


def getProcValue(procPath):
    #	print("[TranscodingSetup] get %s from %s" % (curValue, procPath))
    fd = open(procPath, 'r')
    curValue = fd.read().strip(' ').strip('\n')
    fd.close()
    return curValue


def setProcValue(procPath, value):
    print("[TranscodingSetup] set %s to %s" % (procPath, value))
    fd = open(procPath, 'w')
    fd.write(value)
def InitAVSwitch():
    config.av = ConfigSubsection()
    if model == "vuduo" or BoxInfo.getItem("brand") == "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 BoxInfo.getItem("yuv"):
        colorformat_choices["yuv"] = _("YPbPr")
    if BoxInfo.getItem("scart"):
        colorformat_choices["rgb"] = _("RGB")
    if BoxInfo.getItem("svideo"):
        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:
        print("[AVSwitch] Read /proc/stb/video/policy2_choices")
        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:
        print("[AVSwitch] Read /proc/stb/video/policy2_choices failed.")
    try:
        print("[AVSwitch] Read /proc/stb/video/policy2_choices")
        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:
        print("[AVSwitch] Read /proc/stb/video/policy2_choices failed.")
    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:
        print("[AVSwitch] Read /proc/stb/video/policy_choices")
        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:
        print("[AVSwitch] Read /proc/stb/video/policy_choices failed.")
    try:
        print("[AVSwitch] Read /proc/stb/video/policy_choices")
        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:
        print("[AVSwitch] Read /proc/stb/video/policy_choices failed.")
    try:
        print("[AVSwitch] Read /proc/stb/video/policy_choices")
        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:
        print("[AVSwitch] Read /proc/stb/video/policy_choices failed.")
    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 model == "et6x00":
            map = {"cvbs": 3, "rgb": 3, "svideo": 2, "yuv": 3}
        elif platform == "gb7356" or model.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 platform == "gb7356" or model in (
            "et5x00", "et6x00", "ixussone", "ixusszero", "axodin", "axase3",
            "optimussos1", "optimussos2", "gb800seplus", "gb800ueplus",
            "gbultrase", "gbultraue", "gbultraueh", "twinboxlcd"):
        detected = False
    else:
        detected = eAVSwitch.getInstance().haveScartSwitch()

    BoxInfo.setItem("ScartSwitch", detected)

    if BoxInfo.getItem("CanDownmixAC3"):

        def setAC3Downmix(configElement):
            print("[AVSwitch] Write to /proc/stb/audio/ac3")
            if BoxInfo.getItem("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 BoxInfo.getItem("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 BoxInfo.getItem("CanAC3plusTranscode"):

        def setAC3plusTranscode(configElement):
            print("[AVSwitch] Write to /proc/stb/audio/ac3plus")
            open("/proc/stb/audio/ac3plus", "w").write(configElement.value)

        if BoxInfo.getItem("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 platform in ("gb7252", "gb72604"):
            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 BoxInfo.getItem("CanDownmixDTS"):

        def setDTSDownmix(configElement):
            print("[AVSwitch] Write to /proc/stb/audio/dts")
            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 BoxInfo.getItem("CanDTSHD"):

        def setDTSHD(configElement):
            print("[AVSwitch] Write to /proc/stb/audio/dtshd")
            open("/proc/stb/audio/dtshd", "w").write(configElement.value)

        if model 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)

    if BoxInfo.getItem("CanWMAPRO"):

        def setWMAPRO(configElement):
            print("[AVSwitch] Write to /proc/stb/audio/wmapro")
            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 BoxInfo.getItem("CanDownmixAAC"):

        def setAACDownmix(configElement):
            print("[AVSwitch] Write to /proc/stb/audio/aac")
            if BoxInfo.getItem("DreamBoxAudio") or platform in ("gb7252",
                                                                "gb72604"):
                open("/proc/stb/audio/aac", "w").write(configElement.value)
            else:
                open("/proc/stb/audio/aac",
                     "w").write(configElement.value and "downmix"
                                or "passthrough")

        if BoxInfo.getItem("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 platform in ("gb7252", "gb72604"):
            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 BoxInfo.getItem("CanDownmixAACPlus"):

        def setAACDownmixPlus(configElement):
            print("[AVSwitch] Write to /proc/stb/audio/aacplus")
            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 BoxInfo.getItem("CanAACTranscode"):

        def setAACTranscode(configElement):
            print("[AVSwitch] Write to /proc/stb/audio/aac_transcode")
            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 BoxInfo.getItem("CanBTAudio"):

        def setBTAudio(configElement):
            print("[AVSwitch] Write to /proc/stb/audio/btaudio")
            open("/proc/stb/audio/btaudio",
                 "w").write("on" if configElement.value else "off")

        config.av.btaudio = ConfigOnOff(default=False)
        config.av.btaudio.addNotifier(setBTAudio)
    else:
        config.av.btaudio = ConfigNothing()

    if BoxInfo.getItem("CanBTAudioDelay"):

        def setBTAudioDelay(configElement):
            print("[AVSwitch] Write to /proc/stb/audio/btaudio_delay")
            open("/proc/stb/audio/btaudio_delay",
                 "w").write(format(configElement.value * 90))

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

    if BoxInfo.getItem("CanChangeOsdAlpha"):

        def setAlpha(config):
            print("[AVSwitch] Write to /proc/stb/video/alpha")
            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 BoxInfo.getItem("ScalerSharpness"):

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

        if platform == "gb7356":
            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 BoxInfo.getItem("HasMultichannelPCM"):

        def setMultichannelPCM(configElement):
            print("[AVSwitch] Write to /proc/stb/audio/multichannel_pcm")
            open(BoxInfo.getItem("HasMultichannelPCM"),
                 "w").write(configElement.value and "enable" or "disable")

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

    if BoxInfo.getItem("HasAutoVolume"):

        def setAutoVolume(configElement):
            print("[AVSwitch] Write to /proc/stb/audio/avl")
            open("/proc/stb/audio/avl", "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 BoxInfo.getItem("HasAutoVolumeLevel"):

        def setAutoVolumeLevel(configElement):
            print("[AVSwitch] Write to /proc/stb/audio/autovolumelevel")
            open("/proc/stb/audio/autovolumelevel",
                 "w").write(configElement.value and "enabled" or "disabled")

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

    if BoxInfo.getItem("Has3DSurround"):

        def set3DSurround(configElement):
            print("[AVSwitch] Write to /proc/stb/audio/3d_surround")
            open("/proc/stb/audio/3d_surround", "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 BoxInfo.getItem("Has3DSpeaker"):

        def set3DSpeaker(configElement):
            print(
                "[AVSwitch] Write to /proc/stb/audio/3d_surround_speaker_position"
            )
            open("/proc/stb/audio/3d_surround_speaker_position",
                 "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 BoxInfo.getItem("Has3DSurroundSpeaker"):

        def set3DSurroundSpeaker(configElement):
            print("[AVSwitch] Write to /proc/stb/audio/3dsurround")
            open("/proc/stb/audio/3dsurround", "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 BoxInfo.getItem("Has3DSurroundSoftLimiter"):

        def set3DSurroundSoftLimiter(configElement):
            print("[AVSwitch] Write to /proc/stb/audio/3dsurround_softlimiter")
            open("/proc/stb/audio/3dsurround_softlimiter",
                 "w").write(configElement.value and "enabled" or "disabled")

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

    if BoxInfo.getItem("HDMIAudioSource"):

        def setHDMIAudioSource(configElement):
            print("[AVSwitch] Write to /proc/stb/hdmi/audio_source")
            open(BoxInfo.getItem("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)
Exemple #18
0
    def createSetup2(self):
        encoder = self.curencoder
        if encoder is not None:
            self.automode = None
            if checkSupportAdvanced() and hasattr(
                    config.plugins.transcodingsetup.encoder[int(encoder)],
                    "automode"):
                self.automode = getConfigListEntry(
                    _("Auto set Framerate / Bitrate"),
                    config.plugins.transcodingsetup.encoder[int(
                        encoder)].automode)

            if self.automode is not None:
                self.list.append(self.automode)

            if BoxInfo.getItem("NoAuto%s" % encoder):
                if hasattr(
                        config.plugins.transcodingsetup.encoder[int(encoder)],
                        "bitrate"):
                    self.list.append(
                        getConfigListEntry(
                            _("Bitrate"),
                            config.plugins.transcodingsetup.encoder[int(
                                encoder)].bitrate))
                if hasattr(
                        config.plugins.transcodingsetup.encoder[int(encoder)],
                        "framerate"):
                    self.list.append(
                        getConfigListEntry(
                            _("Framerate"),
                            config.plugins.transcodingsetup.encoder[int(
                                encoder)].framerate))

            if checkSupportAdvanced() and self.setupMode != "Normal":
                if hasattr(
                        config.plugins.transcodingsetup.encoder[int(encoder)],
                        "resolution"):
                    self.list.append(
                        getConfigListEntry(
                            _("Resolution"),
                            config.plugins.transcodingsetup.encoder[int(
                                encoder)].resolution))

                if hasattr(
                        config.plugins.transcodingsetup.encoder[int(encoder)],
                        "aspectratio"):
                    self.list.append(
                        getConfigListEntry(
                            _("Aspect Ratio"),
                            config.plugins.transcodingsetup.encoder[int(
                                encoder)].aspectratio))

                if hasattr(
                        config.plugins.transcodingsetup.encoder[int(encoder)],
                        "audiocodec"):
                    self.list.append(
                        getConfigListEntry(
                            _("Audio codec"),
                            config.plugins.transcodingsetup.encoder[int(
                                encoder)].audiocodec))

                if hasattr(
                        config.plugins.transcodingsetup.encoder[int(encoder)],
                        "videocodec"):
                    self.list.append(
                        getConfigListEntry(
                            _("Video codec"),
                            config.plugins.transcodingsetup.encoder[int(
                                encoder)].videocodec))

                if hasattr(
                        config.plugins.transcodingsetup.encoder[int(encoder)],
                        "gopframeb"):
                    self.list.append(
                        getConfigListEntry(
                            _("GOP Frame B"),
                            config.plugins.transcodingsetup.encoder[int(
                                encoder)].gopframeb))

                if hasattr(
                        config.plugins.transcodingsetup.encoder[int(encoder)],
                        "gopframep"):
                    self.list.append(
                        getConfigListEntry(
                            _("GOP Frame P"),
                            config.plugins.transcodingsetup.encoder[int(
                                encoder)].gopframep))

                if hasattr(
                        config.plugins.transcodingsetup.encoder[int(encoder)],
                        "level"):
                    self.list.append(
                        getConfigListEntry(
                            _("Level"),
                            config.plugins.transcodingsetup.encoder[int(
                                encoder)].level))

                if hasattr(
                        config.plugins.transcodingsetup.encoder[int(encoder)],
                        "profile"):
                    self.list.append(
                        getConfigListEntry(
                            _("Profile"),
                            config.plugins.transcodingsetup.encoder[int(
                                encoder)].profile))

        self["config"].list = self.list
        self["config"].l.setList(self.list)
        if not self.showDescription in self["config"].onSelectionChanged:
            self["config"].onSelectionChanged.append(self.showDescription)
Exemple #19
0
###################################################

MAIN_PAGE = "http://www.zdf.de"

PNG_PATH = resolveFilename(SCOPE_PLUGINS) + "/Extensions/ZDFMediathek/"

TYPE_NOTHING = 0
TYPE_MOVIE = 1
TYPE_PODCAST = 2
TYPE_MOVIELIST_CATEGORY = 3

LIST_LEFT = 0
LIST_RIGHT = 1
LIST_NONE = 2

deviceName = BoxInfo.getItem("model")

PLAY_MP4 = True
PLAY_WMV = False

if deviceName.startswith("dm7020hd"):
	PLAY_WMV = True
try:
	from LT.LTStreamPlayer import streamplayer
except ImportError as e:
	try:
		from Plugins.Extensions.LTMediaCenter.LTStreamPlayer import streamplayer
	except ImportError as e:
		streamplayer = None

try:
Exemple #20
0
def getButtonSetupFunctions():
    ButtonSetupFunctions = []
    twinPlugins = []
    twinPaths = {}
    pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO)
    pluginlist.sort(key=lambda p: p.name)
    for plugin in pluginlist:
        if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in plugin.__call__.__code__.co_varnames:
            if plugin.path[plugin.path.rfind("Plugins"):] in twinPaths:
                twinPaths[plugin.path[plugin.path.rfind("Plugins"):]] += 1
            else:
                twinPaths[plugin.path[plugin.path.rfind("Plugins"):]] = 1
            ButtonSetupFunctions.append(
                (plugin.name,
                 plugin.path[plugin.path.rfind("Plugins"):] + "/" +
                 str(twinPaths[plugin.path[plugin.path.rfind("Plugins"):]]),
                 "EPG"))
            twinPlugins.append(plugin.name)
    pluginlist = plugins.getPlugins([
        PluginDescriptor.WHERE_PLUGINMENU,
        PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_EVENTINFO
    ])
    pluginlist.sort(key=lambda p: p.name)
    for plugin in pluginlist:
        if plugin.name not in twinPlugins and plugin.path:
            if plugin.path[plugin.path.rfind("Plugins"):] in twinPaths:
                twinPaths[plugin.path[plugin.path.rfind("Plugins"):]] += 1
            else:
                twinPaths[plugin.path[plugin.path.rfind("Plugins"):]] = 1
            ButtonSetupFunctions.append(
                (plugin.name,
                 plugin.path[plugin.path.rfind("Plugins"):] + "/" +
                 str(twinPaths[plugin.path[plugin.path.rfind("Plugins"):]]),
                 "Plugins"))
            twinPlugins.append(plugin.name)
    ButtonSetupFunctions.append(
        (_("Show vertical Program Guide"), "Infobar/openVerticalEPG", "EPG"))
    ButtonSetupFunctions.append(
        (_("Show graphical multi EPG"), "Infobar/openGraphEPG", "EPG"))
    ButtonSetupFunctions.append(
        (_("Main Menu"), "Infobar/mainMenu", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show help"), "Infobar/showHelp", "InfoBar"))
    ButtonSetupFunctions.append((_("Show extension selection"),
                                 "Infobar/showExtensionSelection", "InfoBar"))
    ButtonSetupFunctions.append((_("Zap down"), "Infobar/zapDown", "InfoBar"))
    ButtonSetupFunctions.append((_("Zap up"), "Infobar/zapUp", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Volume down"), "Infobar/volumeDown", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Volume up"), "Infobar/volumeUp", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show Infobar"), "Infobar/toggleShow", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show service list"), "Infobar/openServiceList", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show favourites list"), "Infobar/openBouquets", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show satellites list"), "Infobar/openSatellites", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("History back"), "Infobar/historyBack", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("History next"), "Infobar/historyNext", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show eventinfo plugins"), "Infobar/showEventInfoPlugins", "EPG"))
    ButtonSetupFunctions.append(
        (_("Show event details"), "Infobar/openEventView", "EPG"))
    ButtonSetupFunctions.append(
        (_("Show single service EPG"), "Infobar/openSingleServiceEPG", "EPG"))
    ButtonSetupFunctions.append(
        (_("Show multi channel EPG"), "Infobar/openMultiServiceEPG", "EPG"))
    ButtonSetupFunctions.append(
        (_("Show Audioselection"), "Infobar/audioSelection", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Enable digital downmix"), "Infobar/audioDownmixOn", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Disable digital downmix"), "Infobar/audioDownmixOff", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Switch to radio mode"), "Infobar/showRadio", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Switch to TV mode"), "Infobar/showTv", "InfoBar"))
    ButtonSetupFunctions.append((_("Show servicelist or movies"),
                                 "Infobar/showServiceListOrMovies", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show movies"), "Infobar/showMovies", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Instant record"), "Infobar/instantRecord", "InfoBar"))
    ButtonSetupFunctions.append((_("Start instant recording"),
                                 "Infobar/startInstantRecording", "InfoBar"))
    ButtonSetupFunctions.append((_("Activate timeshift End"),
                                 "Infobar/activateTimeshiftEnd", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Activate timeshift end and pause"),
         "Infobar/activateTimeshiftEndAndPause", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Start timeshift"), "Infobar/startTimeshift", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Stop timeshift"), "Infobar/stopTimeshift", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Start teletext"), "Infobar/startTeletext", "InfoBar"))
    ButtonSetupFunctions.append((_("Show subservice selection"),
                                 "Infobar/subserviceSelection", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Show subtitle selection"), "Infobar/subtitleSelection", "InfoBar"))
    ButtonSetupFunctions.append((_("Show subtitle quick menu"),
                                 "Infobar/subtitleQuickMenu", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Letterbox zoom"), "Infobar/vmodeSelection", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Seekbar"), "Infobar/seekFwdVod", "InfoBar"))
    if BoxInfo.getItem("PIPAvailable"):
        ButtonSetupFunctions.append(
            (_("Show PIP"), "Infobar/showPiP", "InfoBar"))
        ButtonSetupFunctions.append(
            (_("Swap PIP"), "Infobar/swapPiP", "InfoBar"))
        ButtonSetupFunctions.append(
            (_("Move PIP"), "Infobar/movePiP", "InfoBar"))
        ButtonSetupFunctions.append(
            (_("Toggle PIPzap"), "Infobar/togglePipzap", "InfoBar"))
        ButtonSetupFunctions.append(
            (_("Cycle PIP(zap)"), "Infobar/activePiP", "InfoBar"))
    ButtonSetupFunctions.append((_("Activate HbbTV (Redbutton)"),
                                 "Infobar/activateRedButton", "InfoBar"))
    if getHaveHDMIinHD() == 'True' or getHaveHDMIinFHD() == 'True':
        ButtonSetupFunctions.append(
            (_("Toggle HDMI-In full screen"), "Infobar/HDMIInFull", "InfoBar"))
        ButtonSetupFunctions.append(
            (_("Toggle HDMI-In PiP"), "Infobar/HDMIInPiP", "InfoBar"))
    if BoxInfo.getItem("LcdLiveTV"):
        ButtonSetupFunctions.append(
            (_("Toggle LCD LiveTV"), "Infobar/ToggleLCDLiveTV", "InfoBar"))
    if BoxInfo.getItem("canMultiBoot"):
        ButtonSetupFunctions.append(
            (_("MultiBoot Manager"),
             "Module/Screens.MultiBootManager/MultiBootManager", "InfoBar"))
    ButtonSetupFunctions.append(
        (_("Hotkey Settings"), "Module/Screens.ButtonSetup/ButtonSetup",
         "Setup"))
    ButtonSetupFunctions.append(
        (_("Software Update"), "Module/Screens.SoftwareUpdate/SoftwareUpdate",
         "Setup"))
    if getHaveCI() == 'True':
        ButtonSetupFunctions.append((_("CI (Common Interface) Setup"),
                                     "Module/Screens.Ci/CiSelection", "Setup"))
    ButtonSetupFunctions.append(
        (_("Videosetup"), "Module/Screens.VideoMode/VideoSetup", "Setup"))
    ButtonSetupFunctions.append(
        (_("Tuner Configuration"), "Module/Screens.Satconfig/NimSelection",
         "Scanning"))
    ButtonSetupFunctions.append(
        (_("Manual Scan"), "Module/Screens.ScanSetup/ScanSetup", "Scanning"))
    ButtonSetupFunctions.append(
        (_("Automatic Scan"), "Module/Screens.ScanSetup/ScanSimple",
         "Scanning"))
    for plugin in plugins.getPluginsForMenu("scan"):
        ButtonSetupFunctions.append(
            (plugin[0], "MenuPlugin/scan/" + plugin[2], "Scanning"))
    ButtonSetupFunctions.append(
        (_("Network Settings"),
         "Module/Screens.NetworkSetup/NetworkAdapterSelection", "Setup"))
    ButtonSetupFunctions.append(
        (_("Network menu"), "Infobar/showNetworkMounts", "Setup"))
    ButtonSetupFunctions.append(
        (_("VPN"), "Module/Screens.NetworkSetup/NetworkOpenvpn", "Setup"))
    ButtonSetupFunctions.append(
        (_("Plugin Browser"), "Module/Screens.PluginBrowser/PluginBrowser",
         "Setup"))
    ButtonSetupFunctions.append(
        (_("Channel Info"), "Module/Screens.ServiceInfo/ServiceInfo", "Setup"))
    ButtonSetupFunctions.append(
        (_("SkinSelector"), "Module/Screens.SkinSelector/SkinSelector",
         "Setup"))
    if BoxInfo.getItem("LCDSKINSetup"):
        ButtonSetupFunctions.append(
            (_("LCD SkinSelector"),
             "Module/Screens.SkinSelector/LcdSkinSelector", "Setup"))
    ButtonSetupFunctions.append(
        (_("Timer"), "Module/Screens.TimerEdit/TimerEditList", "Setup"))
    ButtonSetupFunctions.append(
        (_("Open AutoTimer"), "Infobar/showAutoTimerList", "Setup"))
    for plugin in plugins.getPluginsForMenu("system"):
        if plugin[2]:
            ButtonSetupFunctions.append(
                (plugin[0], "MenuPlugin/system/" + plugin[2], "Setup"))
    ButtonSetupFunctions.append(
        (_("Standby"), "Module/Screens.Standby/Standby", "Power"))
    ButtonSetupFunctions.append(
        (_("Restart"), "Module/Screens.Standby/TryQuitMainloop/2", "Power"))
    ButtonSetupFunctions.append(
        (_("Restart enigma"), "Module/Screens.Standby/TryQuitMainloop/3",
         "Power"))
    ButtonSetupFunctions.append(
        (_("Deep standby"), "Module/Screens.Standby/TryQuitMainloop/1",
         "Power"))
    ButtonSetupFunctions.append(
        (_("SleepTimer"), "Module/Screens.SleepTimer/SleepTimer", "Power"))
    ButtonSetupFunctions.append(
        (_("PowerTimer"), "Module/Screens.PowerTimerEdit/PowerTimerEditList",
         "Power"))
    ButtonSetupFunctions.append((_("Usage Setup"), "Setup/Usage", "Setup"))
    ButtonSetupFunctions.append(
        (_("User interface settings"), "Setup/UserInterface", "Setup"))
    ButtonSetupFunctions.append(
        (_("Recording Setup"), "Setup/Recording", "Setup"))
    ButtonSetupFunctions.append(
        (_("Harddisk Setup"), "Setup/HardDisk", "Setup"))
    ButtonSetupFunctions.append(
        (_("Subtitles Settings"), "Setup/Subtitle", "Setup"))
    ButtonSetupFunctions.append(
        (_("Language"), "Module/Screens.LocaleSelection/LocaleSelection",
         "Setup"))
    ButtonSetupFunctions.append(
        (_("OscamInfo Mainmenu"), "Module/Screens.OScamInfo/OscamInfoMenu",
         "Plugins"))
    ButtonSetupFunctions.append(
        (_("CCcamInfo Mainmenu"), "Module/Screens.CCcamInfo/CCcamInfoMain",
         "Plugins"))
    ButtonSetupFunctions.append(
        (_("Movieplayer"), "Infobar/showMoviePlayer", "Plugins"))
    if os.path.isdir("/etc/ppanels"):
        for x in [x for x in os.listdir("/etc/ppanels") if x.endswith(".xml")]:
            x = x[:-4]
            ButtonSetupFunctions.append(
                (_("PPanel") + " " + x, "PPanel/" + x, "PPanels"))
    if os.path.isdir("/usr/script"):
        for x in [x for x in os.listdir("/usr/script") if x.endswith(".sh")]:
            x = x[:-3]
            ButtonSetupFunctions.append((_("Shellscript") + " " + x,
                                         "Shellscript/" + x, "Shellscripts"))
    ButtonSetupFunctions.append(
        (_("ScriptRunner"), "Module/Screens.ScriptRunner/ScriptRunner",
         "Plugins"))
    ButtonSetupFunctions.append(
        (_("QuickMenu"), "Module/Screens.QuickMenu/QuickMenu", "Plugins"))
    if isPluginInstalled("Kodi"):
        ButtonSetupFunctions.append(
            (_("Kodi MediaCenter"), "Kodi/", "Plugins"))
    if isPluginInstalled("BluetoothSetup"):
        ButtonSetupFunctions.append(
            (_("Bluetooth Setup"), "Bluetooth/", "Plugins"))
    if isPluginInstalled("Chromium"):
        ButtonSetupFunctions.append((_("Youtube TV"), "YoutubeTV/", "Plugins"))
    return ButtonSetupFunctions
Exemple #21
0
 def setSizePosMainWindow(self, x=0, y=0, w=0, h=0):
     if BoxInfo.getItem("VideoDestinationConfigurable"):
         self["video"].instance.setFullScreenPosition(eRect(x, y, w, h))
Exemple #22
0
def getButtonSetupKeys():
    return [
        (_("Red"), "red", ""), (_("RED long"), "red_long", ""),
        (_("Green"), "green", ""), (_("GREEN long"), "green_long", ""),
        (_("Yellow"), "yellow", ""), (_("YELLOW long"), "yellow_long", ""),
        (_("Blue"), "blue", ""), (_("BLUE long"), "blue_long", ""),
        (_("Info (EPG)"), "info", "Infobar/InfoPressed/1"),
        (_("Info (EPG) Long"), "info_long", "Infobar/showEventInfoPlugins/1"),
        (_("Epg/Guide"), "epg", "Infobar/EPGPressed/1"),
        (_("Epg/Guide long"), "epg_long", "Infobar/showEventGuidePlugins/1"),
        (_("Left"), "cross_left", ""), (_("Right"), "cross_right", ""),
        (_("Left long"), "cross_left_long", ""),
        (_("Right long"), "cross_right_long", "Infobar/seekFwdVod"),
        (_("Up"), "cross_up", ""), (_("Down"), "cross_down", ""),
        (_("PageUp"), "pageup", ""), (_("PageUp long"), "pageup_long", ""),
        (_("PageDown"), "pagedown", ""),
        (_("PageDown long"), "pagedown_long", ""),
        (_("Channel up"), "channelup", ""),
        (_("Channel down"), "channeldown", ""), (_("EJECTCD"), "ejectcd", ""),
        (_("EJECTCD long"), "ejectcd_long", ""), (_("TV"), "showTv", ""),
        (_("RADIO"), "radio", ""), (_("RADIO long"), "radio_long", ""),
        (_("Rec"), "rec", ""), (_("Rec long"), "rec_long", ""),
        (_("Teletext"), "text", ""), (_("Teletext long"), "text_long", ""),
        (_("Help"), "displayHelp", ""),
        (_("Help long"), "displayHelp_long", ""),
        (_("Subtitle"), "subtitle", ""),
        (_("Subtitle long"), "subtitle_long", ""), (_("Menu"), "mainMenu", ""),
        (_("List/Fav"), "list", ""), (_("List/Fav long"), "list_long", ""),
        (_("PVR"), "pvr", ""), (_("PVR long"), "pvr_long", ""),
        (_("Favorites"), "favorites", ""),
        (_("Favorites long"), "favorites_long", ""), (_("File"), "file", ""),
        (_("File long"), "file_long", ""), (_("OK long"), "ok_long", ""),
        (_("Media"), "media", ""), (_("Media long"), "media_long", ""),
        (_("Open"), "open", ""), (_("Open long"), "open_long", ""),
        (_("Option"), "option", ""), (_("Option long"), "option_long", ""),
        (_("Www"), "www", ""), (_("Www long"), "www_long", ""),
        (_("Directory"), "directory", ""),
        (_("Directory long"), "directory_long", ""),
        (_("Back/Recall"), "back", ""),
        (_("Back/Recall") + " " + _("long"), "back_long", ""),
        (_("History"), "archive", ""), (_("History long"), "archive_long", ""),
        (_("Aspect"), "mode", ""), (_("Aspect long"), "mode_long", ""),
        (_("Home"), "home", ""), (_("Home long"), "home_long", ""),
        (_("End"), "end", ""), (_("End long"), "end_long", ""),
        (_("Next"), "next", ""), (_("Previous"), "previous", ""),
        (_("Audio"), "audio", ""), (_("Audio long"), "audio_long", ""),
        (_("Play"), "play", ""), (_("Playpause"), "playpause", ""),
        (_("Stop"), "stop", ""), (_("Pause"), "pause", ""),
        (_("Rewind"), "rewind", ""), (_("Fastforward"), "fastforward", ""),
        (_("Skip back"), "skip_back", ""),
        (_("Skip forward"), "skip_forward", ""),
        (_("activatePiP"), "activatePiP", ""), (_("Playlist"), "playlist", ""),
        (_("Playlist long"), "playlist_long", ""),
        (_("Nextsong"), "nextsong", ""),
        (_("Nextsong long"), "nextsong_long", ""),
        (_("Prevsong"), "prevsong", ""),
        (_("Prevsong long"), "prevsong_long", ""), (_("Program"), "prog", ""),
        (_("Program long"), "prog_long", ""), (_("Time"), "time", ""),
        (_("Time long"), "time_long", ""), (_("Homepage"), "homep", ""),
        (_("Homepage long"), "homep_long", ""),
        (_("Search/WEB"), "search", ""),
        (_("Search/WEB long"), "search_long", ""), (_("Slow"), "slow", ""),
        (_("Mark/Portal/Playlist"), "mark", ""),
        (_("Mark/Portal/Playlist long"), "mark_long", ""),
        (_("Sleep"), "sleep", ""), (_("Sleep long"), "sleep_long", ""),
        (_("Power"), "power", ""), (_("Power long"), "power_long", ""),
        (_("HDMIin"), "HDMIin", "Infobar/HDMIIn"),
        (_("HDMIin") + " " + _("long"), "HDMIin_long",
         (BoxInfo.getItem("LcdLiveTV") and "Infobar/ToggleLCDLiveTV") or ""),
        (_("Context"), "contextMenu", "Infobar/showExtensionSelection"),
        (_("Context long"), "context_long", ""),
        (_("SAT"), "sat", "Infobar/openSatellites"),
        (_("SAT long"), "sat_long", ""), (_("Prov"), "prov", ""),
        (_("Prov long"), "prov_long", ""), (_("LAN"), "lan", ""),
        (_("LAN long"), "lan_long", ""), (_("PC"), "pc", ""),
        (_("PC long"), "pc_long", ""), (_("F1"), "f1", ""),
        (_("F1 long"), "f1_long", ""), (_("F2"), "f2", ""),
        (_("F2 long"), "f2_long", ""), (_("F3"), "f3", ""),
        (_("F3 long"), "f3_long", ""), (_("F4"), "f4", ""),
        (_("F4 long"), "f4_long", ""), (_("Magic"), "f10", ""),
        (_("Magic long"), "f10_long", ""), (_("PIP"), "f6", ""),
        (_("PIP long"), "f6_long", ""), (_("MOUSE"), "mouse", ""),
        (_("MOUSE long"), "mouse_long", ""), (_("VOD"), "vod", ""),
        (_("VOD long"), "vod_long", ""), (_("Keyboard"), "keyboard", ""),
        (_("Keyboard long"), "keyboard_long", ""), (_("Kodi"), "kodi", ""),
        (_("Kodi long"), "kodi_long", ""), (_("YouTube"), "youtube", ""),
        (_("YouTube long"), "youtube_long", ""), (_("ZOOM"), "zoom", ""),
        (_("ZOOM long"), "zoom_long", "")
    ]
def getHotkeyFunctions():
    hotkey.functions = []
    twinPlugins = []
    twinPaths = {}
    pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_EVENTINFO)
    pluginlist.sort(key=lambda p: p.name)
    for plugin in pluginlist:
        if PY2:
            pycode = plugin.__call__.func_code.co_varnames
        else:
            pycode = plugin.__call__.__code__.co_varnames
        if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in pycode:
            if plugin.path[24:] in twinPaths:
                twinPaths[plugin.path[24:]] += 1
            else:
                twinPaths[plugin.path[24:]] = 1
            hotkey.functions.append((plugin.name, plugin.path[24:] + "/" +
                                     str(twinPaths[plugin.path[24:]]), "EPG"))
            twinPlugins.append(plugin.name)
    pluginlist = plugins.getPlugins([
        PluginDescriptor.WHERE_PLUGINMENU,
        PluginDescriptor.WHERE_EXTENSIONSMENU
    ])
    pluginlist.sort(key=lambda p: p.name)
    for plugin in pluginlist:
        if plugin.name not in twinPlugins and plugin.path:
            if plugin.path[24:] in twinPaths:
                twinPaths[plugin.path[24:]] += 1
            else:
                twinPaths[plugin.path[24:]] = 1
            hotkey.functions.append(
                (plugin.name,
                 plugin.path[24:] + "/" + str(twinPaths[plugin.path[24:]]),
                 "Plugins"))
            twinPlugins.append(plugin.name)
    hotkey.functions.append((_("Main menu"), "Infobar/mainMenu", "InfoBar"))
    hotkey.functions.append((_("Show help"), "Infobar/showHelp", "InfoBar"))
    hotkey.functions.append((_("Show extension selection"),
                             "Infobar/showExtensionSelection", "InfoBar"))
    hotkey.functions.append((_("Zap down"), "Infobar/zapDown", "InfoBar"))
    hotkey.functions.append((_("Zap up"), "Infobar/zapUp", "InfoBar"))
    hotkey.functions.append((_("Volume up"), "Infobar/volumeUp", "InfoBar"))
    hotkey.functions.append(
        (_("Volume down"), "Infobar/volumeDown", "InfoBar"))
    hotkey.functions.append(
        (_("Switch channel up"), "Infobar/switchChannelUp", "InfoBar"))
    hotkey.functions.append(
        (_("Switch channel down"), "Infobar/switchChannelDown", "InfoBar"))
    hotkey.functions.append(
        (_("Show service list"), "Infobar/openServiceList", "InfoBar"))
    hotkey.functions.append(
        (_("Show movies"), "Infobar/showMovies", "InfoBar"))
    hotkey.functions.append(
        (_("Play last movie"), "Infobar/restartLastMovie", "InfoBar"))
    hotkey.functions.append((_("Show servicelist or movies"),
                             "Infobar/showServiceListOrMovies", "InfoBar"))
    hotkey.functions.append(
        (_("Show favourites list"), "Infobar/openFavouritesList", "InfoBar"))
    hotkey.functions.append(
        (_("Show satellites list"), "Infobar/openSatellitesList", "InfoBar"))
    hotkey.functions.append(
        (_("History back"), "Infobar/historyBack", "InfoBar"))
    hotkey.functions.append(
        (_("History next"), "Infobar/historyNext", "InfoBar"))
    hotkey.functions.append(
        (_("Recall to previous service"),
         "Infobar/servicelist/recallPrevService", "InfoBar"))
    hotkey.functions.append(
        (_("Show eventinfo plugins"), "Infobar/showEventInfoPlugins", "EPG"))
    hotkey.functions.append(
        (_("Show event details"), "Infobar/openEventView", "EPG"))
    hotkey.functions.append(
        (_("Show single service EPG"), "Infobar/openSingleServiceEPG", "EPG"))
    hotkey.functions.append(
        (_("Show multi channel EPG"), "Infobar/openMultiServiceEPG", "EPG"))
    hotkey.functions.append(
        (_("Show Audioselection"), "Infobar/audioSelection", "InfoBar"))
    hotkey.functions.append(
        (_("Switch to radio mode"), "Infobar/showRadio", "InfoBar"))
    hotkey.functions.append(
        (_("Switch to TV mode"), "Infobar/showTv", "InfoBar"))
    hotkey.functions.append(
        (_("Toggle TV/RADIO mode"), "Infobar/toggleTvRadio", "InfoBar"))
    hotkey.functions.append(
        (_("Instant recording"), "Infobar/instantRecord", "InfoBar"))
    hotkey.functions.append((_("Start instant recording"),
                             "Infobar/startInstantRecording", "InfoBar"))
    hotkey.functions.append((_("Activate timeshift End"),
                             "Infobar/activateTimeshiftEnd", "InfoBar"))
    hotkey.functions.append(
        (_("Activate timeshift end and pause"),
         "Infobar/activateTimeshiftEndAndPause", "InfoBar"))
    hotkey.functions.append(
        (_("Start timeshift"), "Infobar/startTimeshift", "InfoBar"))
    hotkey.functions.append(
        (_("Stop timeshift"), "Infobar/stopTimeshift", "InfoBar"))
    hotkey.functions.append(
        (_("Start teletext"), "Infobar/startTeletext", "InfoBar"))
    hotkey.functions.append((_("Show subservice selection"),
                             "Infobar/subserviceSelection", "InfoBar"))
    hotkey.functions.append(
        (_("Show subtitle selection"), "Infobar/subtitleSelection", "InfoBar"))
    hotkey.functions.append(
        (_("Show InfoBar"), "Infobar/showFirstInfoBar", "InfoBar"))
    hotkey.functions.append(
        (_("Show second InfoBar"), "Infobar/showSecondInfoBar", "InfoBar"))
    hotkey.functions.append(
        (_("Toggle infoBar"), "Infobar/toggleShow", "InfoBar"))
    hotkey.functions.append(
        (_("Toggle videomode"), "Infobar/ToggleVideoMode", "InfoBar"))
    hotkey.functions.append((_("Toggle subtitles show/hide"),
                             "Infobar/toggleSubtitleShown", "InfoBar"))
    if BoxInfo.getItem("PIPAvailable"):
        hotkey.functions.append((_("Show PiP"), "Infobar/showPiP", "InfoBar"))
        hotkey.functions.append((_("Swap PiP"), "Infobar/swapPiP", "InfoBar"))
        hotkey.functions.append((_("Move PiP"), "Infobar/movePiP", "InfoBar"))
        hotkey.functions.append(
            (_("Toggle PiPzap"), "Infobar/togglePipzap", "InfoBar"))
    hotkey.functions.append((_("Activate HbbTV (Redbutton)"),
                             "Infobar/activateRedButton", "InfoBar"))
    if BoxInfo.getItem("HasHDMIin"):
        hotkey.functions.append(
            (_("Toggle HDMI In"), "Infobar/HDMIIn", "InfoBar"))
        hotkey.functions.append(
            (_("Toggle HDMI-In full screen"), "Infobar/HDMIInFull", "InfoBar"))
        hotkey.functions.append(
            (_("Toggle HDMI-In PiP"), "Infobar/HDMIInPiP", "InfoBar"))
    if BoxInfo.getItem("LcdLiveTV"):
        hotkey.functions.append(
            (_("Toggle LCD LiveTV"), "Infobar/ToggleLCDLiveTV", "InfoBar"))
    hotkey.functions.append(
        (_("Toggle dashed flickering line for this service"),
         "Infobar/ToggleHideVBI", "InfoBar"))
    hotkey.functions.append((_("Do nothing"), "Void", "InfoBar"))
    if BoxInfo.getItem("HasHDMI-CEC"):
        hotkey.functions.append((_("HDMI-CEC Source Active"),
                                 "Infobar/SourceActiveHdmiCec", "InfoBar"))
        hotkey.functions.append((_("HDMI-CEC Source Inactive"),
                                 "Infobar/SourceInactiveHdmiCec", "InfoBar"))
    if BoxInfo.getItem("HasSoftcamInstalled"):
        hotkey.functions.append((_("Softcam Setup"), "SoftcamSetup", "Setup"))
    hotkey.functions.append(
        (_("HotKey Setup"), "Module/Screens.Hotkey/HotkeySetup", "Setup"))
    hotkey.functions.append(
        (_("Software update"), "Module/Screens.SoftwareUpdate/SoftwareUpdate",
         "Setup"))
    hotkey.functions.append(
        (_("Latest Commits"),
         "Module/Screens.Information/CommitLogInformation", "Setup"))
    hotkey.functions.append((_("CI (Common Interface) Setup"),
                             "Module/Screens.Ci/CiSelection", "Setup"))
    hotkey.functions.append(
        (_("Tuner Configuration"), "Module/Screens.Satconfig/NimSelection",
         "Scanning"))
    hotkey.functions.append(
        (_("Manual Scan"), "Module/Screens.ScanSetup/ScanSetup", "Scanning"))
    hotkey.functions.append(
        (_("Automatic Scan"), "Module/Screens.ScanSetup/ScanSimple",
         "Scanning"))
    for plugin in plugins.getPluginsForMenu("scan"):
        hotkey.functions.append(
            (plugin[0], "MenuPlugin/scan/" + plugin[2], "Scanning"))
    hotkey.functions.append(
        (_("Network"), "Module/Screens.NetworkSetup/NetworkAdapterSelection",
         "Setup"))
    hotkey.functions.append(
        (_("Skin"), "Module/Screens.SkinSelector/SkinSelector", "Setup"))
    hotkey.functions.append(
        (_("Display skin"), "Module/Screens.SkinSelector/LcdSkinSelector",
         "Setup"))
    hotkey.functions.append(
        (_("Plugin Browser"), "Module/Screens.PluginBrowser/PluginBrowser",
         "Setup"))
    hotkey.functions.append(
        (_("Sleeptimer edit"), "Module/Screens.SleepTimerEdit/SleepTimerEdit",
         "Setup"))
    hotkey.functions.append(
        (_("Channel Info"), "Module/Screens.ServiceInfo/ServiceInfo", "Setup"))
    hotkey.functions.append(
        (_("Timer"), "Module/Screens.TimerEdit/TimerEditList", "Setup"))
    for plugin in plugins.getPluginsForMenu("system"):
        if plugin[2]:
            hotkey.functions.append(
                (plugin[0], "MenuPlugin/system/" + plugin[2], "Setup"))
    for plugin in plugins.getPluginsForMenu("video"):
        if plugin[2]:
            hotkey.functions.append(
                (plugin[0], "MenuPlugin/video/" + plugin[2], "Setup"))
    for plugin in plugins.getPluginsForMenu("gui"):
        if plugin[2]:
            hotkey.functions.append(
                (plugin[0], "MenuPlugin/gui/" + plugin[2], "Setup"))
    hotkey.functions.append((_("PowerMenu"), "Menu/shutdown", "Power"))
    hotkey.functions.append(
        (_("Standby"), "Module/Screens.Standby/Standby", "Power"))
    hotkey.functions.append(
        (_("Restart"), "Module/Screens.Standby/TryQuitMainloop/2", "Power"))
    hotkey.functions.append(
        (_("Restart enigma"), "Module/Screens.Standby/TryQuitMainloop/3",
         "Power"))
    hotkey.functions.append(
        (_("Deep standby"), "Module/Screens.Standby/TryQuitMainloop/1",
         "Power"))
    hotkey.functions.append((_("Usage Setup"), "Setup/usage", "Setup"))
    hotkey.functions.append(
        (_("User interface"), "Setup/userinterface", "Setup"))
    hotkey.functions.append((_("Recording Setup"), "Setup/recording", "Setup"))
    hotkey.functions.append((_("Harddisk Setup"), "Setup/harddisk", "Setup"))
    hotkey.functions.append(
        (_("Subtitles Settings"), "Setup/subtitlesetup", "Setup"))
    hotkey.functions.append(
        (_("Locale/Language"),
         "Module/Screens.LocaleSelection/LocaleSelection", "Setup"))
    hotkey.functions.append(
        (_("OScam Info"), "Module/Screens.OScamInfo/OscamInfoMenu", "Plugins"))
    hotkey.functions.append(
        (_("Memory Info"), "Module/Screens.Information/MemoryInformation",
         "Setup"))
    if BoxInfo.getItem("canMultiBoot"):
        hotkey.functions.append(
            (_("MultiBoot Image Selector"),
             "Module/Screens.FlashImage/MultiBootSelection", "Setup"))
    if os.path.isdir("/etc/ppanels"):
        for x in [x for x in os.listdir("/etc/ppanels") if x.endswith(".xml")]:
            x = x[:-4]
            hotkey.functions.append(
                (_("PPanel") + " " + x, "PPanel/" + x, "PPanels"))
    if os.path.isdir("/usr/script"):
        for x in [x for x in os.listdir("/usr/script") if x.endswith(".sh")]:
            x = x[:-3]
            hotkey.functions.append((_("Shellscript") + " " + x,
                                     "Shellscript/" + x, "Shellscripts"))
Exemple #24
0
from Components.Opkg import OpkgComponent
from Components.Pixmap import Pixmap
from Components.ScrollLabel import ScrollLabel
from Components.Slider import Slider
from Components.SystemInfo import BoxInfo
from Components.Sources.List import List
from Components.Sources.StaticText import StaticText
from Screens.HelpMenu import HelpableScreen
from Screens.MessageBox import MessageBox
from Screens.ParentalControlSetup import ProtectedScreen
from Screens.Screen import Screen, ScreenSummary
from Screens.Standby import QUIT_REBOOT, TryQuitMainloop
from Tools.Directories import SCOPE_GUISKIN, resolveFilename
from Tools.LoadPixmap import LoadPixmap

displayBrand = BoxInfo.getItem("displaybrand")
displayModel = BoxInfo.getItem("displaymodel")


class SoftwareUpdate(Screen, HelpableScreen, ProtectedScreen):
    FEED_UNKNOWN = 0
    FEED_DISABLED = 1
    FEED_UNSTABLE = 2
    FEED_STABLE = 3

    skin = [
        """
	<screen name="SoftwareUpdate" title="Software Update" position="center,center" size="%d,%d" >
		<widget name="traffic_off" position="%d,%d" size="%d,%d" alphatest="blend" pixmap="icons/traffic_off.png" scale="1" />
		<widget name="traffic_red" position="%d,%d" size="%d,%d" alphatest="blend" pixmap="icons/traffic_red.png" scale="1" />
		<widget name="traffic_yellow" position="%d,%d" size="%d,%d" alphatest="blend" pixmap="icons/traffic_yellow.png" scale="1" />
 def execHotkey(self, selected):
     if selected:
         if not hasattr(self.session,
                        "infobar") or self.session.infobar is None:
             self.session.infobar = self
         selected = selected[1].split("/")
         if selected[0] == "Plugins":
             twinPlugins = []
             twinPaths = {}
             pluginlist = plugins.getPlugins(
                 PluginDescriptor.WHERE_EVENTINFO)
             pluginlist.sort(key=lambda p: p.name)
             for plugin in pluginlist:
                 if PY2:
                     pycode = plugin.__call__.func_code.co_varnames
                 else:
                     pycode = plugin.__call__.__code__.co_varnames
                 if plugin.name not in twinPlugins and plugin.path and 'selectedevent' not in pycode:
                     if plugin.path[24:] in twinPaths:
                         twinPaths[plugin.path[24:]] += 1
                     else:
                         twinPaths[plugin.path[24:]] = 1
                     if plugin.path[24:] + "/" + str(twinPaths[
                             plugin.path[24:]]) == "/".join(selected):
                         self.runPlugin(plugin)
                         return
                     twinPlugins.append(plugin.name)
             pluginlist = plugins.getPlugins([
                 PluginDescriptor.WHERE_PLUGINMENU,
                 PluginDescriptor.WHERE_EXTENSIONSMENU
             ])
             pluginlist.sort(key=lambda p: p.name)
             for plugin in pluginlist:
                 if plugin.name not in twinPlugins and plugin.path:
                     if plugin.path[24:] in twinPaths:
                         twinPaths[plugin.path[24:]] += 1
                     else:
                         twinPaths[plugin.path[24:]] = 1
                     if plugin.path[24:] + "/" + str(twinPaths[
                             plugin.path[24:]]) == "/".join(selected):
                         self.runPlugin(plugin)
                         return
                     twinPlugins.append(plugin.name)
         elif selected[0] == "MenuPlugin":
             for plugin in plugins.getPluginsForMenu(selected[1]):
                 if plugin[2] == selected[2]:
                     self.runPlugin(plugin[1])
                     return
         elif selected[0] == "Infobar":
             if hasattr(self, selected[1]):
                 exec("self." + ".".join(selected[1:]) + "()")
             else:
                 return 0
         elif selected[0] == "Module":
             try:
                 exec("from %s import %s" % (selected[1], selected[2]))
                 exec("self.session.open(%s)" % ",".join(selected[2:]))
             except Exception as e:
                 print(
                     "[Hotkey] error during executing module %s, screen %s, %s"
                     % (selected[1], selected[2], e))
                 import traceback
                 traceback.print_exc()
         elif selected[0] == "SoftcamSetup" and BoxInfo.getItem(
                 "HasSoftcamInstalled"):
             from Screens.SoftcamSetup import SoftcamSetup
             self.session.open(SoftcamSetup)
         elif selected[0] == "Setup":
             from Screens.Setup import Setup
             exec("self.session.open(Setup, \"%s\")" % selected[1])
         elif selected[0].startswith("Zap"):
             if selected[0] == "ZapPanic":
                 self.servicelist.history = []
                 self.pipShown() and self.showPiP()
             self.servicelist.servicelist.setCurrent(
                 eServiceReference("/".join(selected[1:])))
             self.servicelist.zap(enable_pipzap=True)
             if hasattr(self, "lastservice"):
                 self.lastservice = eServiceReference("/".join(
                     selected[1:]))
                 self.close()
             else:
                 self.show()
             from Screens.MovieSelection import defaultMoviePath
             moviepath = defaultMoviePath()
             if moviepath:
                 config.movielist.last_videodir.value = moviepath
         elif selected[0] == "PPanel":
             ppanelFileName = '/etc/ppanels/' + selected[1] + ".xml"
             if os.path.isfile(ppanelFileName) and os.path.isdir(
                     resolveFilename(SCOPE_PLUGINS, 'Extensions/PPanel')):
                 from Plugins.Extensions.PPanel.ppanel import PPanel
                 self.session.open(PPanel,
                                   name=selected[1] + ' PPanel',
                                   node=None,
                                   filename=ppanelFileName,
                                   deletenode=None)
         elif selected[0] == "Shellscript":
             command = '/usr/script/' + selected[1] + ".sh"
             if os.path.isfile(command):
                 if ".hidden." in command:
                     from enigma import eConsoleAppContainer
                     eConsoleAppContainer().execute(command)
                 else:
                     from Screens.Console import Console
                     self.session.open(
                         Console,
                         selected[1] + " shellscript",
                         command,
                         closeOnSuccess=selected[1].startswith('!'),
                         showStartStopText=False)
         elif selected[0] == "Menu":
             from Screens.Menu import MainMenu, mdom
             root = mdom.getroot()
             for x in root.findall("menu"):
                 y = x.find("id")
                 if y is not None:
                     id = y.get("val")
                     if id and id == selected[1]:
                         menu_screen = self.session.open(MainMenu, x)
                         break
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
from Components.config import config, ConfigSlider, ConfigSelection, ConfigYesNo, ConfigEnableDisable, ConfigOnOff, ConfigSubsection, ConfigBoolean, ConfigSelectionNumber, ConfigNothing, NoSave
from enigma import eAVSwitch, eDVBVolumecontrol, getDesktop
from Components.SystemInfo import BoxInfo
import os

model = BoxInfo.getItem("model")
platform = BoxInfo.getItem("platform")


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

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

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

    def setSystem(self, value):
        eAVSwitch.getInstance().setVideomode(value)

    def getOutputAspect(self):
        valstr = config.av.aspectratio.value
        if valstr in ("4_3_letterbox", "4_3_panscan"):  # 4:3
            return (4, 3)
        elif valstr == "16_9":  # auto ... 4:3 or 16:9
Exemple #27
0
    def __init__(self, session):
        Screen.__init__(self, session)
        self.skinName = "Standby"
        self.avswitch = AVSwitch()

        print("[Standby] enter standby")
        BoxInfo.setItem("StandbyState", True)

        if os.path.exists("/usr/script/StandbyEnter.sh"):
            Console().ePopen("/usr/script/StandbyEnter.sh &")

        self["actions"] = ActionMap(
            ["StandbyActions"], {
                "power": self.Power,
                "power_make": self.Power_make,
                "power_break": self.Power_break,
                "power_long": self.Power_long,
                "power_repeat": self.Power_repeat,
                "discrete_on": self.Power
            }, -1)

        globalActionMap.setEnabled(False)

        self.ignoreKeyBreakTimer = eTimer()
        self.standbyStopServiceTimer = eTimer()
        self.standbyStopServiceTimer.callback.append(self.stopService)
        self.timeHandler = None

        #mute adc
        self.setMute()

        if BoxInfo.getItem("Display") and BoxInfo.getItem("LCDMiniTV"):
            # set LCDminiTV off
            setLCDModeMinitTV("0")

        self.paused_service = None
        self.prev_running_service = None

        self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup(
        )
        service = self.prev_running_service and self.prev_running_service.toString(
        )
        if service:
            if service.startswith("1:") and service.rsplit(
                    ":", 1)[1].startswith("/"):
                self.paused_service = self.session.current_dialog
                self.paused_service.pauseService()
        if not self.paused_service:
            self.timeHandler = eDVBLocalTimeHandler.getInstance()
            if self.timeHandler.ready():
                if self.session.nav.getCurrentlyPlayingServiceOrGroup():
                    self.stopService()
                else:
                    self.standbyStopServiceTimer.startLongTimer(5)
                self.timeHandler = None
            else:
                self.timeHandler.m_timeUpdated.get().append(self.stopService)

        if self.session.pipshown:
            from Screens.InfoBar import InfoBar
            InfoBar.instance and hasattr(
                InfoBar.instance, "showPiP") and InfoBar.instance.showPiP()

        #set input to vcr scart
        if BoxInfo.getItem("ScartSwitch"):
            self.avswitch.setInput("SCART")
        else:
            self.avswitch.setInput("AUX")
        if (getBrandOEM() in ('fulan', 'clap', 'dinobot') or getMachineBuild()
                in ('gbmv200', 'sf8008', 'sf8008m', 'sf8008opt', 'ustym4kpro',
                    'beyonwizv2', 'viper4k')):
            try:
                open("/proc/stb/hdmi/output", "w").write("off")
            except:
                pass

        if int(
                config.usage.hdd_standby_in_standby.value
        ) != -1:  # HDD standby timer value (box in standby) / -1 = same as when box is active
            for hdd in harddiskmanager.HDDList():
                hdd[1].setIdleTime(
                    int(config.usage.hdd_standby_in_standby.value))

        self.onFirstExecBegin.append(self.__onFirstExecBegin)
        self.onClose.append(self.__onClose)
 def setMultichannelPCM(configElement):
     print("[AVSwitch] Write to /proc/stb/audio/multichannel_pcm")
     open(BoxInfo.getItem("HasMultichannelPCM"),
          "w").write(configElement.value and "enable" or "disable")
Exemple #29
0
	def setMode(self, port, mode, rate, force=None):
		print("[Videomode] VideoHardware setMode - port:", port, "mode:", mode, "rate:", rate)
		# we can ignore "port"
		self.current_mode = mode
		self.current_port = port
		modes = self.rates[mode][rate]

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

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

		if platform == "dmamlogic":
			open('/sys/class/display/mode', 'w').write('576i50hz')
			amlmode = mode + rate.lower()
			print("[Videomode] Write to /sys/class/display/mode")
			open('/sys/class/display/mode', 'w').write(amlmode)
			print("[Videomode] Write to /sys/class/ppmgr/ppscaler")
			open('/sys/class/ppmgr/ppscaler', 'w').write('1')
			print("[Videomode] Write to /sys/class/ppmgr/ppscaler")
			open('/sys/class/ppmgr/ppscaler', 'w').write('0')
			size_width = getDesktop(0).size().width()
			if size_width >= 1920:
				Console().ePopen('fbset -fb /dev/fb0  -g 1920 1080 1920 3240  32')
			else:
				Console().ePopen('fbset -fb /dev/fb0  -g 1280 720 1280 2160  32')
			return
		try:
			print("[Videomode] Write to /proc/stb/video/videomode_50hz")
			open("/proc/stb/video/videomode_50hz", "w").write(mode_50)
			print("[Videomode] Write to /proc/stb/video/videomode_60hz")
			open("/proc/stb/video/videomode_60hz", "w").write(mode_60)
		except IOError:
			print("[Videomode] Write to /proc/stb/video/videomode_50hz failed.")
			print("[Videomode] Write to /proc/stb/video/videomode_60hz failed.")
			try:
				# fallback if no possibility to setup 50/60 hz mode
				print("[Videomode] Write to /proc/stb/video/videomode")
				open("/proc/stb/video/videomode", "w").write(mode_50)
			except IOError:
				print("[Videomode] Write to /proc/stb/video/videomode failed.")

		if BoxInfo.getItem("Has24hz"):
			try:
				print("[Videomode] Write to /proc/stb/video/videomode_24hz")
				open("/proc/stb/video/videomode_24hz", "w").write(mode_24)
			except IOError:
				print("[Videomode] Write to /proc/stb/video/videomode_24hz failed.")

		if brand == "gigablue":
			try:
				# use 50Hz mode (if available) for booting
				print("[Videomode] Write to /etc/videomode")
				open("/etc/videomode", "w").write(mode_50)
			except IOError:
				print("[Videomode] Write to /etc/videomode failed.")

		self.updateAspect(None)
def getVisionModule():
    if BoxInfo.getItem("OpenVisionModule"):
        return _("Loaded")
    print("[About] No Open Vision module!  Hard MultiBoot?")
    return _("Unknown")