Ejemplo n.º 1
0
from Tools.Directories import resolveFilename, fileExists
from boxbranding import getVisionVersion, getVisionRevision, getHaveMultiLib, getMachineBuild, getSoCFamily
from enigma import getBoxType, getBoxBrand, getE2Rev

model = getBoxType()
brand = getBoxBrand()
platform = getMachineBuild()
socfamily = getSoCFamily()

print("[mytest] Open Vision version = %s" % getVisionVersion())
print("[mytest] Open Vision revision = %s" % getVisionRevision())
print("[mytest] Brand/Meta = %s" % brand)
print("[mytest] Model = %s" % model)
print("[mytest] Platform = %s" % platform)
print("[mytest] SoC family = %s" % socfamily)
print("[mytest] Enigma2 revision = %s" % getE2Rev())

import enigma
import eConsoleImpl
import eBaseImpl
enigma.eTimer = eBaseImpl.eTimer
enigma.eSocketNotifier = eBaseImpl.eSocketNotifier
enigma.eConsoleAppContainer = eConsoleImpl.eConsoleAppContainer

from traceback import print_exc

if getHaveMultiLib() == "True":
	import usb.core
	import usb.backend.libusb1
	usb.backend.libusb1.get_backend(find_library=lambda x: "/lib64/libusb-1.0.so.0")
Ejemplo n.º 2
0
from enigma import getE2Rev
from Components.SystemInfo import BoxInfo

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

print("[StartEnigma] Receiver name = %s %s" % (BoxInfo.getItem("displaybrand"), BoxInfo.getItem("displaymodel")))
print("[StartEnigma] %s version = %s" % (BoxInfo.getItem("displaydistro"), BoxInfo.getItem("imgversion")))
print("[StartEnigma] %s revision = %s" % (BoxInfo.getItem("displaydistro"), BoxInfo.getItem("imgrevision")))
print("[StartEnigma] Build Brand = %s" % brand)
print("[StartEnigma] Build Model = %s" % model)
print("[StartEnigma] Platform = %s" % platform)
print("[StartEnigma] SoC family = %s" % socfamily)
print("[StartEnigma] Enigma2 revision = %s" % getE2Rev())

profile("Imports")
from os.path import isdir, isfile, islink, join as pathjoin
from traceback import print_exc
from time import localtime, strftime, time

from Components.config import ConfigInteger, ConfigOnOff, ConfigSubsection, ConfigText, ConfigYesNo, NoSave, config, configfile
from Components.Console import Console
from Components.International import international
# from Screens.Standby import QUIT_ERROR_RESTART
from Tools.Directories import InitDefaultPaths, SCOPE_GUISKIN, SCOPE_PLUGINS, fileReadLine, fileWriteLine, resolveFilename

profile("CreateDefaultPaths")
InitDefaultPaths()
Ejemplo n.º 3
0
def getAllInfo():
    info = {}

    brand = "unknown"
    model = "unknown"
    procmodel = "unknown"
    grabpip = 0
    lcd = 0

    if fileExists("/proc/stb/info/hwmodel"):
        brand = "DAGS"
        f = open("/proc/stb/info/hwmodel", 'r')
        procmodel = f.readline().strip()
        f.close()
        if (procmodel.startswith("optimuss")
                or procmodel.startswith("pingulux")):
            brand = "Edision"
            model = procmodel.replace("optimmuss", "Optimuss ").replace(
                "plus", " Plus").replace(" os", " OS")
        if (procmodel.startswith("tm")):
            brand = "Technomate"
            if procmodel == "tmnanosem2":
                model = procmodel.replace("tmnanosem2", "TM-NANO-SE M2")
        elif (procmodel.startswith("fusion") or procmodel.startswith("purehd")
              or procmodel.startswith("revo4k")
              or procmodel.startswith("galaxy4k")):
            brand = "Xsarius"
            if procmodel == "fusionhd":
                model = procmodel.replace("fusionhd", "Fusion HD")
            elif procmodel == "fusionhdse":
                model = procmodel.replace("fusionhdse", "Fusion HD SE")
            elif procmodel == "purehd":
                model = procmodel.replace("purehd", "Pure HD")
            elif procmodel == "purehdse":
                model = procmodel.replace("purehdse", "Pure HD SE")
            elif procmodel == "revo4k":
                model = procmodel.replace("revo4k", "Revo4K")
            elif procmodel == "galaxy4k":
                model = procmodel.replace("galaxy4k", "Galaxy4K")
        elif (procmodel.startswith("lunix")):
            brand = "Qviart"
            if procmodel == "lunix3-4k":
                model = procmodel.replace("lunix3-4k", "Lunix3-4K")
            elif procmodel == "lunix":
                model = procmodel.replace("lunix", "Lunix")
    elif fileExists("/proc/stb/info/azmodel"):
        brand = "AZBox"
        f = open("/proc/stb/info/model",
                 'r')  # To-Do: Check if "model" is really correct ...
        procmodel = f.readline().strip()
        f.close()
        model = procmodel.lower()
    elif fileExists("/proc/stb/info/gbmodel"):
        brand = "GigaBlue"
        procmodel = getBoxType()
        if procmodel == "GBQUAD PLUS":
            model = procmodel.replace("GBQUAD",
                                      "Quad").replace("PLUS", " Plus")
        elif procmodel == "gbquad4k":
            model = procmodel.replace("gbquad4k", "UHD Quad 4k")
        elif procmodel == "gbue4k":
            model = procmodel.replace("gbue4k", "UHD UE 4k")
        elif procmodel == "gbtrio4k":
            model = "UHD TRIO 4K"
            grabpip = 1
        elif procmodel == "gbip4k":
            model = "UHD IP 4K"
            grabpip = 1
    elif fileExists("/proc/stb/info/vumodel"
                    ) and not fileExists("/proc/stb/info/boxtype"):
        brand = "Vu+"
        f = open("/proc/stb/info/vumodel", 'r')
        procmodel = f.readline().strip()
        f.close()
        model = procmodel.title().replace("olose", "olo SE").replace(
            "olo2se", "olo2 SE").replace("2", "²")
    elif fileExists("/proc/boxtype"):
        f = open("/proc/boxtype", 'r')
        procmodel = f.readline().strip().lower()
        f.close()
        if procmodel in ("adb2850", "adb2849", "bska", "bsla", "bxzb", "bzzb"):
            brand = "Advanced Digital Broadcast"
            if procmodel in ("bska", "bxzb"):
                model = "ADB 5800S"
            elif procmodel in ("bsla", "bzzb"):
                model = "ADB 5800SX"
            elif procmodel == "adb2849":
                model = "ADB 2849ST"
            else:
                model = "ADB 2850ST"
        elif procmodel in ("esi88", "uhd88"):
            brand = "Sagemcom"
            if procmodel == "uhd88":
                model = "UHD 88"
            else:
                model = "ESI 88"
    elif fileExists("/proc/stb/info/boxtype"):
        f = open("/proc/stb/info/boxtype", 'r')
        procmodel = f.readline().strip().lower()
        f.close()
        if procmodel.startswith("et"):
            if procmodel == "et7000mini":
                brand = "Galaxy Innovations"
                model = "ET-7000 Mini"
            elif procmodel == "et11000":
                brand = "Galaxy Innovations"
                model = "ET-11000"
            else:
                brand = "Xtrend"
                model = procmodel.upper()
        elif procmodel.startswith("xpeed"):
            brand = "Golden Interstar"
            model = procmodel
        elif procmodel.startswith("xp"):
            brand = "MaxDigital"
            model = procmodel.upper()
        elif procmodel.startswith("ixuss"):
            brand = "Medialink"
            model = procmodel.replace(" ", "")
        elif procmodel == "formuler4turbo":
            brand = "Formuler"
            model = "4 Turbo"
        elif procmodel.startswith("formuler"):
            brand = "Formuler"
            model = procmodel.replace("formuler", "")
        elif procmodel.startswith("mbtwinplus"):
            brand = "Miraclebox"
            model = "Premium Twin+"
        elif procmodel.startswith("alphatriplehd"):
            brand = "SAB"
            model = "Alpha Triple HD"
        elif procmodel in ("7000s", "mbmicro"):
            procmodel = "mbmicro"
            brand = "Miraclebox"
            model = "Premium Micro"
        elif procmodel in ("7005s", "mbmicrov2"):
            procmodel = "mbmicrov2"
            brand = "Miraclebox"
            model = "Premium Micro v2"
        elif procmodel.startswith("ini"):
            if procmodel.endswith("9000ru"):
                brand = "Sezam"
                model = "Marvel"
            elif procmodel.endswith("5000ru"):
                brand = "Sezam"
                model = "hdx"
            elif procmodel.endswith("1000ru"):
                brand = "Sezam"
                model = "hde"
            elif procmodel.endswith("5000sv"):
                brand = "Miraclebox"
                model = "mbtwin"
            elif procmodel.endswith("1000sv"):
                brand = "Miraclebox"
                model = "Premium Mini"
            elif procmodel.endswith("1000de"):
                brand = "Golden Interstar"
                model = "Xpeed LX"
            elif procmodel.endswith("9000de"):
                brand = "Golden Interstar"
                model = "Xpeed LX3"
            elif procmodel.endswith("1000lx"):
                brand = "Golden Interstar"
                model = "Xpeed LX"
            elif procmodel.endswith("de"):
                brand = "Golden Interstar"
            elif procmodel.endswith("1000am"):
                brand = "Atemio"
                model = "5x00"
            elif procmodel.endswith("8000am"):
                brand = "Atemio"
                model = "Nemesis"
            elif procmodel.endswith("8000am"):
                brand = "Miraclebox"
                model = "Premium Ultra"
            elif procmodel.endswith("3000"):
                brand = "Venton Unibox"
                model = "HD1"
            else:
                brand = "Venton"
                model = "HDx"
        elif procmodel.startswith("unibox-"):
            brand = "Venton"
            model = "HDe"
        elif procmodel.startswith("u5pvr"):
            brand = "Dinobot"
            model = "Dinobot4kSE|Ferguson4k"
        elif procmodel == "hd1100":
            brand = "Mut@nt"
            model = "HD1100"
        elif procmodel == "hd1200":
            brand = "Mut@nt"
            model = "HD1200"
        elif procmodel == "hd1265":
            brand = "Mut@nt"
            model = "HD1265"
        elif procmodel == "hd2400":
            brand = "Mut@nt"
            model = "HD2400"
        elif procmodel == "hd51":
            brand = "Mut@nt"
            model = "HD51"
            grabpip = 1
        elif procmodel == "hd11":
            brand = "Mut@nt"
            model = "HD11"
        elif procmodel == "hd500c":
            brand = "Mut@nt"
            model = "HD500c"
        elif procmodel == "hd530c":
            brand = "Mut@nt"
            model = "HD530c"
        elif procmodel == "hd60":
            brand = "Mut@nt"
            model = "HD60"
        elif procmodel == "arivalink200":
            brand = "Ferguson"
            model = "Ariva @Link 200"
        elif procmodel.startswith("spark"):
            brand = "Fulan"
            if procmodel == "spark7162":
                model = "Spark 7162"
            else:
                model = "Spark"
        elif procmodel == "spycat":
            brand = "Spycat"
            model = "Spycat"
        elif procmodel == "spycatmini":
            brand = "Spycat"
            model = "Spycat Mini"
        elif procmodel == "spycatminiplus":
            brand = "Spycat"
            model = "Spycat Mini+"
        elif procmodel == "spycat4kmini":
            brand = "Spycat"
            model = "spycat 4K Mini"
        elif procmodel == "vipercombo":
            brand = "Amiko"
            model = "ViperCombo"
        elif procmodel == "vipert2c":
            brand = "Amiko"
            model = "ViperT2C"
        elif procmodel == "vipercombohdd":
            brand = "Amiko"
            model = "ViperComboHDD"
        elif procmodel.startswith("wetek"):
            brand = "WeTeK"
            model = procmodel
        elif procmodel.endswith("008"):
            brand = "OCTAGON"
            if procmodel == "sf8008":
                model = "SF8008 4k UHD TWIN"
                grabpip = 1
        elif procmodel.endswith("08m"):
            brand = "OCTAGON"
            if procmodel == "sf8008m":
                model = "SF8008 MINI 4k UHD"
        elif procmodel.startswith("os"):
            brand = "Edision"
            if procmodel == "osmini":
                model = "OS Mini"
            elif procmodel == "osminiplus":
                model = "OS Mini+"
            elif procmodel == "osmega":
                model = "OS Mega"
            elif procmodel == "osnino":
                model = "OS Nino"
            elif procmodel == "osninoplus":
                model = "OS Nino+"
            elif procmodel == "osninopro":
                model = "OS Nino Pro"
            elif procmodel == "osmio4k":
                model = "OS Mio 4K"
                grabpip = 1
            elif procmodel == "osmio4kplus":
                model = "OS mio+ 4K"
                grabpip = 1
            else:
                model = procmodel
        elif procmodel == "h3":
            brand = "Zgemma"
            model = "H3 series"
        elif procmodel == "h4":
            brand = "Zgemma"
            model = "H4 series"
        elif procmodel == "h5":
            brand = "Zgemma"
            model = "H5 series"
        elif procmodel == "h6":
            brand = "Zgemma"
            model = "H6 series"
        elif procmodel == "h7":
            brand = "Zgemma"
            model = "H7 series"
            grabpip = 1
        elif procmodel == "h9":
            brand = "Zgemma"
            model = "H9 series"
        elif procmodel == "lc":
            brand = "Zgemma"
            model = "LC"
        elif procmodel == "sh1":
            brand = "Zgemma"
            model = "Star series"
        elif procmodel == "i55":
            brand = "Zgemma"
            model = "i55"
        elif procmodel == "vs1500":
            brand = "Vimastec"
            model = "vs1500"
            grabpip = 1
        elif procmodel == "e4hd":
            brand = "Axas"
            model = "E4HD"
            lcd = 1
            grabpip = 1
    elif fileExists("/proc/stb/info/model"):
        f = open("/proc/stb/info/model", 'r')
        procmodel = f.readline().strip().lower()
        f.close()
        if procmodel == "tf7700hdpvr":
            brand = "Topfield"
            model = "TF7700 HDPVR"
        elif procmodel == "dsi87":
            brand = "Sagemcom"
            model = "DSI 87"
        elif procmodel.startswith("spark"):
            brand = "Fulan"
            if procmodel == "spark7162":
                model = "Spark 7162"
            else:
                model = "Spark"
        elif (procmodel.startswith("dm") and not procmodel == "dm8000"):
            brand = "Dream Multimedia"
            if procmodel == "dm800":
                model = "DM800 HD PVR"
            elif procmodel == "dm800se":
                model = "DM800 HD se"
            elif procmodel == "dm500hd":
                model = "DM500 HD"
            elif procmodel == "dm7020hd":
                model = "DM7020 HD"
            elif procmodel == "dm820":
                model = "DM820 HD"
            elif procmodel == "dm7080":
                model = "DM7080 HD"
            elif procmodel == "dm520":
                model = "DM520 HD"
            elif procmodel == "dm525":
                model = "DM525 HD"
            elif procmodel == "dm900":
                model = "DM900 HD"
                grabpip = 1
            elif procmodel == "dm920":
                model = "DM920 HD"
                grabpip = 1
            else:
                model = procmodel.replace("dm", "DM", 1)
        elif procmodel == "dm8000":
            brand = "Dream Multimedia"
            model = "DM8000"
        else:
            model = procmodel

    if fileExists("/etc/.box"):
        distro = "HDMU"
        f = open("/etc/.box", 'r')
        tempmodel = f.readline().strip().lower()
        if tempmodel.startswith("ufs") or model.startswith("ufc"):
            brand = "Kathrein"
            model = tempmodel.upcase()
            procmodel = tempmodel
        elif tempmodel.startswith("spark"):
            brand = "Fulan"
            model = tempmodel.title()
            procmodel = tempmodel
        elif tempmodel.startswith("xcombo"):
            brand = "EVO"
            model = "enfinityX combo plus"
            procmodel = "vg2000"

    type = procmodel
    if type in ("et9x00", "et9000", "et9100", "et9200", "et9500"):
        type = "et9x00"
    elif type in ("et6x00", "et6000"):
        type = "et6x00"
    elif type in ("et5x00", "et5000"):
        type = "et5x00"
    elif type in ("et4x00", "et4000"):
        type = "et4x00"
    elif type == "xp1000":
        type = "xp1000"
    elif type in ("bska", "bxzb"):
        type = "nbox_white"
    elif type in ("bsla", "bzzb"):
        type = "nbox"
    elif type == "sagemcom88":
        type = "esi88"
    elif type in ("tf7700hdpvr", "topf"):
        type = "topf"
    elif type in ("ini-9000de"):
        type = "xpeedlx3"
    elif type in ("ini-8000am"):
        type = "atemionemesis"
    elif type in ("ini-8000am"):
        type = "mbultra"
    elif type in ("ini-9000ru"):
        type = "sezammarvel"
    elif type in ("ini-3000"):
        type = "ventonhdx"
    elif type in ("ini-1000sv"):
        type = "mbmini"
    elif type in ("u5pvr"):
        type = "u5pvr"

    info['brand'] = brand
    info['model'] = model
    info['procmodel'] = procmodel
    info['type'] = type

    remote = "dmm1"
    if procmodel in ("solo", "duo", "uno", "solo2", "solose", "zero", "solo4k",
                     "uno4k", "ultimo4k"):
        remote = "vu_normal"
    elif procmodel == "duo2":
        remote = "vu_duo2"
    elif procmodel == "ultimo":
        remote = "vu_ultimo"
    elif procmodel in ("uno4kse", "zero4k"):
        remote = "vu_normal_02"
    elif procmodel == "e3hd":
        remote = "e3hd"
    elif procmodel in ("et9x00", "et9000", "et9100", "et9200", "et9500"):
        remote = "et9x00"
    elif procmodel in ("et5x00", "et5000", "et6x00", "et6000"):
        remote = "et5x00"
    elif procmodel in ("et4x00", "et4000"):
        remote = "et4x00"
    elif procmodel == "et6500":
        remote = "et6500"
    elif procmodel in ("et8x00", "et8000", "et8500", "et8500s", "et10000"):
        remote = "et8000"
    elif procmodel in ("et7x00", "et7000", "et7500"):
        remote = "et7x00"
    elif procmodel in ("et7000mini", "et11000"):
        remote = "et7000mini"
    elif procmodel == "gbquad":
        remote = "gigablue"
    elif procmodel == "gbquadplus":
        remote = "gbquadplus"
    elif procmodel in ("gbquad4k", "gbue4k"):
        remote = "gb7252"
    elif procmodel in ("gbtrio4k", "gbip4k"):
        remote = "gb4"
    elif procmodel in ("formuler1", "formuler3", "formuler4",
                       "formuler4turbo"):
        remote = "formuler1"
    elif procmodel in ("azboxme", "azboxminime", "me", "minime"):
        remote = "me"
    elif procmodel in ("optimussos1", "optimussos1plus", "optimussos2",
                       "optimussos2plus"):
        remote = "optimuss"
    elif procmodel in ("premium", "premium+"):
        remote = "premium"
    elif procmodel in ("elite", "ultra"):
        remote = "elite"
    elif procmodel in ("ini-1000", "ini-1000ru"):
        remote = "ini-1000"
    elif procmodel == "ini-1000sv":
        remote = "mbmini"
    elif procmodel in ("ini-5000sv", "ini-9000de"):
        remote = "xpeedlx3"
    elif procmodel == "ini-9000ru":
        remote = "sezammarvel"
    elif procmodel == "ini-8000am":
        remote = "atemionemesis"
    elif procmodel == "ini-8000am":
        remote = "mbultra"
    elif procmodel == "ini-3000":
        remote = "ventonhdx"
    elif procmodel in ("mbtwinplus", "mbmicro", "mbmicrov2"):
        remote = "miraclebox2"
    elif procmodel == "alphatriplehd":
        remote = "alphatriplehd"
    elif procmodel == "ini-3000":
        remote = "ini-3000"
    elif procmodel in ("ini-7012", "ini-7000", "ini-5000", "ini-5000ru"):
        remote = "ini-7000"
    elif procmodel.startswith("spark"):
        remote = "spark"
    elif procmodel == "xp1000":
        remote = "xp1000"
    elif procmodel.startswith("xpeedlx"):
        remote = "xpeedlx"
    elif procmodel in ("adb2850", "adb2849", "bska", "bsla", "bxzb", "bzzb",
                       "esi88", "uhd88", "dsi87", "arivalink200"):
        remote = "nbox"
    elif procmodel in ("hd1100", "hd1200", "hd1265", "hd1400", "hd51", "hd11",
                       "hd500c", "hd530c"):
        remote = "hd1x00"
    elif procmodel == "hd2400":
        remote = "hd2400"
    elif procmodel == "hd60":
        remote = "hd60"
    elif procmodel in ("spycat", "spycatmini", "spycatminiplus",
                       "spycat4kmini"):
        remote = "spycat"
    elif procmodel.startswith("ixuss"):
        remote = procmodel.replace(" ", "")
    elif procmodel == "vg2000":
        remote = "xcombo"
    elif procmodel == "dm8000":
        remote = "dmm1"
    elif procmodel in ("dm7080", "dm7020hd", "dm7020hdv2", "dm800sev2",
                       "dm500hdv2", "dm520", "dm820", "dm900"):
        remote = "dmm2"
    elif procmodel == "wetekhub":
        remote = procmodel
    elif procmodel == "wetekplay2":
        remote = procmodel
    elif procmodel == "wetekplay":
        remote = procmodel
    elif procmodel.endswith("smini"):
        remote = "osmini"
    elif procmodel.startswith("osmio4k"):
        remote = "edision3"
    elif procmodel.startswith("osninopl"):
        remote = "edision2"
    elif procmodel.startswith("osn"):
        remote = "edision1"
    elif procmodel in ("fusionhd"):
        remote = procmodel
    elif procmodel in ("fusionhdse"):
        remote = procmodel
    elif procmodel in ("purehd", "purehdse"):
        remote = "purehd"
    elif procmodel in ("revo4k"):
        remote = procmodel
    elif procmodel in ("galaxy4k"):
        remote = procmodel
    elif procmodel in ("lunix3-4k", "lunix"):
        remote = "qviart"
    elif procmodel in ("sh1", "lc"):
        remote = "sh1"
    elif procmodel in ("h3", "h4", "h5", "h6", "h7"):
        remote = "h3"
    elif procmodel == "h9":
        remote = "h9"
    elif procmodel == "i55":
        remote = "i55"
    elif procmodel in ("vipercombo", "vipert2c"):
        remote = "amiko"
    elif procmodel in ("vipercombohdd"):
        remote = "amiko1"
    elif procmodel == "alien5":
        remote = "alien5"
    elif procmodel in ("k1pro", "k2pro", "k2prov2", "k1plus"):
        remote = "k1pro"
    elif procmodel == "k3pro":
        remote = "k3pro"
    elif procmodel.startswith("sf8008"):
        remote = "octagon1"
    elif procmodel in ("vs1100", "vs1500"):
        remote = "vs1x00"
    elif procmodel in ("e4hd"):
        remote = "e4hd"
    elif procmodel in ("tmnanosem2", "tmnanosem2plus"):
        remote = "tmnanosem2"
    elif procmodel in ("u5pvr"):
        remote = "u5pvr"

    info['remote'] = remote

    kernel = about.getKernelVersionString()[0]

    distro = "openpli"
    imagever = "unknown"
    imagebuild = ""
    driverdate = "unknown"

    # Assume OE 1.6
    oever = "OE 1.6"
    if fileHas("/etc/issue", "zeus"):
        oever = "OE Zeus 3.0"

    if fileExists("/etc/.box"):
        distro = "HDMU"
        oever = "private"
    elif fileExists("/etc/bhversion"):
        distro = "Black Hole"
        f = open("/etc/bhversion", 'r')
        imagever = f.readline().strip()
        f.close()
        if kernel > 2:
            oever = "OpenVuplus 2.1"
    elif fileExists("/etc/vtiversion.info"):
        distro = "VTi-Team Image"
        f = open("/etc/vtiversion.info", 'r')
        imagever = f.readline().strip().replace("VTi-Team Image ", "").replace(
            "Release ", "").replace("v.", "")
        f.close()
        oever = "OE 1.6"
        imagelist = imagever.split('.')
        imagebuild = imagelist.pop()
        imagever = ".".join(imagelist)
        if kernel > 2:
            oever = "OpenVuplus 2.1"
        if ((imagever == "5.1") or (imagever[0] > 5)):
            oever = "OpenVuplus 2.1"
    elif fileExists("/var/grun/grcstype"):
        distro = "Graterlia OS"
        try:
            imagever = about.getImageVersionString()
        except:  # nosec  # noqa: E722
            pass
    # ToDo: If your distro gets detected as OpenPLi, feel free to add a detection for your distro here ...
    else:
        # OE 2.2 uses apt, not opkg
        if not fileExists("/etc/opkg/all-feed.conf"):
            oever = "OE 2.2"
        else:
            try:
                f = open("/etc/opkg/all-feed.conf", 'r')
                oeline = f.readline().strip().lower()
                f.close()
                distro = oeline.split()[1].replace("-all", "")
            except:  # nosec  # noqa: E722
                pass

        if distro == "openpli":
            oever = "PLi-OE"
            try:
                imagelist = open(
                    "/etc/issue").readlines()[-2].split()[1].split('.')
                imagever = imagelist.pop(0)
            except:  # nosec  # noqa: E722
                # just in case
                pass
        elif distro == "openrsi":
            oever = "PLi-OE"
        else:
            try:
                imagever = "" + getE2Rev().split("+")[1]
            except:  # nosec  # noqa: E722
                pass

        if (distro == "unknown" and brand == "Vu+"
                and fileExists("/etc/version")):
            # Since OE-A uses boxbranding and bh or vti can be detected, there isn't much else left for Vu+ boxes
            distro = "Vu+ original"
            f = open("/etc/version", 'r')
            imagever = f.readline().strip()
            f.close()
            if kernel > 2:
                oever = "OpenVuplus 2.1"

    # reporting the installed dvb-module version is as close as we get without too much hassle
    driverdate = 'unknown'
    try:
        driverdate = os.popen('/usr/bin/opkg -V0 list_installed *dvb-modules*'
                              ).readline().split()[2]  # nosec
    except:  # noqa: E722
        try:
            driverdate = os.popen(
                '/usr/bin/opkg -V0 list_installed *dvb-proxy*').readline(
                ).split()[2]  # nosec
        except:  # noqa: E722
            try:
                driverdate = os.popen(
                    '/usr/bin/opkg -V0 list_installed *kernel-core-default-gos*'
                ).readline().split()[2]  # nosec
            except:  # nosec # noqa: E722
                pass

    info['oever'] = oever
    info['distro'] = distro
    info['imagever'] = imagever
    info['imagebuild'] = imagebuild
    info['driverdate'] = driverdate
    info['lcd'] = distro in ("openpli", ) and lcd or 0
    info['grabpip'] = distro in ("openpli", ) and grabpip or 0
    return info
Ejemplo n.º 4
0
platform = getMachineBuild()
socfamily = getSoCFamily()

REDCOLOR = '\033[31m'
NOCOLOR = '\033[m'
GREENCOLOR = '\033[32m'
BLUECOLOR = '\033[34m'
YELLOWCOLOR = '\033[33m'

print(REDCOLOR + "[StartEnigma] Open Vision version = %s" % getVisionVersion() + NOCOLOR)
print(BLUECOLOR + "[StartEnigma] Open Vision revision = %s" % getVisionRevision() + NOCOLOR)
print(GREENCOLOR + "[StartEnigma] Brand/Meta = %s" % brand + NOCOLOR)
print(GREENCOLOR + "[StartEnigma] Model = %s" % model + NOCOLOR)
print(GREENCOLOR + "[StartEnigma] Platform = %s" % platform + NOCOLOR)
print(GREENCOLOR + "[StartEnigma] SoC family = %s" % socfamily + NOCOLOR)
print(YELLOWCOLOR + "[StartEnigma] Enigma2 revision = %s" % getE2Rev() + NOCOLOR)

import enigma
import eConsoleImpl
import eBaseImpl
enigma.eTimer = eBaseImpl.eTimer
enigma.eSocketNotifier = eBaseImpl.eSocketNotifier
enigma.eConsoleAppContainer = eConsoleImpl.eConsoleAppContainer

if fileExists("/etc/init.d/inetd.busybox"):
	from Components.Console import Console
	print("[StartEnigma] Try start busybox to help FTP access.")
	Console = Console()
	Console.ePopen('/etc/init.d/inetd.busybox start')
	print("[StartEnigma] Finished starting busybox inetd.")
Ejemplo n.º 5
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'] = BoxInfo.getItem("brand")
    info['displaybrand'] = BoxInfo.getItem("displaybrand")
    info['model'] = BoxInfo.getItem("model")
    info['displaymodel'] = BoxInfo.getItem("displaymodel")
    info['platform'] = BoxInfo.getItem("platform")

    try:
        info['procmodel'] = getBoxProc()
    except:  # nosec # noqa: E722
        info['procmodel'] = None

    try:
        info['procmodeltype'] = getBoxProcType()
    except:  # nosec # noqa: E722
        info['procmodeltype'] = None

    try:
        info['lcd'] = getLcd()
    except:  # nosec # noqa: E722
        info['lcd'] = 0

    try:
        info['grabpip'] = getGrabPip()
    except:  # nosec # noqa: E722
        info['grabpip'] = 0

    cpu = about.getCPUInfoString()
    info['chipset'] = cpu
    info['cpubrand'] = about.getCPUBrand()
    info['socfamily'] = BoxInfo.getItem("socfamily")
    info['cpuarch'] = about.getCPUArch()
    if config.OpenWebif.about_benchmark.value is True:
        info['cpubenchmark'] = about.getCPUBenchmark()
    else:
        info['cpubenchmark'] = _("Disabled in configuration")
    info['flashtype'] = about.getFlashType()

    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'])
    if config.OpenWebif.about_benchmarkram.value is True:
        info['rambenchmark'] = about.getRAMBenchmark()
    else:
        info['rambenchmark'] = _("Disabled in configuration")

    info['uptime'] = about.getBoxUptime()

    info["webifver"] = OPENWEBIFVER
    info['imagedistro'] = BoxInfo.getItem("distro")
    info['oever'] = BoxInfo.getItem("oe")
    info['gccver'] = about.getGccVersion()
    info['glibcver'] = about.getGlibcVersion()
    info['openssl'] = BoxInfo.getItem("OpenSSLVersion")
    info['visionversion'] = BoxInfo.getItem("imgversion")
    info['visionrevision'] = BoxInfo.getItem("imgrevision")
    info['visionmodule'] = about.getVisionModule()

    info['multiboot'] = _("Yes") if BoxInfo.getItem("multiboot",
                                                    False) else _("No")

    info['enigmaver'] = getEnigmaVersionString()
    info['enigmarev'] = getE2Rev()
    info['driverdate'] = about.getDriverInstalledDate()
    info['kernelver'] = BoxInfo.getItem("kernel")
    info['modulelayout'] = BoxInfo.getItem("ModuleLayout")
    info['dvbapitype'] = about.getDVBAPI()
    info['gstreamerversion'] = about.getGStreamerVersionString()
    info['ffmpegversion'] = about.getFFmpegVersionString()
    info['pythonversion'] = about.getPythonVersionString()

    try:
        info['hwserial'] = getHWSerial()
    except:  # nosec # noqa: E722
        info['hwserial'] = None

    if (info['hwserial'] is None or info['hwserial'] == "unknown"):
        info['hwserial'] = about.getCPUSerial()

    try:
        info['boxrctype'] = getBoxRCType()
    except:  # nosec # noqa: E722
        info['boxrctype'] = None

    if (info['boxrctype'] is None or info['boxrctype'] == "unknown"):
        if fileExists("/usr/bin/remotecfg"):
            info['boxrctype'] = _("Amlogic remote")
        elif fileExists("/usr/sbin/lircd"):
            info['boxrctype'] = _("LIRC remote")

    info['ovrctype'] = BoxInfo.getItem("rctype")
    info['ovrcname'] = BoxInfo.getItem("rcname")
    info['ovrcidnum'] = BoxInfo.getItem("rcidnum")

    info['transcoding'] = BoxInfo.getItem("transcoding")
    info['multitranscoding'] = BoxInfo.getItem("multitranscoding")

    info['displaytype'] = BoxInfo.getItem("displaytype")

    info['updatedatestring'] = BoxInfo.getItem("compiledate")
    info['enigmadebuglvl'] = eGetEnigmaDebugLvl()

    info['imagearch'] = BoxInfo.getItem("architecture")
    info['imagefolder'] = BoxInfo.getItem("imagedir")
    info['imagefilesystem'] = BoxInfo.getItem("imagefs")
    info['feedsurl'] = BoxInfo.getItem("feedsurl")
    info['developername'] = BoxInfo.getItem("developername")
    info['builddatestring'] = about.getBuildDateString()
    info['imagefpu'] = BoxInfo.getItem("fpu")
    info['havemultilib'] = BoxInfo.getItem("multilib")

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

    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['EX'] = ''

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

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

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

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

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

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

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

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

    info['textinputsupport'] = TEXTINPUTSUPPORT
    STATICBOXINFO = info
    return info