Exemplo n.º 1
0
    def getMac(self):
        mac = None

        while True:  #Wait until iNetwork is not loaded
            ifaces = iNetwork.getAdapterList()
            for iface in ifaces:
                if iNetwork.getAdapterName(iface) == "eth0":
                    mac = str(iNetwork.getAdapterAttribute(iface, "mac"))
                    break

            if mac is not None:
                break
            else:
                time.sleep(1)

        mac = mac.replace(":", "").lower()
        return mac
Exemplo n.º 2
0
	def populate(self):
		self["lab1"] = StaticText(_("Miraclebox"))
		self["lab2"] = StaticText(_("By Miraclebox Image Team"))
		model = None
		self["lab3"] = StaticText(_("Support at") + " www.miraclebox.se")
		
		if isVTISkin:
			self["EnigmaVersion"] = StaticText(_("Version") + ": " + about.getEnigmaVersionString())
			self["ImageVersion"] = StaticText(_("Image") + ": " + about.getImageVersionString())

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

			fp_version = getFPVersion()
			if fp_version is None:
				fp_version = ""
			else:
				fp_version = _("Frontprocessor version: %d") % fp_version

			self["FPVersion"] = StaticText(fp_version)

			nims = nimmanager.nimList()
			self.tuner_list = []
			if len(nims) <= 4 :
				for count in (0, 1, 2, 3, 4, 5, 6, 7):
					if count < len(nims):
						self["Tuner" + str(count)] = StaticText(nims[count])
						self.tuner_list.append((nims[count] + "\n"))
					else:
						self["Tuner" + str(count)] = StaticText("")
			else:
				desc_list = []
				count = 0
				cur_idx = -1
				while count < len(nims):
					data = nims[count].split(":")
					idx = data[0].strip('Tuner').strip()
					desc = data[1].strip()
					if desc_list and desc_list[cur_idx]['desc'] == desc:
						desc_list[cur_idx]['end'] = idx
					else:
						desc_list.append({'desc' : desc, 'start' : idx, 'end' : idx})
						cur_idx += 1
					count += 1

				for count in (0, 1, 2, 3, 4, 5, 6, 7):
					if count < len(desc_list):
						if desc_list[count]['start'] == desc_list[count]['end']:
							text = "Tuner %s: %s" % (desc_list[count]['start'], desc_list[count]['desc'])
						else:
							text = "Tuner %s-%s: %s" % (desc_list[count]['start'], desc_list[count]['end'], desc_list[count]['desc'])
					else:
						text = ""

					self["Tuner" + str(count)] = StaticText(text)
					if text != "":
						self.tuner_list.append(text + "\n")

			self["HDDHeader"] = StaticText(_("Detected HDD:"))
			hddlist = harddiskmanager.HDDList()
			hdd = hddlist and hddlist[0][1] or None
			if hdd is not None and hdd.model() != "":
				self["hddA"] = StaticText(_("%s\n(%s, %d MB free)") % (hdd.model(), hdd.capacity(),hdd.free()))
			else:
				self["hddA"] = StaticText(_("none"))


			self.enigma2_version = _("Version") + ": " + about.getEnigmaVersionString()
			self.image_version = _("Image") + ": " + about.getImageVersionString()
			cpu_info = parseLines("/proc/cpuinfo")
			cpu_name = "N/A"
			for line in cpu_info:
				if line.find('model') != -1:
					cpu_name = line.split(':')
					if len(cpu_name) >= 2:
						cpu_name = cpu_name[1].strip()
					break

			self.cpu = _("CPU") + ": " + cpu_name
			self.chipset = _("Chipset") + ": " + parseFile("/proc/stb/info/chipset")
			self.tuner_header = _("Detected NIMs:")
			self.hdd_header = _("Detected HDD:")
			self.hdd_list = []
			if len(hddlist):
				for hddX in hddlist:
					hdd = hddX[1]
					if hdd.model() != "":
						self.hdd_list.append((hdd.model() + "\n   %.2f GB - %.2f GB" % (hdd.diskSize()/1000.0, hdd.free()/1000.0) + " " + _("free") + "\n\n"))

			ifaces = iNetwork.getConfiguredAdapters()
			iface_list = []
			for iface in ifaces:
				iface_list.append((_("Interface") + " : " + iNetwork.getAdapterName(iface) + " ("+ iNetwork.getFriendlyAdapterName(iface) + ")\n"))
				iface_list.append((_("IP") + " : " + parse_ipv4(iNetwork.getAdapterAttribute(iface, "ip")) + "\n"))
				iface_list.append((_("Netmask") + " : " + parse_ipv4(iNetwork.getAdapterAttribute(iface, "netmask")) + "\n"))
				iface_list.append((_("Gateway") + " : " + parse_ipv4(iNetwork.getAdapterAttribute(iface, "gateway")) + "\n"))
				if iNetwork.getAdapterAttribute(iface, "dhcp"):
					iface_list.append((_("DHCP") + " : " + _("Yes") + "\n"))
				else:
					iface_list.append((_("DHCP") + " : " + _("No") + "\n"))
				iface_list.append((_("MAC") + " : " + iNetwork.getAdapterAttribute(iface, "mac") + "\n"))
				iface_list.append(("\n"))

			my_txt = self.enigma2_version + "\n"
			my_txt += self.image_version + "\n"
			my_txt += "\n"
			my_txt += self.cpu + "\n"
			my_txt += self.chipset + "\n"
			my_txt += "\n"
			my_txt += self.tuner_header + "\n"
			for x in self.tuner_list:
				my_txt += "   " + x
			my_txt += "\n"
			my_txt += _("Network") + ":\n"
			for x in iface_list:
				my_txt += "   " + x
			my_txt += self.hdd_header + "\n"
			for x in self.hdd_list:
				my_txt += "   " + x
			my_txt += "\n"

			self["FullAbout"] = ScrollLabel(my_txt)
		else:
			self["lab1"] = StaticText(_("openATV"))
			self["lab2"] = StaticText(_("By openATV Image Team"))
			self["lab3"] = StaticText(_("Support at") + " www.opena.tv")
			model = None
			AboutText = getAboutText()[0]
			self["AboutScrollLabel"] = ScrollLabel(AboutText)
Exemplo n.º 3
0
def getInfo():
	# TODO: get webif versione somewhere!
	info = {}

	brand = "Dream Multimedia"
	model = "unknown"
	chipset = "unknown"
	
	if fileExists("/proc/stb/info/vumodel"):
		brand = "Vuplus"
		f = open("/proc/stb/info/vumodel",'r')
 		model = f.readline().strip()
 		f.close()
	elif fileExists("/proc/stb/info/boxtype"):
		brand = "Clarke-Xtrend"
		f = open("/proc/stb/info/boxtype",'r')
 		model = f.readline().strip()
 		f.close()
	else:
		f = open("/proc/stb/info/model",'r')
 		model = f.readline().strip()
 		f.close()

	info['brand'] = brand
	info['model'] = model

	if fileExists("/proc/stb/info/chipset"):
		f = open("/proc/stb/info/chipset",'r')
 		chipset = f.readline().strip()
 		f.close()
		
	info['chipset'] = chipset
	
	f = open("/proc/meminfo",'r')
 	parts = f.readline().split(':')
	info['mem1'] = parts[1].strip()
	parts = f.readline().split(':')
	info['mem2'] = parts[1].strip()
	f.close()
		
	f = os.popen("uptime")
	parts = f.readline().split(',')
	info['uptime'] = parts[0].strip()
	f.close()
		
	if fileExists("/etc/bhversion"):
		f = open("/etc/bhversion",'r')
		imagever = f.readline().strip()
		f.close()
	else:
		imagever = about.getImageVersionString()
		
	info["webifver"] = "0.0.0"
	info['imagever'] = imagever
	info['enigmaver'] = about.getEnigmaVersionString()
	info['kernelver'] = about.getKernelVersionString()
	
	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"))
		})
			
	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
Exemplo n.º 4
0
def getInfo():
	# TODO: get webif versione somewhere!
	info = {}

	brand = "Dream Multimedia"
	model = "unknown"
	chipset = "unknown"
	
	if fileExists("/proc/stb/info/hwmodel"):
		f = open("/proc/stb/info/hwmodel",'r')
		model = f.readline().strip()
		f.close()
		if model == "mediabox":
			model = "Mediabox HD LX-1"
			brand = "Jepssen"
		elif model == "optimussos1":
			model = "Optimuss OS1"
			brand = "Edision"
		elif model == "optimussos2":
			model = "Optimuss OS2"
			brand = "Edision"
		elif model in ("optimussos1plus", "optimussos2plus", "optimussos3plus" ):
			brand = "Edision"
		elif model == "force1plus":
			model = "tmnano3tcombo"
			brand = "Technomate"
		elif model in ("tmnanooe", "tmnano2t", "tmsingle", "tmtwinoe", "tm2toe", "tmnano2super", "tmnano3tcombo", "tmnanose", "tmnanosecombo", "tmnanosem2", "tmnanoseplus" ):
			brand = "Technomate"
		elif model in ("force2", "force2solid", "force2plus", "force2se" ):
			brand = "Iqon"
		elif model == "fusionhd":
			brand = "Xsarius"
		else:
			brand = "4D"
	elif fileExists("/proc/stb/info/azmodel"):
		brand = "AZBOX"
		f = open("/proc/stb/info/model",'r')
 		model = f.readline().strip()
 		f.close()
 		if model == "me":
			chipset = "SIGMA 8655"
 		elif model == "minime":
			chipset = "SIGMA 8653"
 		else:
			chipset = "SIGMA 8634"
	else:
		f = open("/proc/stb/info/model",'r')
 		model = f.readline().strip()
 		f.close()

	info['brand'] = brand
	info['model'] = model

	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
		
	if fileExists("/etc/bhversion"):
		f = open("/etc/bhversion",'r')
		imagever = f.readline().strip()
		f.close()
	elif fileExists("/etc/vtiversion.info"):
		f = open("/etc/vtiversion.info",'r')
		imagever = f.readline().strip()
		f.close()
	else:
		imagever = about.getImageVersionString()
		
	info["webifver"] = getOpenWebifVer()
	info['imagever'] = imagever
	info['enigmaver'] = about.getEnigmaVersionString()
	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"))
		})
			
	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
Exemplo n.º 5
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
Exemplo n.º 6
0
def getInfo():
    # TODO: get webif versione somewhere!
    info = {}

    brand = "Dream Multimedia"
    model = "unknown"
    chipset = "unknown"

    if fileExists("/proc/stb/info/boxtype"):
        brand = "Clarke-Xtrend"
        f = open("/proc/stb/info/boxtype", 'r')
        model = f.readline().strip()
        if model == "ini-3000" or model == "ini-5000" or model == "ini-7000":
            brand = "INI-Series"
        f.close()
    elif fileExists("/proc/stb/info/vumodel"):
        brand = "Vuplus"
        f = open("/proc/stb/info/vumodel", 'r')
        model = f.readline().strip()
        f.close()
    elif fileExists("/proc/stb/info/azmodel"):
        brand = "AZBOX"
        f = open("/proc/stb/info/model", 'r')
        model = f.readline().strip()
        f.close()
        if model == "me":
            chipset = "SIGMA 8655"
        elif model == "minime":
            chipset = "SIGMA 8653"
        else:
            chipset = "SIGMA 8634"
    else:
        f = open("/proc/stb/info/model", 'r')
        model = f.readline().strip()
        if model == "spark" or model == "spark7162":
            brand = "AMIKO"
        f.close()

    info['brand'] = brand
    info['model'] = model

    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

    if fileExists("/etc/bhversion"):
        f = open("/etc/bhversion", 'r')
        imagever = f.readline().strip()
        f.close()
    elif fileExists("/etc/vtiversion.info"):
        f = open("/etc/vtiversion.info", 'r')
        imagever = f.readline().strip()
        f.close()
    else:
        imagever = about.getImageVersionString()

    info["webifver"] = getOpenWebifVer()
    info['imagever'] = imagever
    info['enigmaver'] = about.getEnigmaVersionString()
    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"))
        })

    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
Exemplo n.º 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("/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
Exemplo n.º 8
0
def getInfo():
    # TODO: get webif versione somewhere!
    info = {}

    brand = "Dream Multimedia"
    model = "unknown"
    chipset = "unknown"

    if fileExists("/proc/stb/info/hwmodel"):
        file = open("/proc/stb/info/hwmodel")
        model = file.read().strip().lower()
        file.close()
        if model == "tmtwinoe":
            model = "TM-TWIN-OE"
            brand = "Technomate"
        elif model == "tm2toe":
            model = "TM-2T-OE"
            brand = "Technomate"
        elif model == "tmsingle":
            model = "TM-SINGLE"
            brand = "Technomate"
        elif model == "tmnanooe":
            model = "TM-NANO-OE"
            brand = "Technomate"
        elif model == "ios100hd":
            model = "IOS-100HD"
            brand = "Iqon"
        elif model == "ios200hd":
            model = "IOS-200HD"
            brand = "Iqon"
        elif model == "ios300hd":
            model = "IOS-300HD"
            brand = "Iqon"
        elif model == "optimussos1":
            model = "Optimuss-OS1"
            brand = "Edision"
        elif model == "optimussos2":
            model = "Optimuss-OS2"
            brand = "Edision"
        elif model == "sogno-8800hd":
            brand = "Sogno"
            model = "Sogno 8800HD"
    elif fileExists("/proc/stb/info/boxtype"):
        file = open("/proc/stb/info/boxtype")
        model = file.read().strip().lower()
        file.close()
        if model == "gigablue":
            brand = "GigaBlue"
            if fileExists("/proc/stb/info/gbmodel"):
                file = open("/proc/stb/info/gbmodel")
                model = file.read().strip().lower()
                file.close()
        elif model.startswith("et"):
            brand = "Clarke-Xtrend"
            if model == "et9500":
                model = "et9x00"
        elif model.startswith("ini"):
            if model.endswith("sv"):
                brand = "MiracleBox"
                if model == "ini-5000sv":
                    model = "Premium Twin"
                elif model == "ini-1000sv":
                    model = "Premium Mini"
                else:
                    model
            elif model.endswith("de"):
                brand = "Golden Interstar"
                if model == "ini-1000de":
                    model = "Xpeed LX"
                elif model == "ini-9000de":
                    model = "Xpeed LX3"
                else:
                    model
            elif model.endswith("ru"):
                brand = "Sezam"
                if model == "ini-1000ru":
                    model = "Sezam 1000-HD"
                elif model == "ini-5000ru":
                    model = "Sezam 5000-HD"
                elif model == "ini-9000ru":
                    model = "Sezam Marvel"
                else:
                    model
            else:
                brand = "Venton"
        elif model == "enfinity":
            brand = "EVO"
            model = "ENfinity"
        elif model == "xp1000":
            brand = "XP-Series"
        elif model == "xp1000s":
            brand = "Octagon"
            model = "SF8 HD"
        elif model == "odinm9":
            brand = "Odin-Series"
        elif model == "odinm7":
            if getImageDistro() == 'axassupport':
                brand = "AXAS"
                model = "Class M"
            elif getBoxType() == 'odinm6':
                brand = "TELESTAR"
                model = "STARSAT LX"
            elif getMachineName() == 'AX-Odin':
                brand = "Opticum"
                model = "AX-Odin"
            else:
                brand = "Odin-Series"
        elif model == "e3hd":
            if getImageDistro() == 'axassupport':
                brand = "AXAS"
                model = "Class E"
            else:
                brand = "E3-Series"
        elif model == "ebox5000":
            brand = "MixOs-Series"
            model = "MixOs F5"
        elif model == "ebox5100":
            brand = "MixOs-Series"
            model = "MixOs F5mini"
        elif model == "ebox7358":
            brand = "MixOs-Series"
            model = "MixOs F7"
        elif model.startswith("ixuss"):
            brand = "Ixuss-Series"
            chipset = "BCM7405"
    elif 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"
    elif fileExists("/proc/stb/info/vumodel"):
        brand = "Vu Plus"
        file = open("/proc/stb/info/vumodel")
        model = file.read().strip().lower()
        file.close()
    else:
        file = open("/proc/stb/info/model")
        model = file.read().strip().lower()
        if model.startswith('spar'):
            brand = "Spark"
        file.close()

    info['brand'] = brand
    info['model'] = model

    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['imagever'] = getImageVersion() + '.' + getImageBuild()
    info['enigmaver'] = getEnigmaVersionString()
    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"))
        })

    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
Exemplo n.º 9
0
def getInfo():
    # TODO: get webif versione somewhere!
    info = {}

    brand = "Dream Multimedia"
    model = "unknown"
    chipset = "unknown"

    if fileExists("/etc/.box"):
        brand = "HDMU"
        f = open("/etc/.box", 'r')
        model = f.readline().strip().lower()
        if model.startswith("et"):
            brand = "Xtrend"
        elif model.startswith("vu"):
            brand = "VuPlus"
        elif model.startswith("gb"):
            brand = "GigaBlue"
        elif model.startswith("ufs") or model.startswith("ufc"):
            brand = "Kathrein"
            if model in ("ufs910", "ufs922", "ufc960"):
                chipset = "SH4 @266MHz"
            else:
                chipset = "SH4 @450MHz"
        elif model.startswith("xpeed"):
            brand = "GoldenInterstar"
        elif model.startswith("topf"):
            brand = "Topfield"
            chipset = "SH4 @266MHz"
        elif model.startswith("azbox"):
            brand = "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"):
            brand = "Fulan"
            chipset = "SH4 @450MHz"
    elif fileExists("/proc/stb/info/boxtype"):
        brand = "Xtrend"
        f = open("/proc/stb/info/boxtype", 'r')
        model = f.readline().strip().lower()
        if model.startswith("et"):
            brand = "Xtrend"
        elif model.startswith("ini"):
            if model.endswith("sv"):
                brand = "MiracleBox"
            elif model.endswith("ru"):
                brand = "Sezam"
            else:
                brand = "Venton"
        elif model.startswith("xp"):
            brand = "MaxDigital"
        elif model.startswith("ixuss"):
            brand = "Medialink"
            model = model.replace(" ", "")
        f.close()
    elif fileExists("/proc/stb/info/vumodel"):
        brand = "VuPlus"
        f = open("/proc/stb/info/vumodel", 'r')
        model = f.readline().strip().lower()
        f.close()
    elif fileExists("/proc/stb/info/azmodel"):
        brand = "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"
    else:
        f = open("/proc/stb/info/model", 'r')
        model = f.readline().strip().lower()
        f.close()
        if model == "tf7700hdpvr":
            brand = "Topfield"
            model = "TF 7700 HDPVR"
            chipset = "SH4 @266MHz"
        elif model == "nbox":
            brand = "Advanced Digital Broadcast"
            chipset = "SH4 @266MHz"
        elif model in ("adb2850", "adb2849"):
            brand = "Advanced Digital Broadcast"
            chipset = "SH4 @450MHz"
        elif model in ("esi88", "uhd88", "dsi87"):
            brand = "SagemCom"
            chipset = "SH4 @450MHz"

    info['brand'] = brand
    info['model'] = model

    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

    if fileExists("/etc/bhversion"):
        f = open("/etc/bhversion", 'r')
        imagever = f.readline().strip()
        f.close()
    elif fileExists("/etc/vtiversion.info"):
        f = open("/etc/vtiversion.info", 'r')
        imagever = f.readline().strip()
        f.close()
    else:
        imagever = about.getImageVersionString()

    info["webifver"] = getOpenWebifVer()
    info['imagever'] = imagever
    info['enigmaver'] = about.getEnigmaVersionString()
    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
Exemplo n.º 10
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
Exemplo n.º 11
0
def getInfo():
	# TODO: get webif versione somewhere!
	info = {}

	brand = "Dream Multimedia"
	model = "unknown"
	chipset = "unknown"

	if fileExists("/etc/.box"):
		brand = "HDMU"
		f = open("/etc/.box",'r')
		model = f.readline().strip().lower()
		if model.startswith("et"):
			brand = "Xtrend"
		elif model.startswith("vu"):
			brand = "VuPlus"
		elif model.startswith("gb"):
			brand = "GigaBlue"
		elif model.startswith("ufs") or model.startswith("ufc"):
			brand = "Kathrein"
			if model in ("ufs910", "ufs922", "ufc960"):
				chipset = "SH4 @266MHz"
			else:
				chipset = "SH4 @450MHz"
		elif model.startswith("xpeed"):
			brand = "GoldenInterstar"
		elif model.startswith("topf"):
			brand = "Topfield"
			chipset = "SH4 @266MHz"
		elif model.startswith("azbox"):
			brand = "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"):
			brand = "Fulan"
			chipset = "SH4 @450MHz"
	elif fileExists("/proc/stb/info/boxtype"):
		brand = "Xtrend"
		f = open("/proc/stb/info/boxtype",'r')
		model = f.readline().strip().lower()
		if model.startswith("et"):
			brand = "Xtrend"
		elif model.startswith("ini"):
			if model.endswith("9000ru"):
 				brand = "Sezam"
				model = "Marvel"
			elif model.endswith("5000ru"):
				brand = "Sezam"
				model = "hdx"
			elif model.endswith("1000ru"):
				brand = "Sezam"
				model = "hde"
			elif model.endswith("5000sv"):
				brand = "Miraclebox"
				model = "mbtwin"
			elif model.endswith("1000sv"):
				brand = "Miraclebox"
				model = "mbmini"
			elif model.endswith("1000de"):
				brand = "Golden Interstar"
				model = "xpeedlx"
			elif model.endswith("1000lx"):
				brand = "Golden Interstar"
				model = "xpeedlx"
			elif model.endswith("9000de"):
				brand = "Golden Interstar"
				model = "xpeedlx3"
			elif model.endswith("1000am"):
				brand = "Atemio"
				model = "5x00"
			elif model.endswith("de"):
				brand = "Golden Interstar"
			else:
				brand = "Venton"
				model = "Venton-hdx"
		elif model.startswith("xp"):
			brand = "MaxDigital"
		elif model.startswith("ixuss"):
			brand = "Medialink"
			model = model.replace(" ", "")
		elif model.startswith("formuler"):
			brand = "Formuler"
 		f.close()
	elif fileExists("/proc/stb/info/vumodel"):
		brand = "VuPlus"
		f = open("/proc/stb/info/vumodel",'r')
		model = f.readline().strip().lower()
		f.close()
	elif fileExists("/proc/stb/info/azmodel"):
		brand = "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"
	else:
		f = open("/proc/stb/info/model",'r')
		model = f.readline().strip().lower()
		f.close()
		if model == "tf7700hdpvr":
			brand = "Topfield"
			chipset = "SH4 @266MHz"
		elif model == "nbox":
			brand = "Advanced Digital Broadcast"
			chipset = "SH4 @266MHz"
		elif model in ("adb2850", "adb2849"):
			brand = "Advanced Digital Broadcast"
			chipset = "SH4 @450MHz"
		elif model in ("esi88", "uhd88", "dsi87"):
			brand = "SagemCom"
			chipset = "SH4 @450MHz"

	info['brand'] = brand
	info['model'] = model

	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

	if fileExists("/etc/bhversion"):
		f = open("/etc/bhversion",'r')
		imagever = f.readline().strip()
		f.close()
	elif fileExists("/etc/vtiversion.info"):
		f = open("/etc/vtiversion.info",'r')
		imagever = f.readline().strip()
		f.close()
	else:
		imagever = about.getImageVersionString()

	info["webifver"] = getOpenWebifVer()
	info['imagever'] = imagever
	info['enigmaver'] = about.getEnigmaVersionString()
	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)
		})

	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 = float(free) / float(1024)
			free = "%.3f GB" % free

		size = hdd.diskSize() * 1000000 / float(1048576)
		if size > 1048576:
			size = "%.2f TB" % (size / float(1048576))
		elif size > 1024:
			size = "%d GB" % (size / float(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
Exemplo n.º 12
0
def getInfo():
	# TODO: get webif versione somewhere!
	info = {}

	brand = "Dream Multimedia"
	model = "unknown"
	chipset = "unknown"

	if fileExists("/etc/.box"):
		brand = "HDMU"
		f = open("/etc/.box",'r')
		model = f.readline().strip().lower()
		if model.startswith("et"):
			brand = "Xtrend"
		elif model.startswith("vu"):
			brand = "VuPlus"
		elif model.startswith("gb"):
			brand = "GigaBlue"
		elif model.startswith("ufs") or model.startswith("ufc"):
			brand = "Kathrein"
			if model in ("ufs910", "ufs922", "ufc960"):
				chipset = "SH4 @266MHz"
			else:
				chipset = "SH4 @450MHz"
		elif model.startswith("xpeed"):
			brand = "GoldenInterstar"
		elif model.startswith("topf"):
			brand = "Topfield"
			chipset = "SH4 @266MHz"
		elif model.startswith("azbox"):
			brand = "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"):
			brand = "Fulan"
			chipset = "SH4 @450MHz"
 	elif fileExists("/proc/stb/info/boxtype"):
		brand = "Xtrend"
		f = open("/proc/stb/info/boxtype",'r')
		model = f.readline().strip().lower()
		if model.startswith("et"):
			brand = "Xtrend"
		elif model.startswith("ini"):
			if model.endswith("sv"):
				brand = "MiracleBox"
			elif model.endswith("ru"):
				brand = "Sezam"
			else:
				brand = "Venton"
		elif model.startswith("xp"):
		    brand = "MaxDigital"
 		f.close()
	elif fileExists("/proc/stb/info/vumodel"):
		brand = "VuPlus"
		f = open("/proc/stb/info/vumodel",'r')
 		model = f.readline().strip().lower()
 		f.close()
	elif fileExists("/proc/stb/info/azmodel"):
		brand = "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"
	else:
		f = open("/proc/stb/info/model",'r')
 		model = f.readline().strip().lower()
 		f.close()
	 	if model == "tf7700hdpvr":
 			brand = "Topfield"
			model = "TF 7700 HDPVR"
 			chipset = "SH4 @266MHz"

	info['brand'] = brand
	info['model'] = model

	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

	if fileExists("/etc/bhversion"):
		f = open("/etc/bhversion",'r')
		imagever = f.readline().strip()
		f.close()
	elif fileExists("/etc/vtiversion.info"):
		f = open("/etc/vtiversion.info",'r')
		imagever = f.readline().strip()
		f.close()
	else:
		imagever = about.getImageVersionString()

	info["webifver"] = getOpenWebifVer()
	info['imagever'] = imagever
	info['enigmaver'] = about.getEnigmaVersionString()
	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
Exemplo n.º 13
0
def getInfo():
	# TODO: get webif versione somewhere!
	info = {}

	brand = "unknown"
	model = "unknown"
	chipset = "unknown"

	if fileExists("/proc/stb/info/model"):
		f = open("/proc/stb/info/model",'r')
 		model = f.readline().strip().lower()
 		f.close()
	 	if model == "nbox":
			brand = "Advanced Digital Broadcast"
 			chipset = "SH4 @266MHz"
	 	elif model in ("adb2850", "adb2849"):
			brand = "Advanced Digital Broadcast"
 			chipset = "SH4 @450MHz"
	 	elif model in ("esi88", "uhd88", "dsi87"):
			brand = "SagemCom"
 			chipset = "SH4 @450MHz"

	info['brand'] = brand
	info['model'] = model

	if fileExists("/proc/stb/info/chipset"):
		f = open("/proc/stb/info/chipset",'r')
 		chipset = f.readline().strip()
 		f.close()
		
	if model == "nbox":
		brand = "Advanced Digital Broadcast"
		#model = "ITI-5800S/5800SX"
		chipset = "STx7100"
	elif model == "adb2850":
		brand = "Advanced Digital Broadcast"
		#model = "ITI-2850ST"
		chipset = "STx7111"
	elif model == "adb2849":
		brand = "Advanced Digital Broadcast"
		#model = "ITI-2849ST"
		chipset = "STx7111"
	elif model == "esi88":
		brand = "SagemCom"
		#model = "ESI-88/UHD-88"
		chipset = "STx7105"
	elif model == "dsi87":
		brand = "SagemCom"
		#model = "DSI-87"
		chipset = "STx7111"

	info['brand'] = brand
	info['model'] = model
	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

	if fileExists("/etc/bhversion"):
		f = open("/etc/bhversion",'r')
		imagever = f.readline().strip()
		f.close()
	elif fileExists("/etc/vtiversion.info"):
		f = open("/etc/vtiversion.info",'r')
		imagever = f.readline().strip()
		f.close()
	else:
		imagever = about.getImageVersionString()

	info["webifver"] = getOpenWebifVer()
	info['imagever'] = imagever
	info['enigmaver'] = about.getEnigmaVersionString()
	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
Exemplo n.º 14
0
def getInfo():
    # TODO: get webif versione somewhere!
    info = {}

    brand = "Dream Multimedia"
    model = "unknown"
    chipset = "unknown"

    if fileExists("/proc/stb/info/vumodel"):
        brand = "Vuplus"
        f = open("/proc/stb/info/vumodel", 'r')
        model = f.readline().strip()
        f.close()
    elif fileExists("/proc/stb/info/boxtype"):
        brand = "Clarke-Xtrend"
        f = open("/proc/stb/info/boxtype", 'r')
        model = f.readline().strip()
        f.close()
    else:
        f = open("/proc/stb/info/model", 'r')
        model = f.readline().strip()
        f.close()

    info['brand'] = brand
    info['model'] = model

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

    info['chipset'] = chipset

    f = open("/proc/meminfo", 'r')
    parts = f.readline().split(':')
    info['mem1'] = parts[1].strip()
    parts = f.readline().split(':')
    info['mem2'] = parts[1].strip()
    f.close()

    f = os.popen("uptime")
    parts = f.readline().split(',')
    info['uptime'] = parts[0].strip()
    f.close()

    if fileExists("/etc/bhversion"):
        f = open("/etc/bhversion", 'r')
        imagever = f.readline().strip()
        f.close()
    else:
        imagever = about.getImageVersionString()

    info["webifver"] = "0.0.0"
    info['imagever'] = imagever
    info['enigmaver'] = about.getEnigmaVersionString()
    info['kernelver'] = about.getKernelVersionString()

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

    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
Exemplo n.º 15
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'] = getBoxBrand()
    info['model'] = getBoxType()
    info['platform'] = boxbranding.getMachineBuild()

    try:
        info['procmodel'] = getBoxProc()
    except:  # noqa: E722
        info['procmodel'] = boxbranding.getMachineProcModel()

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

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

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

    cpu = about.getCPUInfoString()
    info['chipset'] = cpu
    info['cpubrand'] = about.getCPUBrand()
    info['socfamily'] = boxbranding.getSoCFamily()
    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'])

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

    info["webifver"] = OPENWEBIFVER
    info['imagedistro'] = boxbranding.getImageDistro()
    info['oever'] = boxbranding.getImageBuild()
    info['visionversion'] = boxbranding.getVisionVersion()
    info['visionrevision'] = boxbranding.getVisionRevision()
    info['visionmodule'] = about.getVisionModule()

    if fileExists("/etc/openvision/multiboot"):
        multibootflag = open("/etc/openvision/multiboot", "r").read().strip()
        if multibootflag == "1":
            info['multiboot'] = _("Yes")
        else:
            info['multiboot'] = _("No")
    else:
        info['multiboot'] = _("Yes")

    info['enigmaver'] = getEnigmaVersionString()
    info['driverdate'] = about.getDriverInstalledDate()
    info['kernelver'] = boxbranding.getKernelVersion()
    info['dvbapitype'] = about.getDVBAPI()
    info['gstreamerversion'] = about.getGStreamerVersionString(cpu)
    info['ffmpegversion'] = about.getFFmpegVersionString()
    info['pythonversion'] = about.getPythonVersionString()

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

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

    try:
        info['boxrctype'] = getBoxRCType()
    except:  # 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'] = boxbranding.getRCType()
    info['ovrcname'] = boxbranding.getRCName()
    info['ovrcidnum'] = boxbranding.getRCIDNum()

    info['transcoding'] = boxbranding.getHaveTranscoding()
    info['multitranscoding'] = boxbranding.getHaveMultiTranscoding()

    info['displaytype'] = boxbranding.getDisplayType()

    info['updatedatestring'] = about.getUpdateDateString()
    info['enigmadebuglvl'] = eGetEnigmaDebugLvl()

    info['imagearch'] = boxbranding.getImageArch()
    info['imagefolder'] = boxbranding.getImageFolder()
    info['imagefilesystem'] = boxbranding.getImageFileSystem()
    info['feedsurl'] = boxbranding.getFeedsUrl()
    info['developername'] = boxbranding.getDeveloperName()
    info['builddatestring'] = about.getBuildDateString()
    info['imagefpu'] = boxbranding.getImageFPU()
    info['havemultilib'] = boxbranding.getHaveMultiLib()

    try:
        info['fp_version'] = getFPVersion()
    except:  # 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:  # 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: merge eStreamServer and streamList
            #  TODO: get tuner info for streams
            #  TODO: get recoding/timer info if more than one
            info['streams'] = []
            try:
                from enigma import eStreamServer
                streamServer = eStreamServer.getInstance()
                if streamServer is not None:
                    for x in streamServer.getConnectedClients():
                        servicename = ServiceReference(
                            x[1]).getServiceName() or "(unknown service)"
                        if int(x[2]) == 0:
                            strtype = "S"
                        else:
                            strtype = "T"
                        info['streams'].append({
                            "ref": x[1],
                            "name": servicename,
                            "ip": x[0],
                            "type": strtype
                        })
            except Exception as error:
                print("[OpenWebif] -D- no eStreamServer %s" % error)
            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)

                # only for debug
                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(
                            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('', 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
Exemplo n.º 16
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
Exemplo n.º 17
0
Arquivo: e2info.py Projeto: HDMU/Skins
def getInfo():
    info = {}
    brand = 'Dream Multimedia'
    model = 'unknown'
    chipset = 'unknown'
    if fileExists('/proc/stb/info/boxtype'):
        brand = 'Xtrend'
        f = open('/proc/stb/info/boxtype', 'r')
        model = f.readline().strip()
        if model.startswith('et'):
            brand = 'Xtrend'
        elif model.startswith('ini'):
            brand = 'INI-Series'
        elif model.startswith('xp'):
            brand = 'XP-Series'
        f.close()
    elif fileExists('/proc/stb/info/vumodel'):
        brand = 'Vuplus'
        f = open('/proc/stb/info/vumodel', 'r')
        model = f.readline().strip()
        f.close()
    elif fileExists('/proc/stb/info/azmodel'):
        brand = 'AZBOX'
        f = open('/proc/stb/info/model', 'r')
        model = f.readline().strip()
        f.close()
        if model == 'me':
            chipset = 'SIGMA 8655'
        elif model == 'minime':
            chipset = 'SIGMA 8653'
        else:
            chipset = 'SIGMA 8634'
    else:
        f = open('/proc/stb/info/model', 'r')
        model = f.readline().strip()
        f.close()
    info['brand'] = brand
    info['model'] = model
    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
    if fileExists('/etc/bhversion'):
        f = open('/etc/bhversion', 'r')
        imagever = f.readline().strip()
        f.close()
    else:
        try:
            imagever = 'VTi-Team Image Release v. '
            imagever += about.getVTiVersionString()
        except:
            imagever = about.getImageVersionString()

    info['imagever'] = imagever
    info['enigmaver'] = about.getEnigmaVersionString()
    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'))})

    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
Exemplo n.º 18
0
	def populate(self):
		if isVTISkin:
			self["EnigmaVersion"] = StaticText(_("Version") + ": " + about.getEnigmaVersionString())
			self["ImageVersion"] = StaticText(_("Image") + ": " + about.getImageVersionString())

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

			fp_version = getFPVersion()
			if fp_version is None:
				fp_version = ""
			else:
				fp_version = _("Frontprocessor version: %s") % str(fp_version)

			self["FPVersion"] = StaticText(fp_version)

			nims = nimmanager.nimList()
			self.tuner_list = []
			if len(nims) <= 4 :
				for count in (0, 1, 2, 3, 4, 5, 6, 7):
					if count < len(nims):
						self["Tuner" + str(count)] = StaticText(nims[count])
						self.tuner_list.append((nims[count] + "\n"))
					else:
						self["Tuner" + str(count)] = StaticText("")
			else:
				desc_list = []
				count = 0
				cur_idx = -1
				while count < len(nims):
					data = nims[count].split(":")
					idx = data[0].strip('Tuner').strip()
					desc = data[1].strip()
					if desc_list and desc_list[cur_idx]['desc'] == desc:
						desc_list[cur_idx]['end'] = idx
					else:
						desc_list.append({'desc' : desc, 'start' : idx, 'end' : idx})
						cur_idx += 1
					count += 1

				for count in (0, 1, 2, 3, 4, 5, 6, 7):
					if count < len(desc_list):
						if desc_list[count]['start'] == desc_list[count]['end']:
							text = "Tuner %s: %s" % (desc_list[count]['start'], desc_list[count]['desc'])
						else:
							text = "Tuner %s-%s: %s" % (desc_list[count]['start'], desc_list[count]['end'], desc_list[count]['desc'])
					else:
						text = ""

					self["Tuner" + str(count)] = StaticText(text)
					if text != "":
						self.tuner_list.append(text + "\n")

			self["HDDHeader"] = StaticText(_("Detected HDD:"))
			hddlist = harddiskmanager.HDDList()
			hdd = hddlist and hddlist[0][1] or None
			if hdd is not None and hdd.model() != "":
				self["hddA"] = StaticText(_("%s\n(%s, %d MB free)") % (hdd.model(), hdd.capacity(),hdd.free()))
			else:
				self["hddA"] = StaticText(_("none"))


			self.enigma2_version = _("Version") + ": " + about.getEnigmaVersionString()
			self.image_version = _("Image") + ": " + about.getImageVersionString()
			cpu_info = parseLines("/proc/cpuinfo")
			cpu_name = "N/A"
			for line in cpu_info:
				if line.find('model') != -1:
					cpu_name = line.split(':')
					if len(cpu_name) >= 2:
						cpu_name = cpu_name[1].strip()
					break

			self.cpu = _("CPU") + ": " + cpu_name
			self.chipset = _("Chipset") + ": " + parseFile("/proc/stb/info/chipset")
			self.tuner_header = _("Detected NIMs:")
			self.hdd_header = _("Detected HDD:")
			self.hdd_list = []
			if len(hddlist):
				for hddX in hddlist:
					hdd = hddX[1]
					if hdd.model() != "":
						self.hdd_list.append((hdd.model() + "\n   %.2f GB - %.2f GB" % (hdd.diskSize()/1000.0, hdd.free()/1000.0) + " " + _("free") + "\n\n"))

			ifaces = iNetwork.getConfiguredAdapters()
			iface_list = []
			for iface in ifaces:
				iface_list.append((_("Interface") + " : " + iNetwork.getAdapterName(iface) + " ("+ iNetwork.getFriendlyAdapterName(iface) + ")\n"))
				iface_list.append((_("IP") + " : " + parse_ipv4(iNetwork.getAdapterAttribute(iface, "ip")) + "\n"))
				iface_list.append((_("Netmask") + " : " + parse_ipv4(iNetwork.getAdapterAttribute(iface, "netmask")) + "\n"))
				iface_list.append((_("Gateway") + " : " + parse_ipv4(iNetwork.getAdapterAttribute(iface, "gateway")) + "\n"))
				if iNetwork.getAdapterAttribute(iface, "dhcp"):
					iface_list.append((_("DHCP") + " : " + _("Yes") + "\n"))
				else:
					iface_list.append((_("DHCP") + " : " + _("No") + "\n"))
				iface_list.append((_("MAC") + " : " + iNetwork.getAdapterAttribute(iface, "mac") + "\n"))
				iface_list.append(("\n"))

			my_txt = self.enigma2_version + "\n"
			my_txt += self.image_version + "\n"
			my_txt += "\n"
			my_txt += self.cpu + "\n"
			my_txt += self.chipset + "\n"
			my_txt += "\n"
			my_txt += self.tuner_header + "\n"
			for x in self.tuner_list:
				my_txt += "   " + x
			my_txt += "\n"
			my_txt += _("Network") + ":\n"
			for x in iface_list:
				my_txt += "   " + x
			my_txt += self.hdd_header + "\n"
			for x in self.hdd_list:
				my_txt += "   " + x
			my_txt += "\n"

			self["FullAbout"] = ScrollLabel(my_txt)
		else:
			self["lab1"] = StaticText(_("openESI"))
			self["lab2"] = StaticText(_("By openESI Image Team"))
			self["lab3"] = StaticText(_("Support at") + " www.openesi.eu")
			model = None
			AboutText = getAboutText()[0]
			self["AboutScrollLabel"] = ScrollLabel(AboutText)
Exemplo n.º 19
0
    def populate(self):
        if isVTISkin:
            self['EnigmaVersion'] = StaticText(
                _('Version') + ': ' + about.getEnigmaVersionString())
            self['ImageVersion'] = StaticText(
                _('Image') + ': ' + about.getImageVersionString())
            self['TunerHeader'] = StaticText(_('Detected NIMs:'))
            fp_version = getFPVersion()
            if fp_version is None:
                fp_version = ''
            else:
                fp_version = _('Frontprocessor version: %d') % fp_version
            self['FPVersion'] = StaticText(fp_version)
            nims = nimmanager.nimList()
            self.tuner_list = []
            if len(nims) <= 4:
                for count in (0, 1, 2, 3, 4, 5, 6, 7):
                    if count < len(nims):
                        self['Tuner' + str(count)] = StaticText(nims[count])
                        self.tuner_list.append(nims[count] + '\n')
                    else:
                        self['Tuner' + str(count)] = StaticText('')

            else:
                desc_list = []
                count = 0
                cur_idx = -1
                while count < len(nims):
                    data = nims[count].split(':')
                    idx = data[0].strip('Tuner').strip()
                    desc = data[1].strip()
                    if desc_list and desc_list[cur_idx]['desc'] == desc:
                        desc_list[cur_idx]['end'] = idx
                    else:
                        desc_list.append({
                            'desc': desc,
                            'start': idx,
                            'end': idx
                        })
                        cur_idx += 1
                    count += 1

            for count in (0, 1, 2, 3, 4, 5, 6, 7):
                if count < len(desc_list):
                    if desc_list[count]['start'] == desc_list[count]['end']:
                        text = 'Tuner %s: %s' % (desc_list[count]['start'],
                                                 desc_list[count]['desc'])
                    else:
                        text = 'Tuner %s-%s: %s' % (desc_list[count]['start'],
                                                    desc_list[count]['end'],
                                                    desc_list[count]['desc'])
                else:
                    text = ''
                self['Tuner' + str(count)] = StaticText(text)
                if text != '':
                    self.tuner_list.append(text + '\n')

            self['HDDHeader'] = StaticText(_('Detected HDD:'))
            hddlist = harddiskmanager.HDDList()
            hdd = hddlist and hddlist[0][1] or None
            if hdd is not None and hdd.model() != '':
                self['hddA'] = StaticText(
                    _('%s\n(%s, %d MB free)') %
                    (hdd.model(), hdd.capacity(), hdd.free()))
            else:
                self['hddA'] = StaticText(_('none'))
            self.enigma2_version = _(
                'Version') + ': ' + about.getEnigmaVersionString()
            self.image_version = _(
                'EGAMI ') + ': ' + about.getImageVersionString()
            cpu_info = parseLines('/proc/cpuinfo')
            cpu_name = 'N/A'
            for line in cpu_info:
                if line.find('model') != -1:
                    cpu_name = line.split(':')
                    if len(cpu_name) >= 2:
                        cpu_name = cpu_name[1].strip()
                    break

            self.cpu = _('CPU') + ': ' + cpu_name
            self.chipset = _('Chipset') + ': ' + parseFile(
                '/proc/stb/info/chipset')
            self.tuner_header = _('Detected NIMs:')
            self.hdd_header = _('Detected HDD:')
            self.hdd_list = []
            if len(hddlist):
                for hddX in hddlist:
                    hdd = hddX[1]
                    if hdd.model() != '':
                        self.hdd_list.append(
                            hdd.model() + '\n   %.2f GB - %.2f GB' %
                            (hdd.diskSize() / 1000.0, hdd.free() / 1000.0) +
                            ' ' + _('free') + '\n\n')

            ifaces = iNetwork.getConfiguredAdapters()
            iface_list = []
            for iface in ifaces:
                iface_list.append(
                    _('Interface') + ' : ' + iNetwork.getAdapterName(iface) +
                    ' (' + iNetwork.getFriendlyAdapterName(iface) + ')\n')
                iface_list.append(
                    _('IP') + ' : ' +
                    parse_ipv4(iNetwork.getAdapterAttribute(iface, 'ip')) +
                    '\n')
                iface_list.append(
                    _('Netmask') + ' : ' + parse_ipv4(
                        iNetwork.getAdapterAttribute(iface, 'netmask')) + '\n')
                iface_list.append(
                    _('Gateway') + ' : ' + parse_ipv4(
                        iNetwork.getAdapterAttribute(iface, 'gateway')) + '\n')
                if iNetwork.getAdapterAttribute(iface, 'dhcp'):
                    iface_list.append(_('DHCP') + ' : ' + _('Yes') + '\n')
                else:
                    iface_list.append(_('DHCP') + ' : ' + _('No') + '\n')
                iface_list.append(
                    _('MAC') + ' : ' +
                    iNetwork.getAdapterAttribute(iface, 'mac') + '\n')
                iface_list.append('\n')

            my_txt = self.enigma2_version + '\n'
            my_txt += self.image_version + '\n'
            my_txt += '\n'
            my_txt += self.cpu + '\n'
            my_txt += self.chipset + '\n'
            my_txt += '\n'
            my_txt += self.tuner_header + '\n'
            for x in self.tuner_list:
                my_txt += '   ' + x

            my_txt += '\n'
            my_txt += _('Network') + ':\n'
            for x in iface_list:
                my_txt += '   ' + x

            my_txt += self.hdd_header + '\n'
            for x in self.hdd_list:
                my_txt += '   ' + x

            my_txt += '\n'
            self['FullAbout'] = ScrollLabel(my_txt)
        else:
            EGAMIVersion = _('EGAMI %s') % about.getImageVersionString()
            self['lab1'] = Label(EGAMIVersion)
            model = None
            AboutText = getAboutText()[0]
            self['AboutScrollLabel'] = ScrollLabel(AboutText)
        return
def getInfo():
	# TODO: get webif versione somewhere!
	info = {}

	brand = "Dream Multimedia"
	model = "unknown"
	chipset = "unknown"

	if fileExists("/etc/.box"):
		brand = "HDMU"
		f = open("/etc/.box",'r')
		model = f.readline().strip().lower()
		if model.startswith("et"):
			brand = "Xtrend"
		elif model.startswith("vu"):
			brand = "VuPlus"
		elif model.startswith("gb"):
			brand = "GigaBlue"
		elif model.startswith("ufs") or model.startswith("ufc"):
			brand = "Kathrein"
			if model in ("ufs910", "ufs922", "ufc960"):
				chipset = "SH4 @266MHz"
			else:
				chipset = "SH4 @450MHz"
		elif model.startswith("xpeed"):
			brand = "GoldenInterstar"
		elif model.startswith("topf"):
			brand = "Topfield"
			chipset = "SH4 @266MHz"
		elif model.startswith("azbox"):
			brand = "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"):
			brand = "Fulan"
			chipset = "SH4 @450MHz"
	elif fileExists("/proc/stb/info/hwmodel",'r'): # divide to brand model.
		f = open("/proc/stb/info/hwmodel",'r')
		f_model = f.readline().strip().lower()
		if f_model.startswith("me"):
			model = "Mediabox HD LX-1"
			brand = "Jepssen"
		elif f_model.startswith("op"):
			model = f_model[0:1].upper() + f_model[1:8].lower() + " " + f_model[8:].upper() # optimussos1 ==> Optimuss OS1
			brand = "Edision"
		elif f_model.startswith("force1p"):
			if fileExists("/etc/.brandtype"):
				b = open("/etc/.brandtype",'r')
				b_brand = b.readline().strip().lower()
				if b_brand.startswith("ed"):
					model = "Optimuss OS3+"
					brand = "Edision"
				elif b_brand.startswith("te"):
					model = "TM-NANO-3T COMBO"
					brand = "Technomate"
				elif b_brand.startswith("sw"):
					model = "Force1+"
					brand = "4D"
				elif b_brand.startswith("wo"):
					model = "Force1+"
					brand = "Worldvision"
				else:
					model = "Force1+"
					brand = "Iqon"
				b.close()
		elif f_model.startswith("optimussos"):
			model = "Optimuss OS"
			brand = "Edision"
		elif f_model.startswith("force2plus"):
			model = "force2plus"
			brand = "Iqon"
		elif f_model.startswith("force2se"):
			model = "force2se"
			brand = "Iqon"
		elif f_model.startswith("force2"):
			model = "force2"
			brand = "Iqon"
		elif f_model.startswith("force2nano"):
			model = "force2nano"
			brand = "Iqon"
		elif f_model.startswith("tmnanosecombo"):
			model = "TM-NANO-SE Combo"
			brand = "Technomate"
		elif f_model.startswith("tmnanosem2"):
			model = "TM-NANO-SE M2"
			brand = "Technomate"
		elif f_model.startswith("tmnanoseplus"):
			model = "TM-NANO-SE Plus"
			brand = "Technomate"
		elif f_model.startswith("tmnanose"):
			model = "TM-NANO-SE"
			brand = "Technomate"
		elif f_model.startswith("tmnanom3"):
			model = "TM-NANO M3"
			brand = "Technomate"
		elif f_model.startswith("fusionhdse"):
			model = "FUSION HD SE"
			brand = "Xsarius"
		elif f_model.startswith("fusionhd"):
			model = "FUSION HD"
			brand = "Xsarius"
		elif f_model.startswith("purehd"):
			model = "PURE HD"
			if fileExists("/etc/.brandtype"):
				b = open("/etc/.brandtype",'r')
				b_brand = b.readline().strip().lower()
				brand = b_brand[0:1].upper() + b_brand[1:].lower()
				b.close()
		elif f_model.startswith("selfsat"):
			model = "SELF SAT"
			if fileExists("/etc/.brandtype"):
				b = open("/etc/.brandtype",'r')
				b_brand = b.readline().strip().lower()
				brand = b_brand[0:1].upper() + b_brand[1:].lower()
				b.close()
		else:
			model = f_model
			if fileExists("/etc/.brandtype"):
				b = open("/etc/.brandtype",'r')
				b_brand = b.readline().strip().lower()
				brand = b_brand[0:1].upper() + b_brand[1:].lower()
				b.close()
		f.close()
	elif fileExists("/proc/stb/info/boxtype"):
		brand = "Xtrend"
		f = open("/proc/stb/info/boxtype",'r')
		model = f.readline().strip().lower()
		if model.startswith("et"):
			brand = "Xtrend"
		elif model.startswith("ini"):
			if model.endswith("sv"):
				brand = "MiracleBox"
			elif model.endswith("ru"):
				brand = "Sezam"
			else:
				brand = "Venton"
		elif model.startswith("xp"):
			brand = "MaxDigital"
		elif model.startswith("ixuss"):
			brand = "Medialink"
			model = model.replace(" ", "")
 		f.close()
	elif fileExists("/proc/stb/info/vumodel"):
		brand = "VuPlus"
		f = open("/proc/stb/info/vumodel",'r')
		model = f.readline().strip().lower()
		f.close()
	elif fileExists("/proc/stb/info/azmodel"):
		brand = "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"
	else:
		f = open("/proc/stb/info/model",'r')
		model = f.readline().strip().lower()
		f.close()
		if model == "tf7700hdpvr":
			brand = "Topfield"
			chipset = "SH4 @266MHz"
		elif model == "nbox":
			brand = "Advanced Digital Broadcast"
			chipset = "SH4 @266MHz"
		elif model in ("adb2850", "adb2849"):
			brand = "Advanced Digital Broadcast"
			chipset = "SH4 @450MHz"
		elif model in ("esi88", "uhd88", "dsi87"):
			brand = "SagemCom"
			chipset = "SH4 @450MHz"

	info['brand'] = brand
	info['model'] = model

	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

	if fileExists("/etc/bhversion"):
		f = open("/etc/bhversion",'r')
		imagever = f.readline().strip()
		f.close()
	elif fileExists("/etc/vtiversion.info"):
		f = open("/etc/vtiversion.info",'r')
		imagever = f.readline().strip()
		f.close()
	else:
		imagever = about.getImageVersionString()

	info["webifver"] = getOpenWebifVer()
	info['imagever'] = imagever
	info['enigmaver'] = about.getEnigmaVersionString()
	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
Exemplo n.º 21
0
def getInfo():
	# TODO: get webif versione somewhere!
	info = {}

	brand = "Dream Multimedia"
	model = "unknown"
	chipset = "unknown"

	if fileExists("/proc/stb/info/hwmodel"):
		file = open("/proc/stb/info/hwmodel")
		model = file.read().strip().lower()
		file.close()
		if model == "tmtwinoe":
			model = "TM-TWIN-OE"
			brand = "Technomate"
		elif model == "tm2toe":
			model = "TM-2T-OE"
			brand = "Technomate"
		elif model == "tmsingle":
			model = "TM-SINGLE"
			brand = "Technomate"
		elif model == "tmnanooe":
			model = "TM-NANO-OE"
			brand = "Technomate"
		elif model == "ios100hd":
			model = "IOS-100HD"
			brand = "Iqon"
		elif model == "ios200hd":
			model = "IOS-200HD"
			brand = "Iqon"
		elif model == "ios300hd":
			model = "IOS-300HD"
			brand = "Iqon"
		elif model == "optimussos1":
			model = "Optimuss-OS1"
			brand = "Edision"
		elif model == "optimussos2":
			model = "Optimuss-OS2"
			brand = "Edision"
		elif model == "sogno-8800hd":
			brand = "Sogno"
			model = "Sogno 8800HD"
	elif fileExists("/proc/stb/info/boxtype"):
		file = open("/proc/stb/info/boxtype")
		model = file.read().strip().lower()
		file.close()
		if model == "gigablue":
			brand = "GigaBlue"
			if fileExists("/proc/stb/info/gbmodel"):
				file = open("/proc/stb/info/gbmodel")
				model = file.read().strip().lower()
				file.close()
		elif model.startswith("et"):
			brand = "Clarke-Xtrend"
			if model == "et9500":
				model = "et9x00"
		elif model.startswith("ini"):
			if model.endswith("sv"):
				brand = "MiracleBox"
				if model == "ini-5000sv":
					model = "Premium Twin"
				elif model == "ini-1000sv":
					model = "Premium Mini"
				else:
					model
			elif model.endswith("de"):
				brand = "Golden Interstar"
				if model == "ini-1000de":
					model = "Xpeed LX"
				elif model == "ini-9000de":
					model = "Xpeed LX3"
				else:
					model
			elif model.endswith("ru"):
				brand = "Sezam"
				if model == "ini-1000ru":
					model = "Sezam 1000-HD"
				elif model == "ini-5000ru":
					model = "Sezam 5000-HD"
				elif model == "ini-9000ru":
					model = "Sezam Marvel"
				else:
					model
			else:
				brand = "Venton"
		elif model == "enfinity":
			brand = "EVO"
			model = "ENfinity"
		elif model == "xp1000":
			brand = "XP-Series"
		elif model == "xp1000s":
			brand = "Octagon"
			model = "SF8 HD"
		elif model == "odinm9":
			brand = "Odin-Series"
		elif model == "odinm7":
			if getImageDistro() == 'axassupport':
				brand = "AXAS"
				model = "Class M"
			elif getBoxType() == 'odinm6':
				brand = "TELESTAR"
				model = "STARSAT LX"
			elif getMachineName() == 'AX-Odin':
				brand = "Opticum"
				model = "AX-Odin"	
			else:
				brand = "Odin-Series"
		elif model == "e3hd":
			if getImageDistro() == 'axassupport':
				brand = "AXAS"
				model = "Class E"
			else:
				brand = "E3-Series"
		elif model == "ebox5000":
			brand = "MixOs-Series"
			model = "MixOs F5"
		elif model == "ebox5100":
			brand = "MixOs-Series"
			model = "MixOs F5mini"
		elif model == "ebox7358":
			brand = "MixOs-Series"
			model = "MixOs F7"
		elif model.startswith("ixuss"):
			brand = "Ixuss-Series"
			chipset = "BCM7405"
	elif 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"
	elif fileExists("/proc/stb/info/vumodel"):
		brand = "Vu Plus"
		file = open("/proc/stb/info/vumodel")
		model = file.read().strip().lower()
		file.close()
	else:
		file = open("/proc/stb/info/model")
		model = file.read().strip().lower()
 		if model.startswith('spar'):
		    brand = "Spark"
		file.close()

	info['brand'] = brand
	info['model'] = model

	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['imagever'] = getImageVersion() + '.' + getImageBuild()
	info['enigmaver'] = getEnigmaVersionString()
	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"))
		})

	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
Exemplo n.º 22
0
def getInfo():
	# TODO: get webif versione somewhere!
	info = {}

	brand = "Dream Multimedia"
	model = "unknown"
	chipset = "unknown"
	
	if fileExists("/proc/stb/info/boxtype"):
		brand = "Clarke-Xtrend"
		f = open("/proc/stb/info/boxtype",'r')
 		model = f.readline().strip()
 		if model == "ini-3000" or model == "ini-5000" or model == "ini-7000":
		    brand = "INI-Series"
 		f.close()
	elif fileExists("/proc/stb/info/vumodel"):
		brand = "Vuplus"
		f = open("/proc/stb/info/vumodel",'r')
 		model = f.readline().strip()
 		f.close()
	elif fileExists("/proc/stb/info/azmodel"):
		brand = "AZBOX"
		f = open("/proc/stb/info/model",'r')
 		model = f.readline().strip()
 		f.close()
 		if model == "me":
			chipset = "SIGMA 8655"
 		elif model == "minime":
			chipset = "SIGMA 8653"
 		else:
			chipset = "SIGMA 8634"
	else:
		f = open("/proc/stb/info/model",'r')
 		model = f.readline().strip()
 		f.close()

	info['brand'] = brand
	info['model'] = model

	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
		
	if fileExists("/etc/bhversion"):
		f = open("/etc/bhversion",'r')
		imagever = f.readline().strip()
		f.close()
	elif fileExists("/etc/vtiversion.info"):
		f = open("/etc/vtiversion.info",'r')
		imagever = f.readline().strip()
		f.close()
	else:
		imagever = about.getImageVersionString()
		
	info["webifver"] = getOpenWebifVer()
	info['imagever'] = imagever
	info['enigmaver'] = about.getEnigmaVersionString()
	info['kernelver'] = about.getKernelVersionString()
	
	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"))
		})
			
	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
Exemplo n.º 23
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
Exemplo n.º 24
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
Exemplo n.º 25
0
def getInfo():
    info = {}
    brand = 'Dream Multimedia'
    model = 'unknown'
    chipset = 'unknown'
    if fileExists('/proc/stb/info/boxtype'):
        brand = 'Xtrend'
        f = open('/proc/stb/info/boxtype', 'r')
        model = f.readline().strip()
        if model.startswith('et'):
            brand = 'Xtrend'
        elif model.startswith('ini'):
            brand = 'INI-Series'
        elif model.startswith('xp'):
            brand = 'XP-Series'
        f.close()
    elif fileExists('/proc/stb/info/vumodel'):
        brand = 'Vuplus'
        f = open('/proc/stb/info/vumodel', 'r')
        model = f.readline().strip()
        f.close()
    elif fileExists('/proc/stb/info/azmodel'):
        brand = 'AZBOX'
        f = open('/proc/stb/info/model', 'r')
        model = f.readline().strip()
        f.close()
        if model == 'me':
            chipset = 'SIGMA 8655'
        elif model == 'minime':
            chipset = 'SIGMA 8653'
        else:
            chipset = 'SIGMA 8634'
    else:
        f = open('/proc/stb/info/model', 'r')
        model = f.readline().strip()
        f.close()
    info['brand'] = brand
    info['model'] = model
    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
    if fileExists('/etc/bhversion'):
        f = open('/etc/bhversion', 'r')
        imagever = f.readline().strip()
        f.close()
    else:
        try:
            imagever = 'VTi-Team Image Release v. '
            imagever += about.getVTiVersionString()
        except:
            imagever = about.getImageVersionString()

    info['imagever'] = imagever
    info['enigmaver'] = about.getEnigmaVersionString()
    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'))})

    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