示例#1
0
 def blue(self):
     import boxbranding
     print "getMachineBuild=%s<" % boxbranding.getMachineBuild()
     print "getMachineProcModel=%s<" % boxbranding.getMachineProcModel()
     print "getMachineBrand=%s<" % boxbranding.getMachineBrand()
     print "getMachineName=%s<" % boxbranding.getMachineName()
     print "getMachineMtdKernel=%s<" % boxbranding.getMachineMtdKernel()
     print "getMachineKernelFile=%s<" % boxbranding.getMachineKernelFile()
     print "getMachineMtdRoot=%s<" % boxbranding.getMachineMtdRoot()
     print "getMachineRootFile=%s<" % boxbranding.getMachineRootFile()
     print "getMachineMKUBIFS=%s<" % boxbranding.getMachineMKUBIFS()
     print "getMachineUBINIZE=%s<" % boxbranding.getMachineUBINIZE()
     print "getBoxType=%s<" % boxbranding.getBoxType()
     print "getBrandOEM=%s<" % boxbranding.getBrandOEM()
     print "getOEVersion=%s<" % boxbranding.getOEVersion()
     print "getDriverDate=%s<" % boxbranding.getDriverDate()
     print "getImageVersion=%s<" % boxbranding.getImageVersion()
     print "getImageBuild=%s<" % boxbranding.getImageBuild()
     print "getImageDistro=%s<" % boxbranding.getImageDistro()
     print "getImageFolder=%s<" % boxbranding.getImageFolder()
     print "getImageFileSystem=%s<" % boxbranding.getImageFileSystem()
     if self.check_hdd():
         self.session.open(doFlashImage,
                           online=False,
                           list=self.list[self.selection],
                           multi=self.multi,
                           devrootfs=self.devrootfs)
     else:
         self.close()
示例#2
0
    def preWidgetRemove(self, instance):
        self.mTimer.stop()

        try:
            from boxbranding import getImageDistro, getImageVersion, getOEVersion
            self.mTimer.callback.remove(self.movingLoop)
        except:
            if getMachineBrand() == "Dream Multimedia" or getOEVersion(
            ) == "OE 2.2":
                self.mTimer_conn = self.mTimer.timeout.disconnect(
                    self.movingLoop)
        """		
		self.mTimer.callback.remove(self.movingLoop)
		"""

        self.mTimer = None
        self.scroll_label = None
示例#3
0
def getInfo(session=None, need_fullinfo=False):
    # TODO: get webif versione somewhere!
    info = {}
    global STATICBOXINFO

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

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

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

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

    info['chipset'] = chipset

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    info['transcoding'] = TRANSCODING

    info['EX'] = ''

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

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

                sname = ''
                timers = []
                for timer in NavigationInstance.instance.RecordTimer.timer_list:
                    if timer.isRunning() and not timer.justplay:
                        timers.append(
                            removeBad(timer.service_ref.getServiceName()))
                        print("[OpenWebif] -D- timer '%s'" %
                              timer.service_ref.getServiceName())


# TODO: more than one recording
                if len(timers) == 1:
                    sname = timers[0]

                if sname == '' and s_name != '':
                    sname = s_name

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

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

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

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

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

    STATICBOXINFO = info
    return info
    def action(self, req):
        global Mode
        global ModeOld
        global Element
        global ElementList
        global ExeMode
        global StatusMode
        IP = req.getClientIP()
        if getOEVersion() == "OE-Alliance 4.3":
            IP = IP.split(":")[-1]
        L4logE("IP1:", IP)
        if IP is None:
            IP = req.client.host.split(":")[-1]
            L4logE("IP2:", req.client.host)
            if IP.find(".") == -1:
                IP = None
        if IP is None:
            Block = False
        else:
            Block = True
            WL = LCD4linux.WebIfAllow.value
            for x in WL.split():
                if IP.startswith(x):
                    Block = False
                    break
            if "*" in WL:
                Block = False
            WL = LCD4linux.WebIfDeny.value
            for x in WL.split():
                if IP.startswith(x):
                    Block = True
                    break
        if Block == True:
            html = "<html>"
            html += "<head>\n"
            html += "<meta http-equiv=\"Content-Language\" content=\"de\">\n"
            html += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">\n"
            html += "<meta http-equiv=\"cache-control\" content=\"no-cache\" />\n"
            html += "<meta http-equiv=\"pragma\" content=\"no-cache\" />\n"
            html += "<meta http-equiv=\"expires\" content=\"0\">\n"
            html += "</head>"
            html += "Config-WebIF Access Deny ( IP: %s )<br>\n" % IP
            html += "Please check Setting in Global > %s\n" % _l(
                _("WebIF IP Allow"))
            html += "Default is: 127. 192.168. 172. 10.\n"
            html += "</body>\n"
            html += "</html>\n"
            return html
        if len(L1) == 0:
            ParseCode()

        req.setResponseCode(http.OK)
        req.setHeader('Content-type', 'text/html')
        req.setHeader('charset', 'UTF-8')

        command = req.args.get("cmd", None)
        ex = req.args.get("ex", None)
        mo = req.args.get("Mode", None)
        el = req.args.get("Element", None)
        self.restartTimer()
        L4log("Command received %s" % (command), ex)
        #		print "[L4L EX]-", ex,"-"
        if self.CurrentMode == ("-", "-"):
            self.CurrentMode = (getConfigStandby(), getisMediaPlayer())
        if mo is not None:
            Mode = mo[0]
            setConfigMode(True)
            if Mode in ["1", "2"]:
                setisMediaPlayer("")
                setConfigStandby(False)
            elif Mode == "3":
                setisMediaPlayer("config")
                setConfigStandby(False)
            elif Mode == "4":
                setisMediaPlayer("")
                setConfigStandby(True)
            elif Mode == "5":
                self.resetWeb()
            getBilder()
        html = ""
        if el is not None:
            Element = el[0]
        if req.args.get("save.y", None) is not None:
            L4log("WebIF: save Config-File")
            LCD4linux.save()
            LCD4linux.saveToFile(LCD4config)
            ConfTimeCheck()
        if req.args.get("download.y", None) is not None:
            L4log("WebIF: download Config")
            req.setResponseCode(http.OK)
            lcd4config = "/etc/enigma2/lcd4config"
            req.setHeader('Content-type', 'text/plain')
            req.setHeader('Content-Disposition',
                          'attachment;filename=lcd4config')
            req.setHeader('Content-Length', os.stat(lcd4config).st_size)
            req.setHeader('charset', 'UTF-8')
            f = open(lcd4config, "r")
            html = f.read()
            f.close()
            return html
        if req.args.get("upload.y", None) is not None:
            L4log("WebIF: upload Config")
            lcd4config = "/tmp/test"
            data = req.args["uploadName"][0]
            if len(data) > 0 and data.startswith("config."):
                f = open(lcd4config, "wb")
                f.write(data)
                f.close()
                if os.path.isfile(lcd4config):
                    L4LoadNewConfig(lcd4config)
            else:
                L4log("WebIF: Error upload")
                html += "<script language=\"JavaScript\">\n"
                html += "alert(\"%s\")\n" % _(
                    "No or wrong File selected, try a correct File first !")
                html += "</script>\n"
        if req.args.get("logdel.y", None) is not None:
            L4log("WebIF: delete Logfile")
            rmFile("/tmp/L4log.txt")
        if req.args.get("logdownload.y", None) is not None:
            L4log("WebIF: download Logfile")
            lcd4config = "/tmp/L4log.txt"
            if os.path.isfile(lcd4config):
                req.setResponseCode(http.OK)
                req.setHeader('Content-type', 'text/plain')
                req.setHeader('Content-Disposition',
                              'attachment;filename=l4log.txt')
                req.setHeader('Content-Length', os.stat(lcd4config).st_size)
                req.setHeader('charset', 'UTF-8')
                f = open(lcd4config, "r")
                html = f.read()
                f.close()
                return html

        if command is None:
            L4logE("no command")
        elif command[0] == "exec" and ex is not None:
            L4logE("exec", ex[0])
            exec(ex[0])
        elif command[0] == "enable":
            ExeMode = True
        elif command[0] == "status":
            StatusMode = True
        elif command[0] == "pop":
            V = _l(req.args.get("PopText", "")[0])
            try:
                import HTMLParser
                parse = HTMLParser.HTMLParser()
                V = parse.unescape(V)
            except:
                L4log("WebIF Error: Parse Text")
            setPopText(V)
            L4LElement.setRefresh()
        elif command[0] == "popclear":
            setPopText("")
        elif command[0].startswith("Screen"):
            setScreenActive(command[0][-1])
            L4LElement.setRefresh()
        elif command[0] == "crashdel":
            rmFile(CrashFile)
        elif command[0] == "add" and ex is not None:
            L4LElement.web(ex[0])
        elif command[0] == "delete" and ex is not None:
            L4LElement.delete(ex[0])
        elif command[0] == "refresh":
            L4LElement.setRefresh()
        elif command[0] == "hold":
            setScreenActive("0")
            setSaveEventListChanged(not getSaveEventListChanged())
        elif command[0] == "screen" and ex is not None:
            exs = ex[0].split(",")
            if len(exs) == 1:
                L4LElement.setScreen(exs[0])
            elif len(exs) == 2:
                L4LElement.setScreen(exs[0], exs[1])
            elif len(exs) == 3:
                L4LElement.setScreen(exs[0], exs[1], exs[2])
        elif command[0] == "brightness" and ex is not None:
            exs = ex[0].split(",")
            if len(exs) == 1:
                L4LElement.setBrightness(exs[0])
            elif len(exs) == 2:
                L4LElement.setBrightness(exs[0], exs[1])
        elif command[0] == "getbrightness" and ex is not None:
            if int(ex[0]) < 1 or int(ex[0]) > 3:
                return "0"
            else:
                return str(L4LElement.getBrightness(int(ex[0])))
        elif command[0] == "getmjpeg" and ex is not None:
            if int(ex[0]) < 1 or int(ex[0]) > 3:
                return "0"
            else:
                return str(getMJPEGreader(ex[0]))
        elif command[0] == "getexec" and ex is not None:
            L4logE("getexec", ex[0])
            exec("getexec = " + ex[0])
            return str(getexec)
        elif command[0] == "copyMP":
            for a in req.args.keys():
                if ".Standby" in a:
                    b = a.replace(".Standby", ".MP")
                    if (" " + b) in zip(*L3)[2]:
                        print a, b
                        exec("%s.value = %s.value" % (b, a))
                elif "." in a:
                    b = a.replace(".", ".MP")
                    if (" " + b) in zip(*L3)[2]:
                        print a, b
                        exec("%s.value = %s.value" % (b, a))
        elif command[0] == "copyIdle":
            for a in req.args.keys():
                if ".MP" in a:
                    b = a.replace(".MP", ".Standby")
                    if (" " + b) in zip(*L4)[2]:
                        print a, b
                        exec("%s.value = %s.value" % (b, a))
                elif "." in a:
                    b = a.replace(".", ".Standby")
                    if (" " + b) in zip(*L4)[2]:
                        print a, b
                        exec("%s.value = %s.value" % (b, a))
        elif command[0] == "copyOn":
            for a in req.args.keys():
                if ".MP" in a:
                    b = a.replace(".MP", ".")
                    if (" " + b) in zip(*L2)[2]:
                        print a, b
                        exec("%s.value = %s.value" % (b, a))
                elif ".Standby" in a:
                    b = a.replace(".Standby", ".")
                    if (" " + b) in zip(*L2)[2]:
                        print a, b
                        exec("%s.value = %s.value" % (b, a))

#####################
# Konfig schreiben
#####################
        elif command[0] == "config":
            Cfritz = False
            Cwetter = False
            Cpicon = False
            Ccal = False
            Cwww = False
            for a in req.args.keys():
                if a.find(".") > 0:
                    #ConfigSelection
                    exec("Typ = isinstance(%s,ConfigSelection)" % a)
                    if Typ == True:
                        exec("%s.value = '%s'" % (a, req.args.get(a, "")[0]))
                    else:
                        #ConfigYesNo
                        exec("Typ = isinstance(%s,ConfigYesNo)" % a)
                        if Typ == True:
                            if len(req.args.get(a, "")) == 2:
                                exec("%s.value = True" % a)
                            else:
                                exec("%s.value = False" % a)
                        else:
                            #ConfigText
                            exec("Typ = isinstance(%s,ConfigText)" % a)
                            if Typ == True:
                                V = _l(req.args.get(a, "")[0])
                                try:
                                    import HTMLParser
                                    parse = HTMLParser.HTMLParser()
                                    V = parse.unescape(V)
                                except:
                                    L4log("WebIF Error: Parse Text")
                                exec("%s.value = '%s'" % (a, V))
                            else:
                                #ConfigSlider
                                exec("Typ = isinstance(%s,ConfigSlider)" % a)
                                if Typ == True:
                                    if req.args.get(a, "")[0].isdigit():
                                        exec("%s.value = %s" %
                                             (a, req.args.get(a, "")[0]))
                                else:
                                    #ConfigClock
                                    exec("Typ = isinstance(%s,ConfigClock)" %
                                         a)
                                    if Typ == True:
                                        t = req.args.get(a, "")[0].split(":")
                                        if len(t) == 2:
                                            if t[0].isdigit() and t[1].isdigit(
                                            ):
                                                w1 = "[%s,%s]" % (int(
                                                    t[0]), int(t[1]))
                                                exec("%s.value = %s" % (a, w1))
                    exec("C = %s.isChanged()" % a)
                    if C:
                        exec("C = %s.save()" % a)
                        L4log("Changed", a)
                        if a.find("Fritz") > 0:
                            Cfritz = True
                        elif a.find("Wetter") > 0:
                            Cwetter = True
                        elif a.find("Picon") > 0:
                            Cpicon = True
                        elif a.find(".Cal") > 0 or a.find(
                                ".MPCal") > 0 or a.find(".StandbyCal") > 0:
                            Ccal = True
                        elif a.find(".xmlType") > 0:
                            if a.find(".xmlLCDType") > 0:
                                xmlRead()
                                if xmlDelete(1) or xmlDelete(2) or xmlDelete(
                                        3):
                                    L4log("removed old Skindata")
                                    xmlWrite()
                            if xmlSkin():
                                xmlWrite()
                                LCD4linuxConfigweb.RestartGUI = True
                            xmlClear()
                        elif a.find(".MJPEG") > 0:
                            MJPEG_stop("")
                            MJPEG_start()
                        elif a.find(".Font") > 0:
                            setFONT(LCD4linux.Font.value)
                        if a.find("WetterCity") > 0:
                            resetWetter()
                        if a.find("ScreenActive") > 0:
                            setScreenActive(LCD4linux.ScreenActive.value)
                        if a.find("BildFile") > 0:
                            getBilder()
                        if a.find("WWW1") > 0:
                            if a.find("WWW1url") > 0 or os.path.isfile(
                                    WWWpic % "1") == False:
                                Cwww = True
                            else:
                                rmFile(WWWpic % "1p")
            if Cfritz:
                rmFile(PICfritz)
            if Cwetter:
                resetWetter()
            if Cpicon:
                if len(LCD4linux.PiconCache.value) > 2:
                    rmFiles(os.path.join(LCD4linux.PiconCache.value, "*.png"))
                if len(LCD4linux.Picon2Cache.value) > 2:
                    rmFiles(os.path.join(LCD4linux.Picon2Cache.value, "*.png"))
            if Ccal:
                resetCal()
            if Cwww:
                getWWW()

            L4LElement.setRefresh()
#####################
# Anzeige
#####################
        html += "<html>"
        html += "<head>\n"
        html += "<meta http-equiv=\"Content-Language\" content=\"de\">\n"
        html += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"
        html += "<meta http-equiv=\"cache-control\" content=\"no-cache\" />\n"
        html += "<meta http-equiv=\"pragma\" content=\"no-cache\" />\n"
        html += "<meta http-equiv=\"expires\" content=\"0\">\n"
        html += "<link rel=\"shortcut icon\" href=\"/lcd4linux/data/favicon.png\">"
        if os.path.isfile(CrashFile):
            html += "<script language=\"JavaScript\">\n"
            html += "function fensterchen() {\n"
            html += "fens1=window.open(\"\", \"Crashlog\",\"width=500,height=300,resizable=yes\");\n"
            for line in open(CrashFile, "r").readlines():
                html += "fens1.document.write('%s');\n" % line.replace(
                    "\n", "<br>").replace("'", "\\'")
            html += "} </script>\n"
        html += "<style type=\"text/css\">\n"
        html += ".style1 {\n"
        html += "vertical-align: middle; font-size:8px; }\n"
        html += "</style>\n"
        if L4LElement.getRefresh() == True:
            GI = getINFO().split()
            if len(GI) > 6:
                GR = min(int(float(GI[6])) + 1, 6)
            else:
                GR = 6
            html += "<meta http-equiv=\"refresh\" content=\"%d\">\n" % GR
        html += "<title>LCD4linux</title>\n"
        html += "</head>"
        html += "<body bgcolor=\"#666666\" text=\"#FFFFFF\">\n"
        html += "<form method=\"POST\" action=\"--WEBBOT-SELF--\">\n"
        html += "</form>\n"
        html += "<table border=\"1\" rules=\"groups\" width=\"100%\" bordercolorlight=\"#000000\" bordercolordark=\"#000000\" cellspacing=\"0\">"
        html += "<tr><td bgcolor=\"#000000\" width=\"220\">\n"
        html += "<p align=\"center\"><img title=\"\" border=\"0\" src=\"/lcd4linux/data/WEBdreambox.png\" width=\"181\" height=\"10\">\n"
        CCM = "#FFFFFF" if getConfigMode() == False else "#FFCC00"
        html += "<font color=\"%s\"><b>LCD4linux Config</b></font><br />%s\n" % (
            CCM, Version if L4LElement.getVersion() == True else Version + "?")
        if IP is None:
            html += "<br><span style=\"font-size:7pt;color: #FF0000\">%s!</span>" % _l(
                _("IP seurity not supported by Box"))
        html += "</p></td><td bgcolor=\"#000000\">\n"
        html += "<p align=\"left\">"
        d = glob.glob("%sdpf.*" % getTMPL())
        if len(d) > 0:
            html += "<a href=\"/lcd4linux\"><img style=\"color:#FFCC00\" title=\"LCD 1\" src=\"/lcd4linux/%s?%d\" border=\"1\" height=\"80\" id=\"reloader1\" onload=\"setTimeout('document.getElementById(\\'reloader1\\').src=\\'/lcd4linux/%s?\\'+new Date().getTime()', 5000)\" ></a>" % (
                os.path.basename(d[0]), time.time(), os.path.basename(d[0]))
        d = glob.glob("%sdpf2.*" % getTMPL())
        if len(d) > 0:
            html += "<a href=\"/lcd4linux?file=%s\"><img style=\"color:#FFCC00\" title=\"LCD 2\" src=\"/lcd4linux/%s?%d\" border=\"1\" height=\"80\" id=\"reloader2\" onload=\"setTimeout('document.getElementById(\\'reloader2\\').src=\\'/lcd4linux/%s?\\'+new Date().getTime()', 5000)\" ></a>" % (
                os.path.basename(d[0]), os.path.basename(
                    d[0]), time.time(), os.path.basename(d[0]))
        d = glob.glob("%sdpf3.*" % getTMPL())
        if len(d) > 0:
            html += "<a href=\"/lcd4linux?file=%s\"><img style=\"color:#FFCC00\" title=\"LCD 3\" src=\"/lcd4linux/%s?%d\" border=\"1\" height=\"80\" id=\"reloader3\" onload=\"setTimeout('document.getElementById(\\'reloader3\\').src=\\'/lcd4linux/%s?\\'+new Date().getTime()', 5000)\" ></a>" % (
                os.path.basename(d[0]), os.path.basename(
                    d[0]), time.time(), os.path.basename(d[0]))
        html += "</p></td>\n"
        if os.path.isfile(CrashFile):
            html += "<td valign=\"top\" align=\"left\"  bgcolor=\"#000000\">\n"
            html += "<form method=\"post\"><font color=\"#FFFF00\">%s</font><br>\n" % _l(
                _("Crashlog"))
            html += "<input type=\"hidden\" name=\"cmd\" value=\"\">\n"
            html += "<input type=\"button\" value=\"%s\" style=\"font-size:8pt;background-color:yellow;\" onClick=\"fensterchen()\">\n" % _l(
                _("Show"))
            html += "<input type=\"button\" value=\"%s\" style=\"font-size:8pt;background-color:yellow;\"   onclick=\"this.form.cmd.value = 'crashdel'; this.form.submit();\">\n" % _l(
                _("Delete"))
            html += "</form></td>\n"
        html += "<td valign=\"top\" align=\"right\"  bgcolor=\"#000000\">\n"
        html += "<form method=\"post\" enctype=\"multipart/form-data\">\n"
        html += "<input type=\"file\" name=\"uploadName\" title=\"File Name\" class=\"style1\" >\n"
        html += "<input type=\"image\" name=\"upload\" value=\"klick\" src=\"/lcd4linux/data/WEBupload.png\" height=\"25\" title=\"%s\" class=\"style1\"  >\n" % _l(
            _("Restore Config"))
        html += "<input type=\"image\" name=\"download\" value=\"klick\" src=\"/lcd4linux/data/WEBdownload.png\" height=\"25\" title=\"%s\" class=\"style1\" >\n" % _l(
            _("Backup Config"))
        if os.path.isfile("/tmp/L4log.txt"):
            html += "<input type=\"image\" name=\"logdel\" value=\"klick\" src=\"/lcd4linux/data/WEBlogdel.png\" height=\"25\" title=\"%s\" class=\"style1\"  >\n" % _l(
                _("Delete Logfile"))
            html += "<input type=\"image\" name=\"logdownload\" value=\"klick\" src=\"/lcd4linux/data/WEBlogshow.png\" height=\"25\" title=\"%s\" class=\"style1\" >\n" % _l(
                _("Download Logfile"))
        html += "<input type=\"image\" name=\"save\" value=\"klick\" src=\"/lcd4linux/data/WEBsave.png\" height=\"40\" title=\"%s\" class=\"style1\" >\n" % _l(
            _("Save Config"))
        html += "</form>\n"
        html += "<form method=\"post\"><font color=\"#FFFFFF\">%s</font>\n" % _l(
            _("Screen"))

        html += "<input type=\"hidden\" name=\"cmd\" value=\"\">\n"
        for i in range(1, 10):
            html += "<input type=\"button\" value=\"%d\" style=\"width:15px; text-align:center; font-size:8pt%s\" onclick=\"this.form.cmd.value = 'Screen%d'; this.form.submit();\">\n" % (
                i, AktiveScreen(str(i)), i)

        Aktiv = "checked" if getSaveEventListChanged() else ""
        html += "<input type=\"hidden\" name=\"hold\" value=\"%s\">" % (
            "unchecked")
        html += "<input type=\"checkbox\" title=\"%s\" name=\"hold\" value=\"%s\" onclick=\"this.form.cmd.value = 'hold'; this.form.submit();\" %s>" % (
            _l(_("stop Screencycle")), "checked", Aktiv)

        html += "</form>\n"
        html += "</td></tr></table>\n"

        html += "<form method=\"get\">"
        html += "<fieldset style=\"width:auto\" name=\"Mode1\">"
        html += "<legend style=\"color: #FFCC00\">Modus&nbsp;</legend>\n"
        html += "<input id=\"r1\" name=\"Mode\" type=\"radio\" value=\"1\" %s onclick=\"this.form.submit();\"><label %s for=\"r1\">%s&nbsp;&nbsp;</label>\n" % (
            AktiveMode("1", _l(_("Global"))))
        html += "<input id=\"r2\" name=\"Mode\" type=\"radio\" value=\"2\" %s onclick=\"this.form.submit();\"><label %s for=\"r2\">%s&nbsp;&nbsp;</label>\n" % (
            AktiveMode("2", _l(_("On"))))
        html += "<input id=\"r3\" name=\"Mode\" type=\"radio\" value=\"3\" %s onclick=\"this.form.submit();\"><label %s for=\"r3\">%s&nbsp;&nbsp;</label>\n" % (
            AktiveMode("3", _l(_("Media"))))
        html += "<input id=\"r4\" name=\"Mode\" type=\"radio\" value=\"4\" %s onclick=\"this.form.submit();\"><label %s for=\"r4\">%s&nbsp;&nbsp;</label>\n" % (
            AktiveMode("4", _l(_("Idle"))))
        if str(LCD4linux.Popup.value) != "0":
            html += "<input id=\"r5\" name=\"Mode\" type=\"radio\" value=\"5\" %s onclick=\"this.form.submit();\"><label %s for=\"r5\">%s&nbsp;&nbsp;</label>\n" % (
                AktiveMode("5", "Popup-Text"))
        html += "</fieldset></form>\n"

        if Mode != "5":
            if Mode == "1":
                L = L1
            elif Mode == "2":
                L = L2
            elif Mode == "3":
                L = L3
            elif Mode == "4":
                L = L4
            else:
                Mode == "1"
                L = L1
                Element = "other"
            if str(LCD4linux.WebIfDesign.value) == "2":
                html += "<table border=\"0\"width=\"100%\" cellspacing=\"1\">"
                html += "<tr><td valign=\"top\" width=\"250\">"
            html += "<form method=\"get\">"
            html += "<fieldset style=\"width:auto\" name=\"Mode2\">"
            html += "<legend style=\"color: #FFCC00\">Element&nbsp;</legend>\n"
            i = 0
            ElementList = []
            ElementText = ""
            for LL in L:
                Conf = LL[2].strip()
                if Mode == "1":
                    Conf = Conf[:13]
                if ((LL[1][:1] != "-" and Mode != "1") or
                    (Mode == "1" and Conf not in ElementList)) and LL[3] != 0:
                    if Element == "" or ModeOld != Mode:
                        Element = "other"
                        ModeOld = Mode
                    ElementList.append(Conf)
                    i += 1
                    Ea, Ec = AktiveElement(Conf)
                    #					html += Conf
                    if Mode != "1":
                        exec("Curr = %s.value" % Conf)
                        L4log("Curr = %s.value" % Conf, Curr)
                        if Curr != "0":
                            if Ec == "":
                                Ec = "style=\"font-weight:bold;color:#CCFFBB\""
                            else:
                                Ec = Ec.replace("=\"", "=\"font-weight:bold;")
                    if Ea == "checked":
                        ElementText = (_l(_(LL[1]))
                                       if Mode != "1" else _l(M2[LL[3] - 1]))
                    html += "<input id=\"e%d\" name=\"Element\" type=\"radio\" value=\"%s\" %s onclick=\"this.form.submit();\"><label %s for=\"e%d\">%s&nbsp;&nbsp;</label>\n" % (
                        i, Conf, Ea, Ec, i,
                        (_l(_(LL[1])) if Mode != "1" else _l(M2[LL[3] - 1])))
                    if str(LCD4linux.WebIfDesign.value) == "2":
                        html += "<br>"
            Ea, Ec = AktiveElement("other")
            if Ea == "checked":
                ElementText = _l(_("other"))
            html += "<input id=\"e%d\" name=\"Element\" type=\"radio\" value=\"%s\" %s onclick=\"this.form.submit();\"><label %s for=\"e%d\">%s&nbsp;&nbsp;</label>\n" % (
                0, "other", Ea, Ec, 0, _l(_("other")))
            html += "</fieldset></form>\n"
            if str(LCD4linux.WebIfDesign.value) == "2":
                html += "<br></td><td valign=\"top\">"

            html += "<form name=\"Eingabe\" method=\"POST\">\n"
            if str(LCD4linux.WebIfDesign.value) == "2":
                html += "<fieldset style=\"width:auto\" name=\"Mode3\"><legend style=\"color: #FFCC00\">%s&nbsp;</legend>" % ElementText
            html += "<table border=\"1\" rules=\"groups\" width=\"100%\">"
            AktCode = 0
            isOn = False
            isMP = False
            isSb = False
            for LL in L:
                Conf = LL[2].strip()

                if (Conf.startswith(Element) and
                    (LL[3] == AktCode or AktCode == 0)) or (Element == "other"
                                                            and LL[3] == 0):

                    if Mode in "2":
                        if "." in Conf:
                            b = Conf.replace(".", ".MP")
                            if (" " + b) in zip(*L3)[2]:
                                isMP = True
                            b = Conf.replace(".", ".Standby")
                            if (" " + b) in zip(*L4)[2]:
                                isSb = True
                    elif Mode in "3":
                        if ".MP" in Conf:
                            b = Conf.replace(".MP", ".")
                            if (" " + b) in zip(*L2)[2]:
                                isOn = True
                            b = Conf.replace(".MP", ".Standby")
                            if (" " + b) in zip(*L4)[2]:
                                isSb = True
                    elif Mode in "4":
                        if ".Standby" in Conf:
                            b = Conf.replace(".Standby", ".")
                            if (" " + b) in zip(*L2)[2]:
                                isOn = True
                            b = Conf.replace(".Standby", ".MP")
                            if (" " + b) in zip(*L3)[2]:
                                isMP = True

                    if AktCode == 0:
                        AktCode = LL[3]
                    exec("Curr = %s.value" % Conf)
                    #ConfigSelection
                    exec("Typ = isinstance(%s,ConfigSelection)" % Conf)
                    html += "<tr>\n"
                    if Typ == True:
                        html += "<td width=\"300\">%s</td><td>\n" % _l(_(
                            LL[1]))
                        html += "<select name=\"%s\" size=\"1\">\n" % Conf
                        exec("Len = len(%s.description)" % Conf)
                        for i in range(Len):
                            exec("Choice = %s.choices[%d]" % (Conf, i))
                            exec("Wert = %s.description[\"%s\"]" %
                                 (Conf, Choice))
                            if str(Choice) == str(Curr):
                                Aktiv = " selected"
                            else:
                                Aktiv = ""
                            html += "<option value=\"%s\" %s>%s</option>\n" % (
                                Choice, Aktiv, _l(Wert))
                        html += "</select>\n"
                        html += "</td>\n"
                    else:
                        #ConfigYesNo
                        exec("Typ = isinstance(%s,ConfigYesNo)" % Conf)
                        if Typ == True:
                            html += "<td width=\"300\">%s</td><td>\n" % _l(
                                _(LL[1]))
                            Aktiv = "checked" if Curr else ""
                            html += "<input type=\"hidden\" name=\"%s\" value=\"%s\">" % (
                                Conf, "unchecked")
                            html += "<input type=\"checkbox\" name=\"%s\" value=\"%s\" %s>" % (
                                Conf, "checked", Aktiv)
                            html += "</td>\n"
                        else:
                            #ConfigText
                            exec("Typ = isinstance(%s,ConfigText)" % Conf)
                            if Typ == True:
                                html += "<td width=\"300\">%s</td><td>\n" % _l(
                                    _(LL[1]))
                                exec("Typ = isinstance(%s,ConfigPassword)" %
                                     Conf)
                                if Typ == True:
                                    html += "<input type=\"password\" name=\"%s\" size=\"60\" value=\"%s\">" % (
                                        Conf, _l(Curr))
                                else:
                                    html += "<input type=\"text\" name=\"%s\" size=\"60\" value=\"%s\">" % (
                                        Conf, _l(Curr))
                                html += "</td>\n"
                            else:
                                #ConfigSlider
                                exec("Typ = isinstance(%s,ConfigSlider)" %
                                     Conf)
                                if Typ == True:
                                    exec("Min = %s.min" % Conf)
                                    exec("Max = %s.max" % Conf)
                                    html += "<td width=\"300\">%s (%d - %d)</td><td>\n" % (
                                        _l(_(LL[1])), Min, Max)
                                    html += "<input type=\"text\" name=\"%s\" size=\"5\" value=\"%s\">" % (
                                        Conf, Curr)
                                    html += "</td>\n"
                                else:
                                    #ConfigClock
                                    exec("Typ = isinstance(%s,ConfigClock)" %
                                         Conf)
                                    if Typ == True:
                                        html += "<td width=\"300\">%s</td><td>\n" % _l(
                                            _(LL[1]))
                                        html += "<input type=\"text\" name=\"%s\" size=\"6\" value=\"%02d:%02d\">" % (
                                            Conf, Curr[0], Curr[1])
                                        html += "</td>\n"

            html += "</tr></table>\n"
            html += "<input type=\"hidden\" name=\"cmd\" value=\"config\">\n"
            html += "<input type=\"submit\" style=\"background-color: #FFCC00\" value=\"%s\">\n" % _l(
                _("set Settings"))
            if Element != "other":
                if Mode in ["3", "4"] and isOn:
                    html += "<input type=\"button\" align=\"middle\" style=\"text-align:center; font-size:8pt\" value=\"%s\" onclick=\"this.form.cmd.value = 'copyOn'; this.form.submit(); \">\n" % _l(
                        _("copy to On"))
                if Mode in ["2", "4"] and isMP:
                    html += "<input type=\"button\" align=\"middle\" style=\"text-align:center; font-size:8pt\" value=\"%s\" onclick=\"this.form.cmd.value = 'copyMP'; this.form.submit(); \">\n" % _l(
                        _("copy to Media"))
                if Mode in ["2", "3"] and isSb:
                    html += "<input type=\"button\" align=\"middle\" style=\"text-align:center; font-size:8pt\" value=\"%s\" onclick=\"this.form.cmd.value = 'copyIdle'; this.form.submit(); \">\n" % _l(
                        _("copy to Idle"))
            html += "</form>\n"
            if str(LCD4linux.WebIfDesign.value) == "2":
                html += "</fieldset></td></tr></table>"
        elif Mode == "5":
            html += "<form method=\"POST\">\n"
            html += "<fieldset style=\"width:auto\" name=\"Mode2\">\n"
            html += "<textarea name=\"PopText\" style=\"height: 120px; width: 416px\">%s</textarea>" % _l(
                PopText[1])
            html += "<input type=\"hidden\" name=\"cmd\" value=\"pop\">\n"
            html += "<input type=\"submit\" style=\"background-color: #FFCC00\" value=\"%s\">\n" % _l(
                _("set Settings"))
            html += "</fieldset></form>\n"

        if LCD4linuxConfigweb.RestartGUI == True:
            html += "<span style=\"color: #FF0000;\"><strong>%s</strong></span>" % _l(
                _("GUI Restart is required"))
        if ExeMode == True:
            html += "<br />\n"
            html += "<form method=\"GET\">\n"
            html += "<input type=\"hidden\" name=\"cmd\" value=\"exec\">\n"
            html += "<input style=\"width: 400px\" type=\"text\" name=\"ex\">\n"
            html += "<input type=\"submit\" value=\"%s\">\n" % _l(_("Exec"))
            html += "</form>\n"
        if StatusMode == True:
            html += "<br />\n"
            html += "Screen: %s<br />\n" % str(getScreenActive(True))
            html += "Hold/HoldKey: %s/%s<br />\n" % (str(
                getSaveEventListChanged()), str(L4LElement.getHoldKey()))
            html += "Brightness org/set %s/%s<br />\n" % (
                str(L4LElement.getBrightness()),
                str(L4LElement.getBrightness(0, False)))

        html += "<hr><span style=\"font-size:8pt\">%s (%s)</span>" % (
            getINFO(), IP)
        html += "<BR><a style=\"font-size:10pt; color:#FFCC00;\" href=\"http://www.i-have-a-dreambox.com/wbb2/thread.php?postid=1634882\">Support & FAQ & Info & Donation</a>"
        if len(L4LElement.get()) > 0:
            html += "<script language=\"JavaScript\">\n"
            html += "function Efensterchen() {\n"
            html += "fens1=window.open(\"\", \"Externals\",\"width=500,height=300,resizable=yes\");\n"
            L4Lkeys = L4LElement.get().keys()
            L4Lkeys.sort()
            for CUR in L4Lkeys:
                html += "fens1.document.write('%s %s<BR>');\n" % (
                    CUR, str(L4LElement.get(CUR)).replace(
                        "\n", "<br>").replace("'", "\\'"))
            html += "} </script>\n"
            html += "<form method=\"post\"><br>\n"
            html += "<input type=\"button\" value=\"%s\" style=\"font-size:8pt;\" onClick=\"Efensterchen()\">\n" % _l(
                _("Show Externals"))
            html += "</form></td>\n"
        html += "</body>\n"
        html += "</html>\n"

        return html
示例#5
0
import boxbranding
print "getMachineBuild=%s" % boxbranding.getMachineBuild()
print "getMachineProcModel=%s" % boxbranding.getMachineProcModel()
print "getMachineBrand=%s" % boxbranding.getMachineBrand()
print "getMachineName=%s" % boxbranding.getMachineName()
print "getMachineMtdKernel=%s" % boxbranding.getMachineMtdKernel()
print "getMachineKernelFile=%s" % boxbranding.getMachineKernelFile()
print "getMachineMtdRoot=%s" % boxbranding.getMachineMtdRoot()
print "getMachineRootFile=%s" % boxbranding.getMachineRootFile()
print "getMachineMKUBIFS=%s" % boxbranding.getMachineMKUBIFS()
print "getMachineUBINIZE=%s" % boxbranding.getMachineUBINIZE()
print "getBoxType=%s" % boxbranding.getBoxType()
print "getBrandOEM=%s" % boxbranding.getBrandOEM()
print "getOEVersion=%s" % boxbranding.getOEVersion()
print "getDriverDate=%s" % boxbranding.getDriverDate()
print "getImageVersion=%s" % boxbranding.getImageVersion()
print "getImageBuild=%s" % boxbranding.getImageBuild()
print "getImageDistro=%s" % boxbranding.getImageDistro()
print "getImageFolder=%s" % boxbranding.getImageFolder()
print "getImageFileSystem=%s" % boxbranding.getImageFileSystem()
示例#6
0
    os.system("echo machine_brand=" + getMachineBrand() +
              " >> /etc/image-version")
    os.system("echo machine_name=" + getMachineName() +
              " >> /etc/image-version")
    os.system("echo version=" + getImageVersion() + " >> /etc/image-version")
    os.system("echo build=" + getImageBuild() + " >> /etc/image-version")
    os.system("echo imageversion=" + getImageVersion() + "-" +
              getImageBuild() + " >> /etc/image-version")
    os.system("echo date=`cat /etc/version`" + " >> /etc/image-version")
    os.system("echo comment=openHDF" " >> /etc/image-version")
    os.system("echo target=9" " >> /etc/image-version")
    os.system("echo creator=OpenHDF" " >> /etc/image-version")
    os.system("echo url=http://www.hdfreaks.cc" " >> /etc/image-version")
    os.system("echo catalog=http://www.hdfreaks.cc" " >> /etc/image-version")
    os.system("echo distro=" + getImageDistro() + " >> /etc/image-version")
    os.system("echo oeversion=" + getOEVersion() + " >> /etc/image-version")
    os.system("echo date=" + getImageBuild() + " >> /etc/image-version")
except:
    pass

try:
    os.system("echo ~~~ Box Info ~~~~~~~~~~~~~~~~~~~~" " > /tmp/.ImageVersion")
    os.system("echo getMachineName = " + getMachineName() +
              " >> /tmp/.ImageVersion")
    os.system("echo getMachineBrand = " + getMachineBrand() +
              " >> /tmp/.ImageVersion")
    os.system("echo getBoxType = " + getBoxType() + " >> /tmp/.ImageVersion")
    os.system("echo getBrandOEM = " + getBrandOEM() + " >> /tmp/.ImageVersion")
    os.system("echo getDriverDate = " + getDriverDate() +
              " >> /tmp/.ImageVersion")
    os.system("echo getImageVersion = " + getImageVersion() +
示例#7
0
def getInfo():
	# TODO: get webif versione somewhere!
	info = {}

	info['brand'] = getMachineBrand()
	info['model'] = getMachineName()
	info['boxtype'] = getBoxType()
	info['machinebuild'] = getMachineBuild()

	chipset = "unknown"
	if fileExists("/etc/.box"):
		f = open("/etc/.box",'r')
		model = f.readline().strip().lower()
		f.close()
		if model.startswith("ufs") or model.startswith("ufc"):
			if model in ("ufs910", "ufs922", "ufc960"):
				chipset = "SH4 @266MHz"
			else:
				chipset = "SH4 @450MHz"
		elif model in ("topf", "tf7700hdpvr"):
			chipset = "SH4 @266MHz"
		elif model.startswith("azbox"):
			f = open("/proc/stb/info/model",'r')
			model = f.readline().strip().lower()
			f.close()
			if model == "me":
				chipset = "SIGMA 8655"
			elif model == "minime":
				chipset = "SIGMA 8653"
			else:
				chipset = "SIGMA 8634"
		elif model.startswith("spark"):
			if model == "spark7162":
				chipset = "SH4 @540MHz"
			else:
				chipset = "SH4 @450MHz"
	elif fileExists("/proc/stb/info/azmodel"):
		f = open("/proc/stb/info/model",'r')
		model = f.readline().strip().lower()
		f.close()
		if model == "me":
			chipset = "SIGMA 8655"
		elif model == "minime":
			chipset = "SIGMA 8653"
		else:
			chipset = "SIGMA 8634"
	elif fileExists("/proc/stb/info/model"):
		f = open("/proc/stb/info/model",'r')
		model = f.readline().strip().lower()
		f.close()
		if model == "tf7700hdpvr":
			chipset = "SH4 @266MHz"
		elif model == "nbox":
			chipset = "STi7100 @266MHz"
		elif model == "arivalink200":
			chipset = "STi7109 @266MHz"
		elif model in ("adb2850", "adb2849", "dsi87"):
			chipset = "STi7111 @450MHz"
		elif model in ("sagemcom88", "esi88"):
			chipset = "STi7105 @450MHz"
		elif model.startswith("spark"):
			if model == "spark7162":
				chipset = "STi7162 @540MHz"
			else:
				chipset = "STi7111 @450MHz"

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

	info['chipset'] = chipset

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

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

	info["webifver"] = getOpenWebifVer()
	info['imagedistro'] = getImageDistro()
	info['oever'] = getOEVersion()
	info['imagever'] = getImageVersion() + '.' + getImageBuild()
	info['enigmaver'] = getEnigmaVersionString()
	info['driverdate'] = getDriverDate()
	info['kernelver'] = about.getKernelVersionString()

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

	info['fp_version'] = getFPVersion()

	info['tuners'] = []
	for i in range(0, nimmanager.getSlotCount()):
		info['tuners'].append({
			"name": nimmanager.getNim(i).getSlotName(),
			"type": nimmanager.getNimName(i) + " (" + nimmanager.getNim(i).getFriendlyType() + ")"
		})

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

	info['hdd'] = []
	for hdd in harddiskmanager.hdd:
		dev = hdd.findMount()
		if dev:
			stat = os.statvfs(dev)
			free = int((stat.f_bfree/1024) * (stat.f_bsize/1024))
		else:
			free = -1
		
		if free <= 1024:
			free = "%i MB" % free
		else:
			free = free / 1024.
			free = "%.3f GB" % free

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

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

		info['hdd'].append({
			"model": hdd.model(),
			"capacity": size,
			"labelled_capacity": iecsize,
			"free": free
		})

	info['transcoding'] = False
	if (info['model'] in ("Solo4K", "Solo²", "Duo²", "Solo SE", "Quad", "Quad Plus") or info['machinebuild'] in ('inihdp', 'hd2400', 'et10000', 'xpeedlx3', 'ew7356', 'dags3', 'dags4')):
		if os.path.exists(eEnv.resolve('${libdir}/enigma2/python/Plugins/SystemPlugins/TransCodingSetup/plugin.pyo')) or os.path.exists(eEnv.resolve('${libdir}/enigma2/python/Plugins/SystemPlugins/TranscodingSetup/plugin.pyo')) or os.path.exists(eEnv.resolve('${libdir}/enigma2/python/Plugins/SystemPlugins/MultiTransCodingSetup/plugin.pyo')):
			info['transcoding'] = True

	info['kinopoisk'] = False
	lang = ['ru', 'uk', 'lv', 'lt', 'et']
	for l in lang:
		if l in language.getLanguage():
			info['kinopoisk'] = True

	global STATICBOXINFO
	STATICBOXINFO = info
	return info
示例#8
0
文件: info.py 项目: diglam/enigma2pc
def getInfo():
    # TODO: get webif versione somewhere!
    info = {}

    info['brand'] = getMachineBrand()
    info['model'] = getMachineName()
    info['boxtype'] = getBoxType()
    info['machinebuild'] = getMachineBuild()

    chipset = "unknown"
    if fileExists("/etc/.box"):
        f = open("/etc/.box", 'r')
        model = f.readline().strip().lower()
        f.close()
        if model.startswith("ufs") or model.startswith("ufc"):
            if model in ("ufs910", "ufs922", "ufc960"):
                chipset = "SH4 @266MHz"
            else:
                chipset = "SH4 @450MHz"
        elif model in ("topf", "tf7700hdpvr"):
            chipset = "SH4 @266MHz"
        elif model.startswith("azbox"):
            f = open("/usr/local/e2/etc/stb/info/model", 'r')
            model = f.readline().strip().lower()
            f.close()
            if model == "me":
                chipset = "SIGMA 8655"
            elif model == "minime":
                chipset = "SIGMA 8653"
            else:
                chipset = "SIGMA 8634"
        elif model.startswith("spark"):
            if model == "spark7162":
                chipset = "SH4 @540MHz"
            else:
                chipset = "SH4 @450MHz"
    elif fileExists("/usr/local/e2/etc/stb/info/azmodel"):
        f = open("/usr/local/e2/etc/stb/info/model", 'r')
        model = f.readline().strip().lower()
        f.close()
        if model == "me":
            chipset = "SIGMA 8655"
        elif model == "minime":
            chipset = "SIGMA 8653"
        else:
            chipset = "SIGMA 8634"
    else:
        f = open("/usr/local/e2/etc/stb/info/model", 'r')
        model = f.readline().strip().lower()
        f.close()
        if model in ("esi88", "sagemcom88", "nbox"):
            if fileExists("/proc/boxtype"):
                f = open("/proc/boxtype", 'r')
                model = f.readline().strip().lower()
                f.close()
        if model == "tf7700hdpvr":
            chipset = "SH4 @266MHz"
        elif model in ("nbox", "bska", "bsla", "bxzb", "bzzb"):
            chipset = "SH4 @266MHz"
        elif model in ("adb2850", "adb2849"):
            chipset = "SH4 @450MHz"
        elif model in ("sagemcom88", "esi88", "uhd88", "dsi87"):
            chipset = "SH4 @450MHz"

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

    info['chipset'] = chipset

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

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

    info["webifver"] = getOpenWebifVer()
    info['imagedistro'] = getImageDistro()
    info['oever'] = getOEVersion()
    info['imagever'] = getImageVersion() + '.' + getImageBuild()
    info['enigmaver'] = getEnigmaVersionString()
    info['driverdate'] = getDriverDate()
    info['kernelver'] = about.getKernelVersionString()

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

    info['fp_version'] = getFPVersion()

    info['tuners'] = []
    for i in range(0, nimmanager.getSlotCount()):
        info['tuners'].append({
            "name":
            nimmanager.getNim(i).getSlotName(),
            "type":
            nimmanager.getNimName(i) + " (" +
            nimmanager.getNim(i).getFriendlyType() + ")"
        })

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

    info['hdd'] = []
    for hdd in harddiskmanager.hdd:
        dev = hdd.findMount()
        if dev:
            stat = os.statvfs(dev)
            free = int((stat.f_bfree / 1024) * (stat.f_bsize / 1024))
        else:
            free = -1

        if free <= 1024:
            free = "%i MB" % free
        else:
            free = free / 1024.
            free = "%.3f GB" % free

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

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

        info['hdd'].append({
            "model": hdd.model(),
            "capacity": size,
            "labelled_capacity": iecsize,
            "free": free
        })
    global STATICBOXINFO
    STATICBOXINFO = info
    return info
示例#9
0
	def __init__(self, session):
		Screen.__init__(self, session)
		
		OpenNFRVersion = _("OpenNFR %s") % about.getImageVersionString()
		self["OpenNFRVersion"] = Label(OpenNFRVersion)
		
		AboutText = _("Model:\t\t%s %s\n") % (getMachineBrand(), getMachineName())
		
		bootloader = ""
                if path.exists('/sys/firmware/devicetree/base/bolt/tag'):
		        f = open('/sys/firmware/devicetree/base/bolt/tag', 'r')
	                bootloader = f.readline().replace('\x00', '').replace('\n', '')
		        f.close()
			AboutText += _("Bootloader:\t\t%s\n") % (bootloader)

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

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

		AboutText += _("CPU:\t\t%s") % about.getCPUString() + cpuMHz + "\n"
		AboutText += _("Cores:\t\t%s") % about.getCpuCoresString() + "\n"
		imagestarted = ""
		bootname = ''
	        if path.exists('/boot/bootname'):
	                f = open('/boot/bootname', 'r')
		        bootname = f.readline().split('=')[1]
		        f.close()

		if getMachineBuild() in ('cc1','sf8008'):
			if path.exists('/boot/STARTUP'):
				f = open('/boot/STARTUP', 'r')
				f.seek(5)
				image = f.read(4)
				if image == "emmc":
					image = "1"
				elif image == "usb0":
					f.seek(13)
					image = f.read(1)
					if image == "1":
						image = "2"
					elif image == "3":
						image = "3"
					elif image == "5":
						image = "4"
					elif image == "7":
						image = "5"
				f.close()
				if bootname: bootname = "   (%s)" %bootname 
				AboutText += _("Selected Image:\t\t%s") % "STARTUP_" + image + bootname + "\n"
		elif path.exists('/boot/STARTUP'):
			f = open('/boot/STARTUP', 'r')
			f.seek(22)
			image = f.read(1) 
			f.close()
			if bootname: bootname = "   (%s)" %bootname 
		        AboutText += _("Selected Image:\t\t%s") % "STARTUP_" + image + bootname + "\n"
		string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))
		AboutText += _("Drivers:\t\t%s") % driversdate + "\n"
		AboutText += _("Image:\t\t%s") % about.getImageVersionString() + "\n"
		AboutText += _("Build:\t\t%s") % getImageBuild() + "\n"		
		AboutText += _("Kernel: \t\t%s") % about.getKernelVersionString() + "\n"
		AboutText += _("Oe-Core:\t\t%s") % getOEVersion() + "\n"
		AboutText += _("Enigma (re)starts:\t%d\n") % config.misc.startCounter.value
		AboutText += _("GStreamer:\t\t%s") % about.getGStreamerVersionString() + "\n"	
		AboutText += _("Python:\t\t%s") % about.getPythonVersionString() + "\n"

		fp_version = getFPVersion()
		if fp_version is None:
			fp_version = ""
		elif fp_version != 0:
			fp_version = _("Front Panel:\t\t%s") % fp_version 
			AboutText += fp_version + "\n\n"
		else:
			fp_version = _("Front Panel:\t\tVersion unknown")
			AboutText += fp_version + "\n\n"

		AboutText += _("Installed:\t\t%s") % about.getFlashDateString() + "\n"			
		AboutText += _("Last Upgrade:\t\t%s") % about.getLastUpdateString() + "\n\n" 
		AboutText += _("WWW:\t\t%s") % about.getImageUrlString() + "\n\n"
		AboutText += _("based on:\t\t%s") % "www.github.com/oe-alliance" + "\n\n"

		self["FPVersion"] = StaticText(fp_version)

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

		# don't remove the string out of the _(), or it can't be "translated" anymore.
		# TRANSLATORS: Add here whatever should be shown in the "translator" about screen, up to 6 lines (use \n for newline)
		info = _("TRANSLATOR_INFO")

		if info == _("TRANSLATOR_INFO"):
			info = ""

		infolines = _("").split("\n")
		infomap = {}
		for x in infolines:
			l = x.split(': ')
			if len(l) != 2:
				continue
			(type, value) = l
			infomap[type] = value

		translator_name = infomap.get("Language-Team", "none")
		if translator_name == "none":
			translator_name = infomap.get("Last-Translator", "")

		self["FPVersion"] = StaticText(fp_version)

		self["TunerHeader"] = StaticText(_("Detected NIMs:"))

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

		self["HDDHeader"] = StaticText(_("Detected HDD:"))

		hddlist = harddiskmanager.HDDList()
		hddinfo = ""
		if hddlist:
			for count in range(len(hddlist)):
				if hddinfo:
					hddinfo += "\n"
				hdd = hddlist[count][1]
				if int(hdd.free()) > 1024:
					hddinfo += "%s\n(%s, %d GB %s)" % (hdd.model(), hdd.capacity(), hdd.free()/1024, _("free"))
				else:
					hddinfo += "%s\n(%s, %d MB %s)" % (hdd.model(), hdd.capacity(), hdd.free(), _("free"))
		else:
			hddinfo = _("none")
		self["hddA"] = StaticText(hddinfo)
		
		self["AboutScrollLabel"] = ScrollLabel(AboutText)

		self["actions"] = ActionMap(["SetupActions", "ColorActions", "DirectionActions"], 
			{
				"cancel": self.close,
				"ok": self.close,
				"green": self.showTranslationInfo,
				"up": self["AboutScrollLabel"].pageUp,
				"down": self["AboutScrollLabel"].pageDown
			})
示例#10
0
文件: About.py 项目: openhdf/enigma2
	def populate(self):
		def netspeed():
			netspeed=""
			for line in popen('ethtool eth0 |grep Speed','r'):
				line = line.strip().split(":")
				line =line[1].replace(' ','')
				netspeed += line
				return str(netspeed)
		def netspeed_eth1():
			netspeed=""
			for line in popen('ethtool eth1 |grep Speed','r'):
				line = line.strip().split(":")
				line =line[1].replace(' ','')
				netspeed += line
				return str(netspeed)
		def netspeed_ra0():
			netspeed=""
			for line in popen('iwconfig ra0 | grep Bit | cut -c 75-85','r'):
				line = line.strip()
				netspeed += line
				return str(netspeed)
		def netspeed_wlan0():
			netspeed=""
			for line in popen('iwconfig wlan0 | grep Bit | cut -c 75-85','r'):
				line = line.strip()
				netspeed += line
				return str(netspeed)
		def netspeed_wlan1():
			netspeed=""
			for line in popen('iwconfig wlan1 | grep Bit | cut -c 75-85','r'):
				line = line.strip()
				netspeed += line
				return str(netspeed)
		def freeflash():
			freeflash=""
			for line in popen("df -mh / | grep -v '^Filesystem' | awk '{print $4}'",'r'):
				line = line.strip()
				freeflash += line
				return str(freeflash)
		self["lab1"] = StaticText(_("openHDF"))
		self["lab2"] = StaticText(_("Support at") + " www.HDFreaks.cc")
		model = None
		AboutText = ""
		self["lab2"] = StaticText(_("Support @") + " www.hdfreaks.cc")
		AboutText += _("Model:\t%s %s - OEM Model: %s\n") % (getMachineBrand(), getMachineName(), getBrandOEM())

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

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

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

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

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

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

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

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

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

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

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

		string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))
		gstcmd = 'opkg list-installed | grep "gstreamer1.0 -" | cut -c 16-32'
		gstcmd2 = os.system(gstcmd)
		#return (gstcmd2)
		AboutText += _("Drivers:\t%s") % driversdate + "\n"
		AboutText += _("GStreamer:\t%s") % about.getGStreamerVersionString() + "\n"
		AboutText += _("Python:\t%s\n") % about.getPythonVersionString()
		if path.exists('/boot/STARTUP'):
			#if getMachineBuild() in ('cc1','sf8008','sf8008s','sf8008t'):
			#	os.system("tune2fs -l /dev/sda2 | grep 'Filesystem created:' | cut -d ' ' -f 9-13 > /tmp/flashdate" )
			#else:
			#	os.system("tune2fs -l /dev/sda1 | grep 'Filesystem created:' | cut -d ' ' -f 9-13 > /tmp/flashdate" )
			#flashdate = open('/tmp/flashdate', 'r').read()
			#AboutText += _("Flashed:\t%s") % flashdate
			AboutText += _("Flashed:\tMultiboot active\n")
		else:
			AboutText += _("Flashed:\t%s\n") % about.getFlashDateString()
		AboutText += _("Free Flash:\t%s\n") % freeflash()
		AboutText += _("Skin:\t%s (%s x %s)\n") % (config.skin.primary_skin.value.split('/')[0], getDesktop(0).size().width(), getDesktop(0).size().height())
		AboutText += _("Last update:\t%s") % getEnigmaVersionString() + " to Build #" + getImageBuild() + "\n"
		AboutText += _("E2 (re)starts:\t%s\n") % config.misc.startCounter.value
		AboutText += _("Network:")
		eth0 = about.getIfConfig('eth0')
		eth1 = about.getIfConfig('eth1')
		ra0 = about.getIfConfig('ra0')
		wlan0 = about.getIfConfig('wlan0')
		wlan1 = about.getIfConfig('wlan1')
		if eth0.has_key('addr'):
			for x in about.GetIPsFromNetworkInterfaces():
				AboutText += "\t" + x[0] + ": " + x[1] + " (" + netspeed() + ")\n"
		elif eth1.has_key('addr'):
			for x in about.GetIPsFromNetworkInterfaces():
				AboutText += "\t" + x[0] + ": " + x[1] + " (" + netspeed_eth1() + ")\n"
		elif ra0.has_key('addr'):
			for x in about.GetIPsFromNetworkInterfaces():
				AboutText += "\t" + x[0] + ": " + x[1] + " (~" + netspeed_ra0() + ")\n"
		elif wlan0.has_key('addr'):
			for x in about.GetIPsFromNetworkInterfaces():
				AboutText += "\t" + x[0] + ": " + x[1] + " (~" + netspeed_wlan0() + ")\n"
		elif wlan1.has_key('addr'):
			for x in about.GetIPsFromNetworkInterfaces():
				AboutText += "\t" + x[0] + ": " + x[1] + " (~" + netspeed_wlan1() + ")\n"
		else:
			for x in about.GetIPsFromNetworkInterfaces():
				AboutText += "\t" + x[0] + ": " + x[1] + "\n"

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

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

		self["AboutScrollLabel"] = ScrollLabel(AboutText)
示例#11
0
	def populate(self):
		self["lab1"] = StaticText(_("OpenDroid by OPD Image Team"))
		self["lab2"] = StaticText(_("Support at") + " www.droidsat.org")
		model = None
		AboutText = ""
		self["lab2"] = StaticText(_("Support:") + " www.droidsat.org")
		AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName())
		#AboutText += _("Boxtype:\t%s\n") % getBoxType()

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

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

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

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

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

		if getMachineBuild() in ('vusolo4k','hd51','hd52','sf4008','dm900','h7','gb7252'):
			AboutText += _("CPU:\t%s") % about.getCPUString() + cpuMHz + "\n"
		else:
			AboutText += _("CPU:\t%s") % about.getCPUString() + " " + cpuMHz + "\n"
		dMIPS = 0
		if getMachineBuild() in ('vusolo4k','vuultimo4k'):
			dMIPS = "10.500"
		elif getMachineBuild() in ('hd52','hd51','sf4008','dm900','h7','gb7252'):
			dMIPS = "12.000"
		if getMachineBuild() in ('vusolo4k','hd51','hd52','sf4008','dm900','h7','gb7252'):
			AboutText += _("DMIPS:\t") + dMIPS + "\n"
		else:
			AboutText += _("BogoMIPS:\t%s") % bogoMIPS + "\n"
		AboutText += _("Cores:\t%s") % about.getCpuCoresString() + "\n"
		AboutText += _("OPD Version:\tV%s") % getImageVersion() + " Build " + getImageBuild() + " based on " + getOEVersion() + "\n"
		AboutText += _("Kernel (Box):\t%s") % about.getKernelVersionString() + " (" + getBoxType() + ")" + "\n"
		imagestarted = ""
		bootname = ''
		if path.exists('/boot/bootname'):
			f = open('/boot/bootname', 'r')
			bootname = f.readline().split('=')[1]
			f.close()
	
		if path.exists('/boot/STARTUP'):
			f = open('/boot/STARTUP', 'r')
			f.seek(22)
			image = f.read(1) 
			f.close()
			if bootname: bootname = "   (%s)" %bootname 
			AboutText += _("Selected Image:\t%s") % "STARTUP_" + image + bootname + "\n"
		elif path.exists('/boot/cmdline.txt'):
			f = open('/boot/cmdline.txt', 'r')
			f.seek(38)
			image = f.read(1) 
			f.close()
			if bootname: bootname = "   (%s)" %bootname 
			AboutText += _("Selected Image:\t%s") % "STARTUP_" + image + bootname + "\n"

		AboutText += _("Version:\t%s") % getImageVersion() + "\n"
		AboutText += _("Build:\t%s") % getImageBuild() + "\n"
		AboutText += _("Kernel:\t%s") % about.getKernelVersionString() + "\n"
	
		string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))
		AboutText += _("Drivers:\t%s") % driversdate + "\n"
		AboutText += _("GStreamer:\t%s") % about.getGStreamerVersionString() + "\n"
		AboutText += _("Last update:\t%s") % getEnigmaVersionString() + " - Build " + getImageBuild() + "\n"
		AboutText += _("Flashed:\t%s\n") % about.getFlashDateString()
		AboutText += _("Python:\t%s\n") % about.getPythonVersionString()
		AboutText += _("E2 (re)starts:\t%s\n") % config.misc.startCounter.value

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

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

		self["AboutScrollLabel"] = ScrollLabel(AboutText)
示例#12
0
def getInfo():
	# TODO: get webif versione somewhere!
	info = {}

	info['brand'] = getMachineBrand()
	info['model'] = getMachineName()

	chipset = "unknown"
	if fileExists("/proc/stb/info/azmodel"):
		brand = "AZBOX"
		file = open("/proc/stb/info/model")
		model = file.read().strip().lower()
		file.close()
		if model == "me":
			chipset = "SIGMA 8655"
		elif model == "minime":
			chipset = "SIGMA 8653"
		else:
			chipset = "SIGMA 8634"

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

	info['chipset'] = chipset

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

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

	info["webifver"] = getOpenWebifVer()
	info['imagedistro'] = getImageDistro()
	info['oever'] = getOEVersion()
	info['imagever'] = getImageVersion() + '.' + getImageBuild()
	info['enigmaver'] = getEnigmaVersionString()
	info['driverdate'] = getDriverDate()
	info['kernelver'] = about.getKernelVersionString()

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

	info['fp_version'] = getFPVersion()

	info['tuners'] = []
	for i in range(0, nimmanager.getSlotCount()):
		info['tuners'].append({
			"name": nimmanager.getNim(i).getSlotName(),
			"type": nimmanager.getNimName(i) + " (" + nimmanager.getNim(i).getFriendlyType() + ")"
		})

	info['ifaces'] = []
	ifaces = iNetwork.getConfiguredAdapters()
	for iface in ifaces:
		info['ifaces'].append({
			"name": iNetwork.getAdapterName(iface),
			"mac": iNetwork.getAdapterAttribute(iface, "mac"),
			"dhcp": iNetwork.getAdapterAttribute(iface, "dhcp"),
			"ip": formatIp(iNetwork.getAdapterAttribute(iface, "ip")),
			"mask": formatIp(iNetwork.getAdapterAttribute(iface, "netmask")),
			"gw": formatIp(iNetwork.getAdapterAttribute(iface, "gateway")),
			"ipv6": getAdapterIPv6(iface)
		})

	info['hdd'] = []
	for hdd in harddiskmanager.hdd:
		if hdd.free() <= 1024:
			free = "%i MB" % (hdd.free())
		else:
			free = float(hdd.free()) / float(1024)
			free = "%.3f GB" % free
		info['hdd'].append({
			"model": hdd.model(),
			"capacity": hdd.capacity(),
			"free": free
		})
	return info
示例#13
0
def getInfo():
    # TODO: get webif versione somewhere!
    info = {}

    info['brand'] = getMachineBrand()
    info['model'] = getMachineName()

    chipset = "unknown"
    if fileExists("/proc/stb/info/azmodel"):
        brand = "AZBOX"
        file = open("/proc/stb/info/model")
        model = file.read().strip().lower()
        file.close()
        if model == "me":
            chipset = "SIGMA 8655"
        elif model == "minime":
            chipset = "SIGMA 8653"
        else:
            chipset = "SIGMA 8634"

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

    info['chipset'] = chipset

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

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

    info["webifver"] = getOpenWebifVer()
    info['imagedistro'] = getImageDistro()
    info['oever'] = getOEVersion()
    info['imagever'] = getImageVersion() + '.' + getImageBuild()
    info['enigmaver'] = getEnigmaVersionString()
    info['driverdate'] = getDriverDate()
    info['kernelver'] = about.getKernelVersionString()

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

    info['fp_version'] = getFPVersion()

    info['tuners'] = []
    for i in range(0, nimmanager.getSlotCount()):
        info['tuners'].append({
            "name":
            nimmanager.getNim(i).getSlotName(),
            "type":
            nimmanager.getNimName(i) + " (" +
            nimmanager.getNim(i).getFriendlyType() + ")"
        })

    info['ifaces'] = []
    ifaces = iNetwork.getConfiguredAdapters()
    for iface in ifaces:
        info['ifaces'].append({
            "name":
            iNetwork.getAdapterName(iface),
            "mac":
            iNetwork.getAdapterAttribute(iface, "mac"),
            "dhcp":
            iNetwork.getAdapterAttribute(iface, "dhcp"),
            "ip":
            formatIp(iNetwork.getAdapterAttribute(iface, "ip")),
            "mask":
            formatIp(iNetwork.getAdapterAttribute(iface, "netmask")),
            "gw":
            formatIp(iNetwork.getAdapterAttribute(iface, "gateway")),
            "ipv6":
            getAdapterIPv6(iface)
        })

    info['hdd'] = []
    for hdd in harddiskmanager.hdd:
        if hdd.free() <= 1024:
            free = "%i MB" % (hdd.free())
        else:
            free = float(hdd.free()) / float(1024)
            free = "%.3f GB" % free
        info['hdd'].append({
            "model": hdd.model(),
            "capacity": hdd.capacity(),
            "free": free
        })
    return info
示例#14
0
# Embedded file name: /usr/lib/enigma2/python/BoxBrandingTest.py
import boxbranding
print 'getMachineBuild=%s<' % boxbranding.getMachineBuild()
print 'getMachineMake=%s<' % boxbranding.getMachineMake()
print 'getMachineProcModel=%s<' % boxbranding.getMachineProcModel()
print 'getMachineBrand=%s<' % boxbranding.getMachineBrand()
print 'getMachineName=%s<' % boxbranding.getMachineName()
print 'getMachineMtdKernel=%s<' % boxbranding.getMachineMtdKernel()
print 'getMachineKernelFile=%s<' % boxbranding.getMachineKernelFile()
print 'getMachineMtdRoot=%s<' % boxbranding.getMachineMtdRoot()
print 'getMachineRootFile=%s<' % boxbranding.getMachineRootFile()
print 'getMachineMKUBIFS=%s<' % boxbranding.getMachineMKUBIFS()
print 'getMachineUBINIZE=%s<' % boxbranding.getMachineUBINIZE()
print 'getBoxType=%s<' % boxbranding.getBoxType()
print 'getBrandOEM=%s<' % boxbranding.getBrandOEM()
print 'getOEVersion=%s<' % boxbranding.getOEVersion()
print 'getDriverDate=%s<' % boxbranding.getDriverDate()
print 'getImageVersion=%s<' % boxbranding.getImageVersion()
print 'getImageBuild=%s<' % boxbranding.getImageBuild()
print 'getImageDevBuild=%s<' % boxbranding.getImageDevBuild()
print 'getImageType=%s<' % boxbranding.getImageType()
print 'getImageDistro=%s<' % boxbranding.getImageDistro()
print 'getImageFolder=%s<' % boxbranding.getImageFolder()
print 'getImageFileSystem=%s<' % boxbranding.getImageFileSystem()
print 'getImageDevBuild=%s<' % boxbranding.getImageDevBuild()
print 'getImageType=%s<' % boxbranding.getImageType()
print 'getMachineMake=%s<' % boxbranding.getMachineMake()
print 'getImageArch=%s<' % boxbranding.getImageArch()
print 'getFeedsUrl=%s<' % boxbranding.getFeedsUrl()
print 'getDisplayType=%s<' % boxbranding.getDisplayType()
print 'getHaveHDMI=%s<' % boxbranding.getHaveHDMI()
示例#15
0
import boxbranding
print "getMachineBuild=%s" %boxbranding.getMachineBuild()
print "getMachineProcModel=%s" %boxbranding.getMachineProcModel()
print "getMachineBrand=%s" %boxbranding.getMachineBrand()
print "getMachineName=%s" %boxbranding.getMachineName()
print "getMachineMtdKernel=%s" %boxbranding.getMachineMtdKernel()
print "getMachineKernelFile=%s" %boxbranding.getMachineKernelFile()
print "getMachineMtdRoot=%s" %boxbranding.getMachineMtdRoot()
print "getMachineRootFile=%s" %boxbranding.getMachineRootFile()
print "getMachineMKUBIFS=%s" %boxbranding.getMachineMKUBIFS()
print "getMachineUBINIZE=%s" %boxbranding.getMachineUBINIZE()
print "getBoxType=%s" %boxbranding.getBoxType()
print "getBrandOEM=%s" %boxbranding.getBrandOEM()
print "getOEVersion=%s" %boxbranding.getOEVersion()
print "getDriverDate=%s" %boxbranding.getDriverDate()
print "getImageVersion=%s" %boxbranding.getImageVersion()
print "getImageBuild=%s" %boxbranding.getImageBuild()
print "getImageDistro=%s" %boxbranding.getImageDistro()
print "getImageFolder=%s" %boxbranding.getImageFolder()
print "getImageFileSystem=%s" %boxbranding.getImageFileSystem()
示例#16
0
    def populate(self):
        def netspeed():
            netspeed = ""
            for line in popen('ethtool eth0 |grep Speed', 'r'):
                line = line.strip().split(":")
                line = line[1].replace(' ', '')
                netspeed += line
                return str(netspeed)

        def netspeed_eth1():
            netspeed = ""
            for line in popen('ethtool eth1 |grep Speed', 'r'):
                line = line.strip().split(":")
                line = line[1].replace(' ', '')
                netspeed += line
                return str(netspeed)

        def netspeed_ra0():
            netspeed = ""
            for line in popen('iwconfig ra0 | grep Bit | cut -c 20-30', 'r'):
                line = line.strip()
                netspeed += line
                return str(netspeed)

        def netspeed_wlan0():
            netspeed = ""
            for line in popen('iwconfig wlan0 | grep Bit | cut -c 20-30', 'r'):
                line = line.strip()
                netspeed += line
                return str(netspeed)

        def netspeed_wlan1():
            netspeed = ""
            for line in popen('iwconfig wlan1 | grep Bit | cut -c 20-30', 'r'):
                line = line.strip()
                netspeed += line
                return str(netspeed)

        def freeflash():
            freeflash = ""
            for line in popen(
                    "df -mh / | grep -v '^Filesystem' | awk '{print $4}'",
                    'r'):
                line = line.strip()
                freeflash += line
                return str(freeflash)

        self["lab1"] = StaticText(_("openHDF"))
        self["lab2"] = StaticText(_("Support at") + " www.HDFreaks.cc")
        model = None
        AboutText = ""
        self["lab2"] = StaticText(_("Support @") + " www.hdfreaks.cc")
        AboutText += _("Model:\t%s %s - OEM Model: %s\n") % (
            getMachineBrand(), getMachineName(), getBrandOEM())

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

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

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

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

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

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

        tempinfo = ""
        if path.exists('/proc/stb/sensors/temp0/value'):
            f = open('/proc/stb/sensors/temp0/value', 'r')
            tempinfo = f.read()
            f.close()
        elif path.exists('/proc/stb/fp/temp_sensor'):
            f = open('/proc/stb/fp/temp_sensor', 'r')
            tempinfo = f.read()
            f.close()
        elif path.exists('/proc/stb/sensors/temp/value'):
            f = open('/proc/stb/sensors/temp/value', 'r')
            tempinfo = f.read()
            f.close()
        elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'):
            try:
                f = open('/sys/devices/virtual/thermal/thermal_zone0/temp',
                         'r')
                tempinfo = f.read()
                tempinfo = tempinfo[:-4]
                f.close()
            except:
                tempinfo = ""

        if tempinfo and int(tempinfo.replace('\n', '')) > 0:
            mark = str('\xc2\xb0')
            AboutText += _("System Temp:\t%s") % tempinfo.replace(
                '\n', '').replace(' ', '') + mark + "C\n"

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

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

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

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

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

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

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

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

        self["AboutScrollLabel"] = ScrollLabel(AboutText)
示例#17
0
def getInfo(session=None, need_fullinfo=False):
	# TODO: get webif versione somewhere!
	info = {}
	global STATICBOXINFO

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

	info['brand'] = getMachineBrand()
	info['model'] = getMachineName()
	info['boxtype'] = getBoxType()
	info['machinebuild'] = getMachineBuild()

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

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

	info['chipset'] = chipset

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	info['transcoding'] = TRANSCODING

	info['kinopoisk'] = KINOPOISK

	info['EX'] = ''

	if session:
		try:
			recs = NavigationInstance.instance.getRecordings()
			if recs:
				# only one stream and only TV
				from Plugins.Extensions.OpenWebif.controllers.stream import streamList
				s_name = ''
				# s_cip = ''

				print "[OpenWebif] -D- streamList count '%d'" % len(streamList)
				if len(streamList) == 1:
					from Screens.ChannelSelection import service_types_tv
					# from enigma import eEPGCache
					# epgcache = eEPGCache.getInstance()
					serviceHandler = eServiceCenter.getInstance()
					services = serviceHandler.list(eServiceReference('%s ORDER BY name' % (service_types_tv)))
					channels = services and services.getContent("SN", True)
					s = streamList[0]
					srefs = s.ref.toString()
					for channel in channels:
						if srefs == channel[0]:
							s_name = channel[1] + ' (' + s.clientIP + ')'
							break
				print "[OpenWebif] -D- s_name '%s'" % s_name

				for stream in streamList:
					srefs = stream.ref.toString()
					print "[OpenWebif] -D- srefs '%s'" % srefs

				sname = ''
				timers = []
				for timer in NavigationInstance.instance.RecordTimer.timer_list:
					if timer.isRunning() and not timer.justplay:
						timers.append(timer.service_ref.getServiceName().replace('\xc2\x86', '').replace('\xc2\x87', ''))
						print "[OpenWebif] -D- timer '%s'" % timer.service_ref.getServiceName()
				# only one recording
				if len(timers) == 1:
					sname = timers[0]

				if sname == '' and s_name != '':
					sname = s_name

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

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

			service = session.nav.getCurrentService()
			if service is not None:
				sname = service.info().getName()
				feinfo = service.frontendInfo()
				frontendData = feinfo and feinfo.getAll(True)
				if frontendData is not None:
					cur_info = feinfo.getTransponderData(True)
					if cur_info:
						nr = frontendData['tuner_number']
						info['tuners'][nr]['live'] = getOrbitalText(cur_info) + ' / ' + sname
		except Exception, error:
			info['EX'] = error
示例#18
0
	def populate(self):
		self["lab1"] = StaticText(_("openHDF by HDF Image Team"))
		self["lab2"] = StaticText(_("Support at") + " www.HDFreaks.cc")
		model = None
		AboutText = ""
		self["lab2"] = StaticText(_("Support @") + " www.hdfreaks.cc")
		AboutText += _("Model:\t%s %s - OEM Model: %s\n") % (getMachineBrand(), getMachineName(), getBrandOEM())

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

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

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

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

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

		if getMachineBuild() in ('vusolo4k','hd51','hd52','sf4008','dm900','h7','gb7252','8100s'):
			AboutText += _("CPU:\t%s") % about.getCPUString() + cpuMHz + "\n"
		else:
			AboutText += _("CPU:\t%s") % about.getCPUString() + " " + cpuMHz + "\n"
		dMIPS = 0
		if getMachineBuild() in ('vusolo4k'):
			dMIPS = "10.500"
		elif getMachineBuild() in ('hd52','hd51','sf4008','dm900','h7','gb7252','8100s'):
			dMIPS = "12.000"
		if getMachineBuild() in ('vusolo4k','hd51','hd52','sf4008','dm900','h7','gb7252','8100s'):
			AboutText += _("DMIPS:\t") + dMIPS + "\n"
		else:
			AboutText += _("BogoMIPS:\t%s") % bogoMIPS + "\n"
		AboutText += _("Cores:\t%s") % about.getCpuCoresString() + "\n"
		AboutText += _("HDF Version:\tV%s") % getImageVersion() + " Build #" + getImageBuild() + " based on " + getOEVersion() + "\n"
		AboutText += _("Kernel (Box):\t%s") % about.getKernelVersionString() + " (" + getBoxType() + ")" + "\n"
		imagestarted = ""
		bootname = ''
		if path.exists('/boot/bootname'):
			f = open('/boot/bootname', 'r')
			bootname = f.readline().split('=')[1]
			f.close()
		if getMachineBuild() in ('cc1','sf8008'):
			if path.exists('/boot/STARTUP'):
				f = open('/boot/STARTUP', 'r')
				f.seek(5)
				image = f.read(4)
				if image == "emmc":
					image = "1"
				elif image == "usb0":
					f.seek(13)
					image = f.read(1)
					if image == "1":
						image = "2"
					elif image == "3":
						image = "3"
					elif image == "5":
						image = "4"
					elif image == "7":
						image = "5"
				f.close()
				if bootname: bootname = "   (%s)" %bootname 
				AboutText += _("Selected Image:\t%s") % "STARTUP_" + image + bootname + "\n"
		if path.exists('/boot/STARTUP'):
			f = open('/boot/STARTUP', 'r')
			f.seek(22)
			image = f.read(1)
			f.close()
			if bootname: bootname = "   (%s)" %bootname
			AboutText += _("Image started:\t%s") % "STARTUP_" + image + bootname + "\n"

		string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))
		gstcmd = 'opkg list-installed | grep "gstreamer1.0 -" | cut -c 16-32'
		gstcmd2 = os.system(gstcmd)
		#return (gstcmd2)
		AboutText += _("Drivers:\t%s") % driversdate + "\n"
		#AboutText += _("GStreamer:\t%s") % gstcmd2 + "\n"
		AboutText += _("GStreamer:\t%s") % about.getGStreamerVersionString() + "\n"
		AboutText += _("Last update:\t%s") % getEnigmaVersionString() + " to Build #" + getImageBuild() + "\n"
		AboutText += _("Flashed:\t%s\n") % about.getFlashDateString()
		AboutText += _("Python:\t%s\n") % about.getPythonVersionString()
		AboutText += _("E2 (re)starts:\t%s\n") % config.misc.startCounter.value
		AboutText += _("Network:")
		for x in about.GetIPsFromNetworkInterfaces():
			AboutText += "\t" + x[0] + ": " + x[1] + "\n"

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

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

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

		self["AboutScrollLabel"] = ScrollLabel(AboutText)
示例#19
0
try:
	os.system("echo box_type=" + getBoxType() + " > /etc/image-version")
	os.system("echo build_type=" + getImageType() + " >> /etc/image-version")
	os.system("echo machine_brand=" + getMachineBrand() + " >> /etc/image-version")
	os.system("echo machine_name=" + getMachineName() + " >> /etc/image-version")
	os.system("echo version=" + getImageVersion() + " >> /etc/image-version")
	os.system("echo build=" + getImageBuild() + " >> /etc/image-version")
	os.system("echo imageversion=" + getImageVersion() + "-" + getImageBuild() + " >> /etc/image-version")
	os.system("echo date=`cat /etc/version`" + " >> /etc/image-version")
	os.system("echo comment=openHDF" " >> /etc/image-version")
	os.system("echo target=9" " >> /etc/image-version")
	os.system("echo creator=OpenHDF" " >> /etc/image-version")
	os.system("echo url=http://www.hdfreaks.cc" " >> /etc/image-version")
	os.system("echo catalog=http://www.hdfreaks.cc" " >> /etc/image-version")
	os.system("echo distro=" + getImageDistro() + " >> /etc/image-version")
	os.system("echo oeversion=" + getOEVersion() + " >> /etc/image-version")
	os.system("echo date=" + getImageBuild() + " >> /etc/image-version")
except:
	pass

try:
	os.system("echo ~~~ Box Info ~~~~~~~~~~~~~~~~~~~~"" > /tmp/.ImageVersion")
	os.system("echo getMachineName = " + getMachineName() + " >> /tmp/.ImageVersion")
	os.system("echo getMachineBrand = " + getMachineBrand() + " >> /tmp/.ImageVersion")
	os.system("echo getBoxType = " + getBoxType() + " >> /tmp/.ImageVersion")
	os.system("echo getBrandOEM = " + getBrandOEM() + " >> /tmp/.ImageVersion")
	os.system("echo getDriverDate = " + getDriverDate() + " >> /tmp/.ImageVersion")
	os.system("echo getImageVersion = " + getImageVersion() + " >> /tmp/.ImageVersion")
	os.system("echo getImageBuild = " + getImageBuild() + " >> /tmp/.ImageVersion")
	os.system("echo ~~~ CPU Info ~~~~~~~~~~~~~~~~~~~~"" >> /tmp/.ImageVersion")
	os.system("cat /proc/cpuinfo >> /tmp/.ImageVersion")
示例#20
0
from __future__ import print_function
import boxbranding
print("getMachineBuild=%s<" %boxbranding.getMachineBuild())
print("getMachineProcModel=%s<" %boxbranding.getMachineProcModel())
print("getMachineBrand=%s<" %boxbranding.getMachineBrand())
print("getMachineName=%s<" %boxbranding.getMachineName())
print("getMachineMtdKernel=%s<" %boxbranding.getMachineMtdKernel())
print("getMachineKernelFile=%s<" %boxbranding.getMachineKernelFile())
print("getMachineMtdRoot=%s<" %boxbranding.getMachineMtdRoot())
print("getMachineRootFile=%s<" %boxbranding.getMachineRootFile())
print("getMachineMKUBIFS=%s<" %boxbranding.getMachineMKUBIFS())
print("getMachineUBINIZE=%s<" %boxbranding.getMachineUBINIZE())
print("getBoxType=%s<" %boxbranding.getBoxType())
print("getBrandOEM=%s<" %boxbranding.getBrandOEM())
print("getOEVersion=%s<" %boxbranding.getOEVersion())
print("getDriverDate=%s<" %boxbranding.getDriverDate())
print("getImageVersion=%s<" %boxbranding.getImageVersion())
print("getImageBuild=%s<" %boxbranding.getImageBuild())
print("getImageDistro=%s<" %boxbranding.getImageDistro())
print("getImageFolder=%s<" %boxbranding.getImageFolder())
print("getImageFileSystem=%s<" %boxbranding.getImageFileSystem())
print("getImageDevBuild=%s<" %boxbranding.getImageDevBuild())
print("getImageType=%s<" %boxbranding.getImageType())
print("getMachineMake=%s<" %boxbranding.getMachineMake())
print("getImageArch=%s<" %boxbranding.getImageArch())
print("getFeedsUrl=%s<" %boxbranding.getFeedsUrl())
print("getDisplayType=%s<" %boxbranding.getDisplayType())
print("getHaveHDMI%s<" %boxbranding.getHaveHDMI())
print("getHaveYUV%s<" %boxbranding.getHaveYUV())
print("getHaveRCA%s<" %boxbranding.getHaveRCA())
print("getHaveAVJACK%s<" %boxbranding.getHaveAVJACK())
示例#21
0
    def __init__(self, session):
        Screen.__init__(self, session)
        self.setTitle(_("About"))
        OpenNFRVersion = _("OpenNFR %s") % about.getImageVersionString()
        self["OpenNFRVersion"] = Label(OpenNFRVersion)

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

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

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

        cpuMHz = ""
        if getMachineBuild() in ('u41', 'u42', 'u43'):
            cpuMHz = _("   (1.0 GHz)")
        elif getMachineBuild() in ('dags72604', 'vusolo4k', 'vuultimo4k',
                                   'vuzero4k', 'gb72604'):
            cpuMHz = "   (1,5 GHz)"
        elif getMachineBuild() in ('formuler1', 'triplex'):
            cpuMHz = "   (1,3 GHz)"
        elif getMachineBuild() in ('gbmv200', 'u51', 'u5', 'u53', 'u52', 'u54',
                                   'u55', 'u56', 'u5pvr', 'h9', 'h9combo',
                                   'cc1', 'sf8008', 'sf8008m', 'hd60', 'hd61',
                                   'i55plus', 'ustym4kpro', 'v8plus',
                                   'multibox'):
            cpuMHz = "   (1,6 GHz)"
        elif getMachineBuild() in ('vuuno4k', 'vuultimo4k', 'gb7252',
                                   'dags7252', '8100s'):
            cpuMHz = "   (1,7 GHz)"
        elif getMachineBuild() in ('alien5', 'u53'):
            cpuMHz = "   (2,0 GHz)"
        elif getMachineBuild() in ('vuduo4k', ):
            cpuMHz = _("   (2.1 GHz)")
        elif getMachineBuild() in ('sf5008', 'et13000', 'et1x000', 'hd52',
                                   'hd51', 'sf4008', 'vs1500', 'h7', 'osmio4k',
                                   'osmio4kplus', 'osmini4k'):
            try:
                import binascii
                f = open(
                    '/sys/firmware/devicetree/base/cpus/cpu@0/clock-frequency',
                    'rb')
                clockfrequency = f.read()
                f.close()
                cpuMHz = "   (%s MHz)" % str(
                    round(
                        int(binascii.hexlify(clockfrequency), 16) / 1000000,
                        1))
            except:
                cpuMHz = "   (1,7 GHz)"
        else:
            if path.exists('/proc/cpuinfo'):
                f = open('/proc/cpuinfo', 'r')
                temp = f.readlines()
                f.close()
                try:
                    for lines in temp:
                        lisp = lines.split(': ')
                        if lisp[0].startswith('cpu MHz'):
                            #cpuMHz = "   (" +  lisp[1].replace('\n', '') + " MHz)"
                            cpuMHz = "   (" + str(
                                int(float(lisp[1].replace('\n',
                                                          '')))) + " MHz)"
                            break
                except:
                    pass

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

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

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

        if SystemInfo["canMultiBoot"]:
            slot = image = GetCurrentImage()
            bootmode = ""
            part = "eMMC slot %s" % slot
            if SystemInfo["canMode12"]:
                bootmode = "bootmode = %s" % GetCurrentImageMode()
            if SystemInfo["HasHiSi"] and "sda" in SystemInfo["canMultiBoot"][
                    slot]['device']:
                if slot > 4:
                    image -= 4
                else:
                    image -= 1
                part = "SDcard slot %s (%s) " % (
                    image, SystemInfo["canMultiBoot"][slot]['device'])
            AboutText += _("Selected Image:\t\t%s") % _("STARTUP_") + str(
                slot) + "  " + part + " " + bootmode + "\n"
        string = getDriverDate()
        year = string[0:4]
        month = string[4:6]
        day = string[6:8]
        driversdate = '-'.join((year, month, day))
        AboutText += _("Drivers:\t\t%s") % driversdate + "\n"
        AboutText += _("Image:\t\t%s") % about.getImageVersionString() + "\n"
        AboutText += _("Build:\t\t%s") % getImageBuild() + "\n"
        AboutText += _(
            "Kernel: \t\t%s") % about.getKernelVersionString() + "\n"
        AboutText += _("Oe-Core:\t\t%s") % getOEVersion() + "\n"
        AboutText += _(
            "Enigma (re)starts:\t%d\n") % config.misc.startCounter.value
        AboutText += _(
            "GStreamer:\t\t%s") % about.getGStreamerVersionString() + "\n"
        AboutText += _("Python:\t\t%s") % about.getPythonVersionString() + "\n"

        fp_version = getFPVersion()
        if fp_version is None:
            fp_version = ""
        elif fp_version != 0:
            fp_version = _("Front Panel:\t\t%s") % fp_version
            AboutText += fp_version + "\n"
        else:
            fp_version = _("Front Panel:\t\tVersion unknown")
            AboutText += fp_version + "\n"

        if getMachineBuild() not in ('gbmv200', 'vuduo4k', 'v8plus',
                                     'ustym4kpro', 'hd60', 'hd61', 'i55plus',
                                     'osmio4k', 'osmio4kplus', 'h9', 'h9combo',
                                     'vuzero4k', 'sf5008', 'et13000',
                                     'et1x000', 'hd51', 'hd52', 'vusolo4k',
                                     'vuuno4k', 'vuuno4kse', 'vuultimo4k',
                                     'sf4008', 'dm820', 'dm7080', 'dm900',
                                     'dm920', 'gb7252', 'dags7252', 'vs1500',
                                     'h7', 'xc7439', '8100s', 'u41', 'u42',
                                     'u43', 'u5', 'u5pvr', 'u52', 'u53', 'u54',
                                     'u55', 'u56', 'u51', 'cc1', 'sf8008m',
                                     'sf8008'):
            AboutText += _(
                "Installed:\t\t%s") % about.getFlashDateString() + "\n"
        AboutText += _(
            "Last Upgrade:\t\t%s") % about.getLastUpdateString() + "\n\n"

        self["FPVersion"] = StaticText(fp_version)

        AboutText += _("WWW:\t\t%s") % about.getImageUrlString() + "\n\n"
        AboutText += _(
            "based on:\t\t%s") % "www.github.com/oe-alliance" + "\n\n"
        # don't remove the string out of the _(), or it can't be "translated" anymore.
        # TRANSLATORS: Add here whatever should be shown in the "translator" about screen, up to 6 lines (use \n for newline)
        info = _("TRANSLATOR_INFO")

        if info == _("TRANSLATOR_INFO"):
            info = ""

        infolines = _("").split("\n")
        infomap = {}
        for x in infolines:
            l = x.split(': ')
            if len(l) != 2:
                continue
            (type, value) = l
            infomap[type] = value

        translator_name = infomap.get("Language-Team", "none")
        if translator_name == "none":
            translator_name = infomap.get("Last-Translator", "")

        self["FPVersion"] = StaticText(fp_version)

        self["TunerHeader"] = StaticText(_("Detected NIMs:"))

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

        self["HDDHeader"] = StaticText(_("Detected HDD:"))

        hddlist = harddiskmanager.HDDList()
        hddinfo = ""
        if hddlist:
            for count in range(len(hddlist)):
                if hddinfo:
                    hddinfo += "\n"
                hdd = hddlist[count][1]
                if int(hdd.free()) > 1024:
                    hddinfo += "%s\n(%s, %d GB %s)" % (
                        hdd.model(), hdd.capacity(), hdd.free() / 1024,
                        _("free"))
                else:
                    hddinfo += "%s\n(%s, %d MB %s)" % (
                        hdd.model(), hdd.capacity(), hdd.free(), _("free"))
        else:
            hddinfo = _("none")
        self["hddA"] = StaticText(hddinfo)

        self["AboutScrollLabel"] = ScrollLabel(AboutText)

        self["actions"] = ActionMap(
            ["SetupActions", "ColorActions", "DirectionActions"], {
                "cancel": self.close,
                "ok": self.close,
                "green": self.showTranslationInfo,
                "up": self["AboutScrollLabel"].pageUp,
                "down": self["AboutScrollLabel"].pageDown
            })
示例#22
0
def getInfo(session=None, need_fullinfo=False):
    # TODO: get webif versione somewhere!
    info = {}
    global STATICBOXINFO

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

    info['brand'] = getMachineBrand()
    info['model'] = getMachineName()
    info['boxtype'] = getBoxType()
    info['machinebuild'] = getMachineBuild()

    chipset = "unknown"
    if fileExists("/etc/.box"):
        f = open("/etc/.box", 'r')
        model = f.readline().strip().lower()
        f.close()
        if model.startswith("ufs") or model.startswith("ufc"):
            if model in ("ufs910", "ufs922", "ufc960"):
                chipset = "SH4 @266MHz"
            else:
                chipset = "SH4 @450MHz"
        elif model in ("topf", "tf7700hdpvr"):
            chipset = "SH4 @266MHz"
        elif model.startswith("azbox"):
            f = open("/proc/stb/info/model", 'r')
            model = f.readline().strip().lower()
            f.close()
            if model == "me":
                chipset = "SIGMA 8655"
            elif model == "minime":
                chipset = "SIGMA 8653"
            else:
                chipset = "SIGMA 8634"
        elif model.startswith("spark"):
            if model == "spark7162":
                chipset = "SH4 @540MHz"
            else:
                chipset = "SH4 @450MHz"
    elif fileExists("/proc/stb/info/azmodel"):
        f = open("/proc/stb/info/model", 'r')
        model = f.readline().strip().lower()
        f.close()
        if model == "me":
            chipset = "SIGMA 8655"
        elif model == "minime":
            chipset = "SIGMA 8653"
        else:
            chipset = "SIGMA 8634"
    elif fileExists("/proc/stb/info/model"):
        f = open("/proc/stb/info/model", 'r')
        model = f.readline().strip().lower()
        f.close()
        if model == "tf7700hdpvr":
            chipset = "SH4 @266MHz"
        elif model == "nbox":
            chipset = "STi7100 @266MHz"
        elif model == "arivalink200":
            chipset = "STi7109 @266MHz"
        elif model in ("adb2850", "adb2849", "dsi87"):
            chipset = "STi7111 @450MHz"
        elif model in ("sagemcom88", "esi88"):
            chipset = "STi7105 @450MHz"
        elif model.startswith("spark"):
            if model == "spark7162":
                chipset = "STi7162 @540MHz"
            else:
                chipset = "STi7111 @450MHz"

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

    info['chipset'] = chipset

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

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

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

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

    try:
        info['fp_version'] = getFPVersion()
    except:
        info['fp_version'] = None

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

    info['friendlychipsetdescription'] = friendlychipsetdescription
    info['friendlychipsettext'] = friendlychipsettext

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

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

    info['hdd'] = []
    for hdd in harddiskmanager.hdd:
        dev = hdd.findMount()
        if dev:
            stat = os.statvfs(dev)
            free = int((stat.f_bfree / 1024) * (stat.f_bsize / 1024))
        else:
            free = -1

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

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

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

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

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

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

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

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

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

    info['transcoding'] = False
    if (info['model'] in ("Uno4K", "Ultimo4K", "Solo4K", "Solo²", "Duo²",
                          "Solo SE", "Quad", "Quad Plus")
            or info['machinebuild']
            in ('inihdp', 'hd2400', 'et10000', 'et13000', 'sf5008', 'xpeedlx3',
                'ew7356', 'dags7356', 'dags7252', 'formuler1tc', 'gb7356',
                'gb7252', 'tiviaraplus', '8100s')):
        if os.path.exists(
                eEnv.resolve(
                    '${libdir}/enigma2/python/Plugins/SystemPlugins/TransCodingSetup/plugin.pyo'
                )
        ) or os.path.exists(
                eEnv.resolve(
                    '${libdir}/enigma2/python/Plugins/SystemPlugins/TranscodingSetup/plugin.pyo'
                )
        ) or os.path.exists(
                eEnv.resolve(
                    '${libdir}/enigma2/python/Plugins/SystemPlugins/MultiTransCodingSetup/plugin.pyo'
                )):
            info['transcoding'] = True

    info['kinopoisk'] = False
    lang = ['ru', 'uk', 'lv', 'lt', 'et']
    for l in lang:
        if l in language.getLanguage():
            info['kinopoisk'] = True

    info['EX'] = ''

    if session:
        try:
            recs = NavigationInstance.instance.getRecordings()
            if recs:
                # only one stream and only TV
                from Plugins.Extensions.OpenWebif.controllers.stream import streamList
                s_name = ''
                s_cip = ''

                print "[OpenWebif] -D- streamList count '%d'" % len(streamList)
                if len(streamList) == 1:
                    from Screens.ChannelSelection import service_types_tv
                    from enigma import eEPGCache
                    epgcache = eEPGCache.getInstance()
                    serviceHandler = eServiceCenter.getInstance()
                    services = serviceHandler.list(
                        eServiceReference('%s ORDER BY name' %
                                          (service_types_tv)))
                    channels = services and services.getContent("SN", True)
                    s = streamList[0]
                    srefs = s.ref.toString()
                    for channel in channels:
                        if srefs == channel[0]:
                            s_name = channel[1] + ' (' + s.clientIP + ')'
                            break
                print "[OpenWebif] -D- s_name '%s'" % s_name

                for stream in streamList:
                    srefs = stream.ref.toString()
                    print "[OpenWebif] -D- srefs '%s'" % srefs

                sname = ''
                timers = []
                for timer in NavigationInstance.instance.RecordTimer.timer_list:
                    if timer.isRunning() and not timer.justplay:
                        timers.append(
                            timer.service_ref.getServiceName().replace(
                                '\xc2\x86', '').replace('\xc2\x87', ''))
                        print "[OpenWebif] -D- timer '%s'" % timer.service_ref.getServiceName(
                        )
                # only one recording
                if len(timers) == 1:
                    sname = timers[0]

                if sname == '' and s_name != '':
                    sname = s_name

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

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

            service = session.nav.getCurrentService()
            if service is not None:
                sname = service.info().getName()
                feinfo = service.frontendInfo()
                frontendData = feinfo and feinfo.getAll(True)
                if frontendData is not None:
                    cur_info = feinfo.getTransponderData(True)
                    if cur_info:
                        nr = frontendData['tuner_number']
                        info['tuners'][nr]['live'] = getOrbitalText(
                            cur_info) + ' / ' + sname
        except Exception, error:
            info['EX'] = error
示例#23
0
	def action(self, req):
		global Mode
		global ModeOld
		global Element
		global ElementList
		global ExeMode
		global StatusMode
		IP = req.getClientIP()
		if getOEVersion() == "OE-Alliance 4.3":
			IP = IP.split(":")[-1]
		L4logE("IP1:",IP)
		if IP is None:
			IP = req.client.host.split(":")[-1]
			L4logE("IP2:",req.client.host)
			if IP.find(".") == -1:
				IP = None
		if IP is None:
			Block = False
		else:
			Block = True
			WL = LCD4linux.WebIfAllow.value
			for x in WL.split():
				if IP.startswith(x):
					Block = False
					break
			if "*" in WL:
				Block = False
			WL = LCD4linux.WebIfDeny.value
			for x in WL.split():
				if IP.startswith(x):
					Block = True
					break
		if Block == True:
			html = "<html>"
			html += "<head>\n"
			html += "<meta http-equiv=\"Content-Language\" content=\"de\">\n"
			html += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">\n"
			html += "<meta http-equiv=\"cache-control\" content=\"no-cache\" />\n"
			html += "<meta http-equiv=\"pragma\" content=\"no-cache\" />\n"
			html += "<meta http-equiv=\"expires\" content=\"0\">\n"
			html += "</head>"
			html += "Config-WebIF Access Deny ( IP: %s )<br>\n" % IP
			html += "Please check Setting in Global > %s\n" % _l(_("WebIF IP Allow"))
			html += "Default is: 127. 192.168. 172. 10.\n"
			html += "</body>\n"
			html += "</html>\n"
			return html
		if len(L1) == 0:
			ParseCode()

		req.setResponseCode(http.OK)
		req.setHeader('Content-type', 'text/html')
		req.setHeader('charset', 'UTF-8')

		command = req.args.get("cmd",None)
		ex = req.args.get("ex",None)
		mo = req.args.get("Mode",None)
		el = req.args.get("Element",None)
		self.restartTimer()
		L4log("Command received %s" % (command), ex)
#		print "[L4L EX]-", ex,"-"
		if self.CurrentMode == ("-","-"):
			self.CurrentMode = (getConfigStandby(),getisMediaPlayer())
		if mo is not None:
			Mode = mo[0]
			setConfigMode(True)
			if Mode in ["1","2"]:
				setisMediaPlayer("")
				setConfigStandby(False)
			elif Mode == "3":	
				setisMediaPlayer("config")
				setConfigStandby(False)
			elif Mode == "4":
				setisMediaPlayer("")
				setConfigStandby(True)
			elif Mode == "5":
				self.resetWeb()
			getBilder()
		html = ""
		if el is not None:
			Element = el[0]
		if req.args.get("save.y",None) is not None:
			L4log("WebIF: save Config-File")
			LCD4linux.save()
			LCD4linux.saveToFile(LCD4config)
			ConfTimeCheck()
		if req.args.get("download.y",None) is not None:
			L4log("WebIF: download Config")
			req.setResponseCode(http.OK)
			lcd4config = "/etc/enigma2/lcd4config"
			req.setHeader('Content-type', 'text/plain')
			req.setHeader('Content-Disposition', 'attachment;filename=lcd4config')
			req.setHeader('Content-Length', os.stat(lcd4config).st_size)
			req.setHeader('charset', 'UTF-8')
			f = open(lcd4config,"r")
			html = f.read()
			f.close()
			return html
		if req.args.get("upload.y",None) is not None:
			L4log("WebIF: upload Config")
			lcd4config = "/tmp/test"
			data = req.args["uploadName"][0]
			if len(data) > 0 and data.startswith("config."):
				f = open(lcd4config,"wb")
				f.write(data)
				f.close()
				if os.path.isfile(lcd4config):
					L4LoadNewConfig(lcd4config)
			else:
				L4log("WebIF: Error upload")
				html += "<script language=\"JavaScript\">\n"
				html += "alert(\"%s\")\n" % _("No or wrong File selected, try a correct File first !")
				html += "</script>\n"
		if req.args.get("logdel.y",None) is not None:
			L4log("WebIF: delete Logfile")
			rmFile("/tmp/L4log.txt")
		if req.args.get("logdownload.y",None) is not None:
			L4log("WebIF: download Logfile")
			lcd4config = "/tmp/L4log.txt"
			if os.path.isfile(lcd4config):
				req.setResponseCode(http.OK)
				req.setHeader('Content-type', 'text/plain')
				req.setHeader('Content-Disposition', 'attachment;filename=l4log.txt')
				req.setHeader('Content-Length', os.stat(lcd4config).st_size)
				req.setHeader('charset', 'UTF-8')
				f = open(lcd4config,"r")
				html = f.read()
				f.close()
				return html

		if command is None:
			L4logE("no command")
		elif command[0] == "exec" and ex is not None:
			L4logE("exec",ex[0])
			exec(ex[0])
		elif command[0] == "enable":
			ExeMode = True
		elif command[0] == "status":
			StatusMode = True
		elif command[0] == "pop":
			V = _l(req.args.get("PopText","")[0])
			try:
				import HTMLParser
				parse=HTMLParser.HTMLParser()
				V = parse.unescape(V)
			except:
				L4log("WebIF Error: Parse Text")
			setPopText(V)
			L4LElement.setRefresh()
		elif command[0] == "popclear":
			setPopText("")
		elif command[0].startswith("Screen"):
			setScreenActive(command[0][-1])
			L4LElement.setRefresh()
		elif command[0] == "crashdel":
			rmFile(CrashFile)
		elif command[0] == "add" and ex is not None:
			L4LElement.web(ex[0])
		elif command[0] == "delete" and ex is not None:
			L4LElement.delete(ex[0])
		elif command[0] == "refresh":
			L4LElement.setRefresh()
		elif command[0] == "hold":
			setScreenActive("0")
			setSaveEventListChanged(not getSaveEventListChanged())
		elif command[0] == "screen" and ex is not None:
			exs = ex[0].split(",")
			if len(exs) == 1:
				L4LElement.setScreen(exs[0])
			elif len(exs) == 2:
				L4LElement.setScreen(exs[0],exs[1])
			elif len(exs) == 3:
				L4LElement.setScreen(exs[0],exs[1],exs[2])
		elif command[0] == "brightness" and ex is not None:
			exs = ex[0].split(",")
			if len(exs) == 1:
				L4LElement.setBrightness(exs[0])
			elif len(exs) == 2:
				L4LElement.setBrightness(exs[0],exs[1])
		elif command[0] == "getbrightness" and ex is not None:
			if int(ex[0])<1 or int(ex[0])>3:
				return "0"
			else:
				return str(L4LElement.getBrightness(int(ex[0])))
		elif command[0] == "getmjpeg" and ex is not None:
			if int(ex[0])<1 or int(ex[0])>3:
				return "0"
			else:
				return str(getMJPEGreader(ex[0]))
		elif command[0] == "getexec" and ex is not None:
			L4logE("getexec",ex[0])
			exec("getexec = " + ex[0])
			return str(getexec)
		elif command[0] == "copyMP":
			for a in req.args.keys():
				if ".Standby" in a:
					b = a.replace(".Standby",".MP")
					if (" "+b) in zip(*L3)[2]:
						print a,b
						exec("%s.value = %s.value" % (b,a))
				elif "." in a:
					b = a.replace(".",".MP")
					if (" "+b) in zip(*L3)[2]:
						print a,b
						exec("%s.value = %s.value" % (b,a))
		elif command[0] == "copyIdle":
			for a in req.args.keys():
				if ".MP" in a:
					b = a.replace(".MP",".Standby")
					if (" "+b) in zip(*L4)[2]:
						print a,b
						exec("%s.value = %s.value" % (b,a))
				elif "." in a:
					b = a.replace(".",".Standby")
					if (" "+b) in zip(*L4)[2]:
						print a,b
						exec("%s.value = %s.value" % (b,a))
		elif command[0] == "copyOn":
			for a in req.args.keys():
				if ".MP" in a:
					b = a.replace(".MP",".")
					if (" "+b) in zip(*L2)[2]:
						print a,b
						exec("%s.value = %s.value" % (b,a))
				elif ".Standby" in a:
					b = a.replace(".Standby",".")
					if (" "+b) in zip(*L2)[2]:
						print a,b
						exec("%s.value = %s.value" % (b,a))

#####################
# Konfig schreiben
#####################
		elif command[0] == "config":
			Cfritz = False
			Cwetter = False
			Cpicon = False
			Ccal = False
			Cwww = False
			for a in req.args.keys():
				if a.find(".") > 0:
#ConfigSelection
					exec("Typ = isinstance(%s,ConfigSelection)" % a)
					if Typ == True:
						exec("%s.value = '%s'" % (a,req.args.get(a,"")[0]))
					else:
#ConfigYesNo
						exec("Typ = isinstance(%s,ConfigYesNo)" % a)
						if Typ == True:
							if len(req.args.get(a,"")) == 2:
								exec("%s.value = True" % a)
							else:
								exec("%s.value = False" % a)
						else:
#ConfigText
							exec("Typ = isinstance(%s,ConfigText)" % a)
							if Typ == True:
								V = _l(req.args.get(a,"")[0])
								try:
									import HTMLParser
									parse=HTMLParser.HTMLParser()
									V = parse.unescape(V)
								except:
									L4log("WebIF Error: Parse Text")
								exec("%s.value = '%s'" % (a,V))
							else:
#ConfigSlider
								exec("Typ = isinstance(%s,ConfigSlider)" % a)
								if Typ == True:
									if req.args.get(a,"")[0].isdigit():
										exec("%s.value = %s" % (a,req.args.get(a,"")[0]))
								else:
#ConfigClock
									exec("Typ = isinstance(%s,ConfigClock)" % a)
									if Typ == True:
										t=req.args.get(a,"")[0].split(":")
										if len(t)==2:
											if t[0].isdigit() and t[1].isdigit():
												w1 = "[%s,%s]" % (int(t[0]),int(t[1]))
												exec("%s.value = %s" % (a,w1))
					exec("C = %s.isChanged()" % a)
					if C:
						exec("C = %s.save()" % a)
						L4log("Changed",a)
						if a.find("Fritz") >0:
							Cfritz = True
						elif a.find("Wetter") >0:
							Cwetter = True
						elif a.find("Picon") >0:
							Cpicon = True
						elif a.find(".Cal") >0 or a.find(".MPCal") >0 or a.find(".StandbyCal") >0:
							Ccal = True
						elif a.find(".xmlType") >0:
							if a.find(".xmlLCDType") >0:
								xmlRead()
								if xmlDelete(1) or xmlDelete(2) or xmlDelete(3):
									L4log("removed old Skindata")
									xmlWrite()
							if xmlSkin():
								xmlWrite()
								LCD4linuxConfigweb.RestartGUI = True
							xmlClear()
						elif a.find(".MJPEG") >0:
							MJPEG_stop("")
							MJPEG_start()
						elif a.find(".Font") >0:
							setFONT(LCD4linux.Font.value)
						if a.find("WetterCity") >0:
							resetWetter()
						if a.find("ScreenActive") >0:
							setScreenActive(LCD4linux.ScreenActive.value)
						if a.find("BildFile") >0:
							getBilder()
						if a.find("WWW1") >0:
							if a.find("WWW1url") >0 or os.path.isfile(WWWpic % "1") == False:
								Cwww = True
							else:
								rmFile(WWWpic % "1p")
			if Cfritz:
				rmFile(PICfritz)
			if Cwetter:
				resetWetter()
			if Cpicon:
				if len(LCD4linux.PiconCache.value)>2:
					rmFiles(os.path.join(LCD4linux.PiconCache.value,"*.png"))
				if len(LCD4linux.Picon2Cache.value)>2:
					rmFiles(os.path.join(LCD4linux.Picon2Cache.value,"*.png"))
			if Ccal:
				resetCal()
			if Cwww:
				getWWW()

			L4LElement.setRefresh()
#####################
# Anzeige
#####################
		html += "<html>"
		html += "<head>\n"
		html += "<meta http-equiv=\"Content-Language\" content=\"de\">\n"
		html += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"
		html += "<meta http-equiv=\"cache-control\" content=\"no-cache\" />\n"
		html += "<meta http-equiv=\"pragma\" content=\"no-cache\" />\n"
		html += "<meta http-equiv=\"expires\" content=\"0\">\n"
		html += "<link rel=\"shortcut icon\" href=\"/lcd4linux/data/favicon.png\">"
		if os.path.isfile(CrashFile):
			html += "<script language=\"JavaScript\">\n"
			html += "function fensterchen() {\n"
			html += "fens1=window.open(\"\", \"Crashlog\",\"width=500,height=300,resizable=yes\");\n"
			for line in open(CrashFile,"r").readlines():
				html += "fens1.document.write('%s');\n" % line.replace("\n","<br>").replace("'","\\'")
			html += "} </script>\n"
		html += "<style type=\"text/css\">\n"
		html += ".style1 {\n"
		html += "vertical-align: middle; font-size:8px; }\n"
		html += "</style>\n"
		if L4LElement.getRefresh() == True:
			GI = getINFO().split()
			if len(GI)>6:
				GR = min(int(float(GI[6]))+1,6)
			else:
				GR = 6
			html += "<meta http-equiv=\"refresh\" content=\"%d\">\n" % GR
		html += "<title>LCD4linux</title>\n"
		html += "</head>"
		html += "<body bgcolor=\"#666666\" text=\"#FFFFFF\">\n"
		html += "<form method=\"POST\" action=\"--WEBBOT-SELF--\">\n"
		html += "</form>\n"
		html += "<table border=\"1\" rules=\"groups\" width=\"100%\" bordercolorlight=\"#000000\" bordercolordark=\"#000000\" cellspacing=\"0\">"
		html += "<tr><td bgcolor=\"#000000\" width=\"220\">\n"
		html += "<p align=\"center\"><img title=\"\" border=\"0\" src=\"/lcd4linux/data/WEBdreambox.png\" width=\"181\" height=\"10\">\n"
		CCM = "#FFFFFF" if getConfigMode() == False else "#FFCC00"
		html += "<font color=\"%s\"><b>LCD4linux Config</b></font><br />%s\n" % (CCM,Version if L4LElement.getVersion()==True else Version+"?")
		if IP is None:
			html += "<br><span style=\"font-size:7pt;color: #FF0000\">%s!</span>" % _l(_("IP seurity not supported by Box"))
		html += "</p></td><td bgcolor=\"#000000\">\n"
		html += "<p align=\"left\">"
		d = glob.glob("%sdpf.*" % getTMPL())
		if len(d)>0:
			html += "<a href=\"/lcd4linux\"><img style=\"color:#FFCC00\" title=\"LCD 1\" src=\"/lcd4linux/%s?%d\" border=\"1\" height=\"80\" id=\"reloader1\" onload=\"setTimeout('document.getElementById(\\'reloader1\\').src=\\'/lcd4linux/%s?\\'+new Date().getTime()', 5000)\" ></a>" % (os.path.basename(d[0]),time.time(),os.path.basename(d[0]))
		d = glob.glob("%sdpf2.*" % getTMPL())
		if len(d)>0:
			html += "<a href=\"/lcd4linux?file=%s\"><img style=\"color:#FFCC00\" title=\"LCD 2\" src=\"/lcd4linux/%s?%d\" border=\"1\" height=\"80\" id=\"reloader2\" onload=\"setTimeout('document.getElementById(\\'reloader2\\').src=\\'/lcd4linux/%s?\\'+new Date().getTime()', 5000)\" ></a>" % (os.path.basename(d[0]),os.path.basename(d[0]),time.time(),os.path.basename(d[0]))
		d = glob.glob("%sdpf3.*" % getTMPL())
		if len(d)>0:
			html += "<a href=\"/lcd4linux?file=%s\"><img style=\"color:#FFCC00\" title=\"LCD 3\" src=\"/lcd4linux/%s?%d\" border=\"1\" height=\"80\" id=\"reloader3\" onload=\"setTimeout('document.getElementById(\\'reloader3\\').src=\\'/lcd4linux/%s?\\'+new Date().getTime()', 5000)\" ></a>" % (os.path.basename(d[0]),os.path.basename(d[0]),time.time(),os.path.basename(d[0]))
		html += "</p></td>\n"
		if os.path.isfile(CrashFile):
			html += "<td valign=\"top\" align=\"left\"  bgcolor=\"#000000\">\n"
			html += "<form method=\"post\"><font color=\"#FFFF00\">%s</font><br>\n" % _l(_("Crashlog"))
			html += "<input type=\"hidden\" name=\"cmd\" value=\"\">\n"
			html += "<input type=\"button\" value=\"%s\" style=\"font-size:8pt;background-color:yellow;\" onClick=\"fensterchen()\">\n"  % _l(_("Show"))
			html += "<input type=\"button\" value=\"%s\" style=\"font-size:8pt;background-color:yellow;\"   onclick=\"this.form.cmd.value = 'crashdel'; this.form.submit();\">\n"  % _l(_("Delete"))
			html += "</form></td>\n"
		html += "<td valign=\"top\" align=\"right\"  bgcolor=\"#000000\">\n"
		html += "<form method=\"post\" enctype=\"multipart/form-data\">\n"
		html += "<input type=\"file\" name=\"uploadName\" title=\"File Name\" class=\"style1\" >\n"
		html += "<input type=\"image\" name=\"upload\" value=\"klick\" src=\"/lcd4linux/data/WEBupload.png\" height=\"25\" title=\"%s\" class=\"style1\"  >\n" % _l(_("Restore Config"))
		html += "<input type=\"image\" name=\"download\" value=\"klick\" src=\"/lcd4linux/data/WEBdownload.png\" height=\"25\" title=\"%s\" class=\"style1\" >\n" % _l(_("Backup Config"))
		if os.path.isfile("/tmp/L4log.txt"):
			html += "<input type=\"image\" name=\"logdel\" value=\"klick\" src=\"/lcd4linux/data/WEBlogdel.png\" height=\"25\" title=\"%s\" class=\"style1\"  >\n" % _l(_("Delete Logfile"))
			html += "<input type=\"image\" name=\"logdownload\" value=\"klick\" src=\"/lcd4linux/data/WEBlogshow.png\" height=\"25\" title=\"%s\" class=\"style1\" >\n" % _l(_("Download Logfile"))
		html += "<input type=\"image\" name=\"save\" value=\"klick\" src=\"/lcd4linux/data/WEBsave.png\" height=\"40\" title=\"%s\" class=\"style1\" >\n" % _l(_("Save Config"))
		html += "</form>\n"
		html += "<form method=\"post\"><font color=\"#FFFFFF\">%s</font>\n" % _l(_("Screen"))

		html += "<input type=\"hidden\" name=\"cmd\" value=\"\">\n"
		for i in range(1,10):
			html += "<input type=\"button\" value=\"%d\" style=\"width:15px; text-align:center; font-size:8pt%s\" onclick=\"this.form.cmd.value = 'Screen%d'; this.form.submit();\">\n" % (i,AktiveScreen(str(i)),i)

		Aktiv = "checked" if getSaveEventListChanged() else ""
		html += "<input type=\"hidden\" name=\"hold\" value=\"%s\">" % ("unchecked")
		html += "<input type=\"checkbox\" title=\"%s\" name=\"hold\" value=\"%s\" onclick=\"this.form.cmd.value = 'hold'; this.form.submit();\" %s>" % (_l(_("stop Screencycle")),"checked",Aktiv)

		html += "</form>\n"
		html += "</td></tr></table>\n"

		html += "<form method=\"get\">"
		html += "<fieldset style=\"width:auto\" name=\"Mode1\">"
		html += "<legend style=\"color: #FFCC00\">Modus&nbsp;</legend>\n"
		html += "<input id=\"r1\" name=\"Mode\" type=\"radio\" value=\"1\" %s onclick=\"this.form.submit();\"><label %s for=\"r1\">%s&nbsp;&nbsp;</label>\n" % (AktiveMode("1",_l(_("Global"))))
		html += "<input id=\"r2\" name=\"Mode\" type=\"radio\" value=\"2\" %s onclick=\"this.form.submit();\"><label %s for=\"r2\">%s&nbsp;&nbsp;</label>\n" % (AktiveMode("2",_l(_("On"))))
		html += "<input id=\"r3\" name=\"Mode\" type=\"radio\" value=\"3\" %s onclick=\"this.form.submit();\"><label %s for=\"r3\">%s&nbsp;&nbsp;</label>\n" % (AktiveMode("3",_l(_("Media"))))
		html += "<input id=\"r4\" name=\"Mode\" type=\"radio\" value=\"4\" %s onclick=\"this.form.submit();\"><label %s for=\"r4\">%s&nbsp;&nbsp;</label>\n" % (AktiveMode("4",_l(_("Idle"))))
		if str(LCD4linux.Popup.value) != "0":
			html += "<input id=\"r5\" name=\"Mode\" type=\"radio\" value=\"5\" %s onclick=\"this.form.submit();\"><label %s for=\"r5\">%s&nbsp;&nbsp;</label>\n" % (AktiveMode("5","Popup-Text"))
		html += "</fieldset></form>\n"

		if Mode != "5":
			if Mode == "1":
				L = L1
			elif Mode == "2":
				L = L2
			elif Mode == "3":
				L = L3
			elif Mode == "4":
				L = L4
			else:
				Mode == "1"
				L = L1
				Element = "other"
			if str(LCD4linux.WebIfDesign.value) == "2":
				html += "<table border=\"0\"width=\"100%\" cellspacing=\"1\">"
				html += "<tr><td valign=\"top\" width=\"250\">"
			html += "<form method=\"get\">"
			html += "<fieldset style=\"width:auto\" name=\"Mode2\">"
			html += "<legend style=\"color: #FFCC00\">Element&nbsp;</legend>\n"
			i=0
			ElementList = []
			ElementText = ""
			for LL in L:
				Conf = LL[2].strip()
				if Mode == "1":
					Conf = Conf[:13]
				if ((LL[1][:1] != "-" and Mode!="1") or (Mode == "1" and Conf not in ElementList )) and LL[3] != 0:
					if Element == "" or ModeOld != Mode:
						Element = "other"
						ModeOld = Mode
					ElementList.append(Conf)
					i+=1
					Ea,Ec = AktiveElement(Conf)
#					html += Conf
					if Mode != "1":
						exec("Curr = %s.value" % Conf)
						L4log("Curr = %s.value" % Conf,Curr)
						if Curr != "0":
							if Ec == "":
								Ec = "style=\"font-weight:bold;color:#CCFFBB\""
							else:
								Ec = Ec.replace("=\"","=\"font-weight:bold;")
					if Ea == "checked":
						ElementText = (_l(_(LL[1])) if Mode !="1" else _l(M2[LL[3]-1]))
					html += "<input id=\"e%d\" name=\"Element\" type=\"radio\" value=\"%s\" %s onclick=\"this.form.submit();\"><label %s for=\"e%d\">%s&nbsp;&nbsp;</label>\n" % (i,Conf,Ea,Ec,i, (_l(_(LL[1])) if Mode !="1" else _l(M2[LL[3]-1])) )
					if str(LCD4linux.WebIfDesign.value) == "2":
						html += "<br>"
			Ea,Ec = AktiveElement("other")
			if Ea == "checked":
				ElementText = _l(_("other"))
			html += "<input id=\"e%d\" name=\"Element\" type=\"radio\" value=\"%s\" %s onclick=\"this.form.submit();\"><label %s for=\"e%d\">%s&nbsp;&nbsp;</label>\n" % (0,"other",Ea,Ec,0,_l(_("other")))
			html += "</fieldset></form>\n"
			if str(LCD4linux.WebIfDesign.value) == "2":
				html += "<br></td><td valign=\"top\">"

			html += "<form name=\"Eingabe\" method=\"POST\">\n"
			if str(LCD4linux.WebIfDesign.value) == "2":
				html += "<fieldset style=\"width:auto\" name=\"Mode3\"><legend style=\"color: #FFCC00\">%s&nbsp;</legend>" % ElementText
			html += "<table border=\"1\" rules=\"groups\" width=\"100%\">"
			AktCode = 0
			isOn = False
			isMP = False
			isSb = False
			for LL in L:
				Conf = LL[2].strip()

				if (Conf.startswith(Element) and (LL[3] == AktCode or AktCode == 0)) or (Element=="other" and LL[3] == 0):
				
					if Mode in "2":
						if "." in Conf:
							b = Conf.replace(".",".MP")
							if (" "+b) in zip(*L3)[2]:
								isMP = True
							b = Conf.replace(".",".Standby")
							if (" "+b) in zip(*L4)[2]:
								isSb = True
					elif Mode in "3":
						if ".MP" in Conf:
							b = Conf.replace(".MP",".")
							if (" "+b) in zip(*L2)[2]:
								isOn = True
							b = Conf.replace(".MP",".Standby")
							if (" "+b) in zip(*L4)[2]:
								isSb = True
					elif Mode in "4":
						if ".Standby" in Conf:
							b = Conf.replace(".Standby",".")
							if (" "+b) in zip(*L2)[2]:
								isOn = True
							b = Conf.replace(".Standby",".MP")
							if (" "+b) in zip(*L3)[2]:
								isMP = True
		
					if AktCode == 0:
						AktCode = LL[3]
					exec("Curr = %s.value" % Conf)
#ConfigSelection
					exec("Typ = isinstance(%s,ConfigSelection)" % Conf)
					html += "<tr>\n"
					if Typ == True:
						html += "<td width=\"300\">%s</td><td>\n" % _l(_(LL[1]))
						html += "<select name=\"%s\" size=\"1\">\n" % Conf
						exec("Len = len(%s.description)" % Conf)
						for i in range(Len):
							exec("Choice = %s.choices[%d]" % (Conf,i))
							exec("Wert = %s.description[\"%s\"]" % (Conf,Choice))
							if str(Choice) == str(Curr):
								Aktiv = " selected"
							else:
								Aktiv = ""
							html += "<option value=\"%s\" %s>%s</option>\n" % (Choice,Aktiv,_l(Wert))
						html += "</select>\n"
						html += "</td>\n"
					else:
#ConfigYesNo
						exec("Typ = isinstance(%s,ConfigYesNo)" % Conf)
						if Typ == True:
							html += "<td width=\"300\">%s</td><td>\n" % _l(_(LL[1]))
							Aktiv = "checked" if Curr else ""
							html += "<input type=\"hidden\" name=\"%s\" value=\"%s\">" % (Conf,"unchecked")
							html += "<input type=\"checkbox\" name=\"%s\" value=\"%s\" %s>" % (Conf,"checked",Aktiv)
							html += "</td>\n"
						else:
#ConfigText	
							exec("Typ = isinstance(%s,ConfigText)" % Conf)
							if Typ == True:
								html += "<td width=\"300\">%s</td><td>\n" % _l(_(LL[1]))
								exec("Typ = isinstance(%s,ConfigPassword)" % Conf)
								if Typ == True:
									html += "<input type=\"password\" name=\"%s\" size=\"60\" value=\"%s\">" % (Conf,_l(Curr))
								else:
									html += "<input type=\"text\" name=\"%s\" size=\"60\" value=\"%s\">" % (Conf,_l(Curr))
								html += "</td>\n"
							else:
#ConfigSlider
								exec("Typ = isinstance(%s,ConfigSlider)" % Conf)
								if Typ == True:
									exec("Min = %s.min" % Conf)
									exec("Max = %s.max" % Conf)
									html += "<td width=\"300\">%s (%d - %d)</td><td>\n" % (_l(_(LL[1])), Min, Max)
									html += "<input type=\"text\" name=\"%s\" size=\"5\" value=\"%s\">" % (Conf,Curr)
									html += "</td>\n"
								else:
#ConfigClock
									exec("Typ = isinstance(%s,ConfigClock)" % Conf)
									if Typ == True:
										html += "<td width=\"300\">%s</td><td>\n" % _l(_(LL[1]))
										html += "<input type=\"text\" name=\"%s\" size=\"6\" value=\"%02d:%02d\">" % (Conf,Curr[0],Curr[1])
										html += "</td>\n"

			html += "</tr></table>\n"
			html += "<input type=\"hidden\" name=\"cmd\" value=\"config\">\n"
			html += "<input type=\"submit\" style=\"background-color: #FFCC00\" value=\"%s\">\n" % _l(_("set Settings"))
			if Element != "other":
				if Mode in ["3","4"] and isOn:
					html += "<input type=\"button\" align=\"middle\" style=\"text-align:center; font-size:8pt\" value=\"%s\" onclick=\"this.form.cmd.value = 'copyOn'; this.form.submit(); \">\n" % _l(_("copy to On"))
				if Mode in ["2","4"] and isMP:
					html += "<input type=\"button\" align=\"middle\" style=\"text-align:center; font-size:8pt\" value=\"%s\" onclick=\"this.form.cmd.value = 'copyMP'; this.form.submit(); \">\n" % _l(_("copy to Media"))
				if Mode in ["2","3"] and isSb:
					html += "<input type=\"button\" align=\"middle\" style=\"text-align:center; font-size:8pt\" value=\"%s\" onclick=\"this.form.cmd.value = 'copyIdle'; this.form.submit(); \">\n" % _l(_("copy to Idle"))
			html += "</form>\n"
			if str(LCD4linux.WebIfDesign.value) == "2":
				html += "</fieldset></td></tr></table>"
		elif Mode == "5":
			html += "<form method=\"POST\">\n"
			html += "<fieldset style=\"width:auto\" name=\"Mode2\">\n"
			html += "<textarea name=\"PopText\" style=\"height: 120px; width: 416px\">%s</textarea>" % _l(PopText[1])
			html += "<input type=\"hidden\" name=\"cmd\" value=\"pop\">\n"
			html += "<input type=\"submit\" style=\"background-color: #FFCC00\" value=\"%s\">\n" % _l(_("set Settings"))
			html += "</fieldset></form>\n"

		if LCD4linuxConfigweb.RestartGUI == True:
			html += "<span style=\"color: #FF0000;\"><strong>%s</strong></span>" % _l(_("GUI Restart is required"))
		if ExeMode == True:
			html += "<br />\n"
			html += "<form method=\"GET\">\n"
			html += "<input type=\"hidden\" name=\"cmd\" value=\"exec\">\n"
			html += "<input style=\"width: 400px\" type=\"text\" name=\"ex\">\n"
			html += "<input type=\"submit\" value=\"%s\">\n" % _l(_("Exec"))
			html += "</form>\n"
		if StatusMode == True:
			html += "<br />\n"
			html += "Screen: %s<br />\n" % str(getScreenActive(True))
			html += "Hold/HoldKey: %s/%s<br />\n" % (str(getSaveEventListChanged()),str(L4LElement.getHoldKey()))
			html += "Brightness org/set %s/%s<br />\n" %(str(L4LElement.getBrightness()),str(L4LElement.getBrightness(0,False)))
	
		html += "<hr><span style=\"font-size:8pt\">%s (%s)</span>" % (getINFO(),IP)
		html += "<BR><a style=\"font-size:10pt; color:#FFCC00;\" href=\"http://www.i-have-a-dreambox.com/wbb2/thread.php?postid=1634882\">Support & FAQ & Info & Donation</a>"
		if len(L4LElement.get()) > 0:
			html += "<script language=\"JavaScript\">\n"
			html += "function Efensterchen() {\n"
			html += "fens1=window.open(\"\", \"Externals\",\"width=500,height=300,resizable=yes\");\n"
			L4Lkeys = L4LElement.get().keys()
			L4Lkeys.sort()
			for CUR in L4Lkeys:
				html += "fens1.document.write('%s %s<BR>');\n" % (CUR,str(L4LElement.get(CUR)).replace("\n","<br>").replace("'","\\'"))
			html += "} </script>\n"
			html += "<form method=\"post\"><br>\n"
			html += "<input type=\"button\" value=\"%s\" style=\"font-size:8pt;\" onClick=\"Efensterchen()\">\n"  % _l(_("Show Externals"))
			html += "</form></td>\n"
		html += "</body>\n"
		html += "</html>\n"

		return html