コード例 #1
0
	def createSetup(self):
		if self.scan_nims == []:
			return
		self.list = []
		index_to_scan = int(self.scan_nims.value)
		print("[dmmBlindscan][createSetup] ID: ", index_to_scan)

		self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims, _("Select a tuner that is configured for the satellite you wish to search"))
		self.list.append(self.tunerEntry)

		nim = nimmanager.nim_slots[index_to_scan]

		tunername = nimmanager.getNimName(index_to_scan)

		self.updateSatList()
#			selected_sat_pos = self.scan_satselection[index_to_scan].value
		self.satelliteEntry = getConfigListEntry(_("Satellite"), self.scan_satselection[index_to_scan], _("Select the satellite you wish to search"))
		self.list.append(self.satelliteEntry)

		if not self.SatBandCheck():
			self["config"].list = self.list
			self["config"].l.setList(self.list)
			self["actions2"].setEnabled(False)
			self["key_green"].setText("")
			self["introduction"].setText(_("LNB of current satellite not compatible with plugin"))
			return
		else:
			self["introduction"].setText(_("Press OK to start the scan."))
			self.updateFreqLimits()

		self.searchtypeEntry = getConfigListEntry(_("Search type"), self.search_type, _('"scan for channels" searches for channels and saves them to your receiver; "Save to XML" does a transponder search and saves the results in satellites.xml format and stores it in /tmp'))
		self.list.append(self.searchtypeEntry)
		self.list.append(getConfigListEntry(_("Scan start frequency"), self.dmmBlindscan.freq_start, _("Frequency values must be between %d MHz and %d MHz") % (self.freq_limits[0], self.freq_limits[1] - 1)))
		self.list.append(getConfigListEntry(_("Scan stop frequency"), self.dmmBlindscan.freq_stop, _("Frequency values must be between %d MHz and %d MHz") % (self.freq_limits[0] + 1, self.freq_limits[1])))
		self.list.append(getConfigListEntry(_("Polarisation"), self.dmmBlindscan.polarization, _("Polarisation, select horizontal, vertical or both.")))
		self.list.append(getConfigListEntry(_("Scan start symbolrate"), self.dmmBlindscan.sr_start, _("Symbol rate values are in megasymbols; enter a value between %d and %d") % (self.sr_limits[0], self.sr_limits[1] - 1)))
		self.list.append(getConfigListEntry(_("Scan stop symbolrate"), self.dmmBlindscan.sr_stop, _("Symbol rate values are in megasymbols; enter a value between %d and %d") % (self.sr_limits[0] + 1, self.sr_limits[1])))
		if nim.isCompatible("DVB-S2") and not (nimmanager.nim_slots[index_to_scan].supportsBlindScan() or tunername in ("Si2166B", "Si2169C")):
			self.list.append(getConfigListEntry(_("Accuracy (higher is better)"), self.dmmBlindscan.accuracy, _("Select between 1 and 5. Higher numbers give more accurat search results.")))
		if self.search_type.value == "services":
			self.list.append(getConfigListEntry(_("Clear before scan"), self.dmmBlindscan.scan_clearallservices, _('If you select "yes" all channels on the satellite being search will be deleted before starting the current search, yes (keep feeds) means the same but hold all feed services/transponders.')))
			self.list.append(getConfigListEntry(_("Only free scan"), self.dmmBlindscan.scan_onlyfree, _('If you select "yes" the scan will only save channels that are not encrypted; "no" will find encrypted and non-encrypted channels.')))
			self.onlyUnknownTpsEntry = getConfigListEntry(_("Only scan unknown transponders"), self.dmmBlindscan.dont_scan_known_tps, _('If you select "yes" the scan will only search transponders not listed in satellites.xml'))
			self.list.append(self.onlyUnknownTpsEntry)
			if not self.dmmBlindscan.dont_scan_known_tps.value:
				self.list.append(getConfigListEntry(_("Disable sync with known transponders"), self.dmmBlindscan.disable_sync_with_known_tps, _('CAUTION: If you select "yes" the scan will not sync with transponders listed in satellites.xml. Default is "no". Only change this if you understand why you are doing it.')))
			self.list.append(getConfigListEntry(_("Disable remove duplicates"), self.dmmBlindscan.disable_remove_duplicate_tps, _('CAUTION: If you select "yes" the scan will not remove "duplicated" transponders from the list. Default is "no". Only change this if you understand why you are doing it.')))
			self.list.append(getConfigListEntry(_("Filter out adjacent satellites"), self.dmmBlindscan.filter_off_adjacent_satellites, _('When a neighbouring satellite is very strong this avoids searching transponders known to be coming from the neighbouring satellite.')))
#		self.list.append(getConfigListEntry(_("Scan multiple times"), self.dmmBlindscan.multiple_scan,_('Scan all frequencies multiple times to capture transponders missed on the first attempt.')))

		self["config"].list = self.list
		self["config"].l.setList(self.list)

		self["key_green"].setText(_("Scan"))
		self["actions2"].setEnabled(True)
コード例 #2
0
	def startSatelliteTransponderSearch(self, nim_idx, orb_pos):
		self.frontend = None
		self.orb_pos = orb_pos
		self.nim = nimmanager.nim_slots[nim_idx]
		tunername = nimmanager.getNimName(nim_idx)
		self.__tlist = [ ]
		self.tp_found = [ ]
		self.current_range = None
		self.range_list = [ ]
		tuner_no = -1

		print "tunername", tunername
		if tunername in ("BCM4505", "BCM4506 (internal)", "Alps BSBE1 C01A/D01A."):
			(self.channel, self.frontend) = self.tryGetRawFrontend(nim_idx, False, False)
			if not self.frontend:
				self.session.nav.stopService()
				(self.channel, self.frontend) = self.tryGetRawFrontend(nim_idx, False, False)
				if not self.frontend:
					if self.session.pipshown: # try to disable pip
						self.session.pipshown = False
	                                        self.session.deleteDialog(self.session.pip)
						del self.session.pip
					(self.channel, self.frontend) = self.tryGetRawFrontend(nim_idx, False, False)
					if not self.frontend:
						print "couldn't allocate tuner %d for blindscan!!!" %nim_idx
						return
#			self.frontend.getStateChangeSignal().append(self.frontendStateChanged)

			if self.scan_sat.bs_vertical.value:
				self.range_list.append((self.scan_sat.bs_freq_start.value * 1000, self.scan_sat.bs_freq_stop.value * 1000, eDVBFrontendParametersSatellite.Polarisation_Vertical))
			if self.scan_sat.bs_horizontal.value:
				self.range_list.append((self.scan_sat.bs_freq_start.value * 1000, self.scan_sat.bs_freq_stop.value * 1000, eDVBFrontendParametersSatellite.Polarisation_Horizontal))

			self.parm = self.setNextRange()
			if self.parm is not None:
				tparm = eDVBFrontendParameters()
				tparm.setDVBS(self.parm, False)
				self.frontend.tune(tparm)
				self.start_time = time()
				tmpstr = _("Try to find used satellite transponders...")
			else:
				tmpstr = _("Nothing to scan! Press Exit!")
			x = { }
			data = self.frontend.getFrontendData(x)
			tuner_no = x["tuner_number"]
		else:
			tmpstr = _("Blindscan is not supported by this tuner (%s)") %tunername
		self.satellite_search_session = self.session.openWithCallback(self.satelliteTransponderSearchSessionClosed, SatBlindscanState, tuner_no, tmpstr)
		self.timer = eTimer()
		self.timer.callback.append(self.frontendStateChanged)
		self.frontendStateChanged()
コード例 #3
0
	def createSetup(self):
		self.list = []
		self.multiscanlist = []
		if self.scan_nims.value == "":
			return
		index_to_scan = int(self.scan_nims.value)
		print "ID: ", index_to_scan

		self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
		self.list.append(self.tunerEntry)
		
		if self.scan_nims == [ ]:
			return
		
		self.systemEntry = None
		self.modulationEntry = None
		self.satelliteEntry = None
		nim = nimmanager.nim_slots[index_to_scan]

		self.scan_networkScan.value = False
#		self.scan_otherSDT.value = False
		if nim.isCompatible("DVB-S"):
			self.updateSatList()
			selected_sat_pos = self.scan_satselection[index_to_scan].value
			limit_list = self.nim_sat_frequency_range[index_to_scan][int(selected_sat_pos)]
			l = limit_list[0]
			limits = ( l[0]/1000, l[1]/1000 )
			self.scan_sat.bs_freq_start = ConfigInteger(default = limits[0], limits = (limits[0], limits[1]))
			self.scan_sat.bs_freq_stop = ConfigInteger(default = limits[1], limits = (limits[0], limits[1]))
			self.satelliteEntry = getConfigListEntry(_("Satellite"), self.scan_satselection[index_to_scan])
			self.list.append(self.satelliteEntry)
			self.list.append(getConfigListEntry(_("Frequency start"), self.scan_sat.bs_freq_start))
			self.list.append(getConfigListEntry(_("Frequency stop"), self.scan_sat.bs_freq_stop))
			tunername = nimmanager.getNimName(index_to_scan)
			if nim.isCompatible("DVB-S2") and tunername != 'Si2166B' and tunername != 'Si2169C':
				self.list.append(getConfigListEntry(_("Accuracy (higher is better)"), self.scan_sat.bs_accuracy))
			self.list.append(getConfigListEntry(_("Horizontal"), self.scan_sat.bs_horizontal))
			self.list.append(getConfigListEntry(_("Vertical"), self.scan_sat.bs_vertical))
			self.scan_networkScan.value = True
		self.list.append(getConfigListEntry(_("Network scan"), self.scan_networkScan))
		self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
		self.list.append(getConfigListEntry(_("Only free scan"), self.scan_onlyfree))
#		if config.usage.setup_level.index >= 2:
#			self.list.append(getConfigListEntry(_("Lookup other SDT"), self.scan_otherSDT))
#			self.list.append(getConfigListEntry(_("Skip empty transponders"), self.scan_skipEmpty))
		self["config"].list = self.list
		self["config"].l.setList(self.list)
		self.scan_sat.bs_freq_limits = ( limits[0]*1000, limits[1]*1000 )
コード例 #4
0
ファイル: plugin.py プロジェクト: Dima73/oe-alliance-plugins
	def createSetup(self):
		self.list = []
		self.multiscanlist = []
		if self.scan_nims.value == "":
			return
		index_to_scan = int(self.scan_nims.value)
		print "ID: ", index_to_scan

		self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
		self.list.append(self.tunerEntry)
		
		if self.scan_nims == [ ]:
			return
		
		self.systemEntry = None
		self.modulationEntry = None
		self.satelliteEntry = None
		nim = nimmanager.nim_slots[index_to_scan]

		self.scan_networkScan.value = False
#		self.scan_otherSDT.value = False
		if nim.isCompatible("DVB-S"):
			self.updateSatList()
			selected_sat_pos = self.scan_satselection[index_to_scan].value
			limit_list = self.nim_sat_frequency_range[index_to_scan][int(selected_sat_pos)]
			l = limit_list[0]
			limits = ( l[0]/1000, l[1]/1000 )
			self.scan_sat.bs_freq_start = ConfigInteger(default = limits[0], limits = (limits[0], limits[1]))
			self.scan_sat.bs_freq_stop = ConfigInteger(default = limits[1], limits = (limits[0], limits[1]))
			self.satelliteEntry = getConfigListEntry(_("Satellite"), self.scan_satselection[index_to_scan])
			self.list.append(self.satelliteEntry)
			self.list.append(getConfigListEntry(_("Frequency start"), self.scan_sat.bs_freq_start))
			self.list.append(getConfigListEntry(_("Frequency stop"), self.scan_sat.bs_freq_stop))
			tunername = nimmanager.getNimName(index_to_scan)
			if nim.isCompatible("DVB-S2") and tunername != 'Si2166B' and tunername != 'Si2169C':
				self.list.append(getConfigListEntry(_("Accuracy (higher is better)"), self.scan_sat.bs_accuracy))
			self.list.append(getConfigListEntry(_("Horizontal"), self.scan_sat.bs_horizontal))
			self.list.append(getConfigListEntry(_("Vertical"), self.scan_sat.bs_vertical))
			self.scan_networkScan.value = True
		self.list.append(getConfigListEntry(_("Network scan"), self.scan_networkScan))
		self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
		self.list.append(getConfigListEntry(_("Only free scan"), self.scan_onlyfree))
#		if config.usage.setup_level.index >= 2:
#			self.list.append(getConfigListEntry(_("Lookup other SDT"), self.scan_otherSDT))
#			self.list.append(getConfigListEntry(_("Skip empty transponders"), self.scan_skipEmpty))
		self["config"].list = self.list
		self["config"].l.setList(self.list)
		self.scan_sat.bs_freq_limits = ( limits[0]*1000, limits[1]*1000 )
コード例 #5
0
	def createSetup(self):
		self.list = []
		self.multiscanlist = []
		if self.scan_nims.value == "":
			return
		if self.scan_nims == [ ]:
			return
		index_to_scan = int(self.scan_nims.value)
		print("ID: ", index_to_scan)

		self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
		self.list.append(self.tunerEntry)

		self.systemEntry = None
		self.modulationEntry = None
		self.satelliteEntry = None
		self.searchtypeEntry = None
		nim = nimmanager.nim_slots[index_to_scan]

		self.scan_networkScan.value = False
		tunername = nimmanager.getNimName(index_to_scan)
		if nim.isCompatible("DVB-S"):
			self.updateSatList()
			selected_sat_pos = self.scan_satselection[index_to_scan].value
			if self.is_c_band_scan == True:
				limits = (3400, 4200)
			else:
				limits = (10700, 12750)
			self.scan_sat.bs_freq_start = ConfigInteger(default = limits[0], limits = (limits[0], limits[1]))
			self.scan_sat.bs_freq_stop = ConfigInteger(default = limits[1], limits = (limits[0], limits[1]))
			self.satelliteEntry = getConfigListEntry(_("Satellite"), self.scan_satselection[index_to_scan])
			self.list.append(self.satelliteEntry)
			self.searchtypeEntry = getConfigListEntry(_("Search type"), self.search_type)
			self.list.append(getConfigListEntry(_("Scan start frequency"), self.scan_sat.bs_freq_start))
			self.list.append(getConfigListEntry(_("Scan stop frequency"), self.scan_sat.bs_freq_stop))
			if nim.isCompatible("DVB-S2") and tunername != "Si2166B" and tunername != "Si2169C":
				self.list.append(getConfigListEntry(_("Accuracy (higher is better)"), self.scan_sat.bs_accuracy))
			self.list.append(getConfigListEntry(_("Horizontal"), self.scan_sat.bs_horizontal))
			self.list.append(getConfigListEntry(_("Vertical"), self.scan_sat.bs_vertical))
			self.list.append(self.searchtypeEntry)
			if self.search_type.value == 0:
				self.list.append(getConfigListEntry(_("Network scan"), self.scan_networkScan))
				self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
				self.list.append(getConfigListEntry(_("Only free scan"), self.scan_onlyfree))
		self["config"].list = self.list
		self["config"].l.setList(self.list)
		self.scan_sat.bs_freq_limits = ( limits[0]*1000, limits[1]*1000 )
コード例 #6
0
	def createSetup(self):
		self.list = []
		self.multiscanlist = []
		if self.scan_nims.value == "":
			return
		if self.scan_nims == [ ]:
			return
		index_to_scan = int(self.scan_nims.value)
		print "ID: ", index_to_scan

		self.tunerEntry = getConfigListEntry(_("Tuner"), self.scan_nims)
		self.list.append(self.tunerEntry)

		self.systemEntry = None
		self.modulationEntry = None
		self.satelliteEntry = None
		self.searchtypeEntry = None
		nim = nimmanager.nim_slots[index_to_scan]

		self.scan_networkScan.value = False
		tunername = nimmanager.getNimName(index_to_scan)
		if nim.isCompatible("DVB-S"):
			self.updateSatList()
			selected_sat_pos = self.scan_satselection[index_to_scan].value
			limits = (10700, 12750)
			self.scan_sat.bs_freq_start = ConfigInteger(default = limits[0], limits = (limits[0], limits[1]))
			self.scan_sat.bs_freq_stop = ConfigInteger(default = limits[1], limits = (limits[0], limits[1]))
			self.satelliteEntry = getConfigListEntry(_("Satellite"), self.scan_satselection[index_to_scan])
			self.list.append(self.satelliteEntry)
			self.searchtypeEntry = getConfigListEntry(_("Search type"), self.search_type)
			self.list.append(getConfigListEntry(_("Scan start frequency"), self.scan_sat.bs_freq_start))
			self.list.append(getConfigListEntry(_("Scan stop frequency"), self.scan_sat.bs_freq_stop))
			if nim.isCompatible("DVB-S2") and tunername != "Si2166B":
				self.list.append(getConfigListEntry(_("Accuracy (higher is better)"), self.scan_sat.bs_accuracy))
			self.list.append(getConfigListEntry(_("Horizontal"), self.scan_sat.bs_horizontal))
			self.list.append(getConfigListEntry(_("Vertical"), self.scan_sat.bs_vertical))
			self.list.append(self.searchtypeEntry)
			if self.search_type.value == 0:
				self.list.append(getConfigListEntry(_("Network scan"), self.scan_networkScan))
				self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices))
				self.list.append(getConfigListEntry(_("Only free scan"), self.scan_onlyfree))
		self["config"].list = self.list
		self["config"].l.setList(self.list)
		self.scan_sat.bs_freq_limits = ( limits[0]*1000, limits[1]*1000 )
コード例 #7
0
ファイル: info.py プロジェクト: herpoi/e2openplugin-OpenWebif
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
コード例 #8
0
    def startSatelliteTransponderSearch(self, nim_idx, orb_pos):
        if hasattr(self, 'self.frontend'):
            del self.frontend
        if hasattr(self, 'self.channel'):
            del self.channel
        self.frontend = self.channel = None
        self.orb_pos = orb_pos
        self.nim = nimmanager.nim_slots[nim_idx]
        tunername = nimmanager.getNimName(nim_idx)
        self.__tlist = []
        self.tp_found = []
        self.current_range = None
        self.range_list = []
        tuner_no = -1
        self.auto_scan = False

        print "tunername", tunername
        if tunername in ("BCM4505", "BCM4506 (internal)", "BCM4506",
                         "Alps BSBE1 C01A/D01A.", "Si2166B"):
            self.auto_scan = tunername == 'Si2166B'
            (self.channel,
             self.frontend) = self.tryGetRawFrontend(nim_idx, False, False)
            if not self.frontend:
                self.session.nav.stopService()
                (self.channel, self.frontend) = self.tryGetRawFrontend(
                    nim_idx, False, False)
                if not self.frontend:
                    if self.session.pipshown:
                        if hasattr(self.session, 'infobar'):
                            try:
                                slist = self.session.infobar.servicelist
                                if slist and slist.dopipzap:
                                    slist.togglePipzap()
                            except:
                                pass
                        self.session.pipshown = False
                        if hasattr(self.session, 'pip'):
                            del self.session.pip
                    (self.channel, self.frontend) = self.tryGetRawFrontend(
                        nim_idx, False, False)
                    if not self.frontend:
                        print "couldn't allocate tuner %d for blindscan!!!" % nim_idx
                        text = _("Sorry, this tuner is in use.")
                        if self.session.nav.getRecordings():
                            text += "\n"
                            text += _(
                                "Maybe the reason that recording is currently running."
                            )
                        self.session.open(MessageBox, text,
                                          MessageBox.TYPE_ERROR)
                        return

            band_cutoff_frequency = 11700000

            s1 = self.scan_sat.bs_freq_start.value * 1000
            s2 = self.scan_sat.bs_freq_stop.value * 1000

            start = self.min_freq = min(s1, s2)
            stop = self.max_freq = max(s1, s2)

            if self.auto_scan:  # hack for driver based blindscan... extend search range +/- 50Mhz
                limits = self.scan_sat.bs_freq_limits
                start -= 50000
                stop += 50000
                if start < limits[0]:
                    start = limits[0]
                if stop > limits[1]:
                    stop = limits[1]

            if self.scan_sat.bs_horizontal.value:
                if self.auto_scan and band_cutoff_frequency and stop > band_cutoff_frequency:
                    if start < band_cutoff_frequency:
                        self.range_list.append(
                            (start, min(stop, band_cutoff_frequency),
                             eDVBFrontendParametersSatellite.
                             Polarisation_Horizontal))
                    if stop > band_cutoff_frequency:
                        self.range_list.append(
                            (max(band_cutoff_frequency,
                                 start), stop, eDVBFrontendParametersSatellite.
                             Polarisation_Horizontal))
                else:
                    self.range_list.append(
                        (start, stop, eDVBFrontendParametersSatellite.
                         Polarisation_Horizontal))

            if self.scan_sat.bs_vertical.value:
                if self.auto_scan and band_cutoff_frequency:
                    if start < band_cutoff_frequency:
                        self.range_list.append(
                            (start, min(stop, band_cutoff_frequency),
                             eDVBFrontendParametersSatellite.
                             Polarisation_Vertical))
                    if stop > band_cutoff_frequency:
                        self.range_list.append(
                            (max(band_cutoff_frequency,
                                 start), stop, eDVBFrontendParametersSatellite.
                             Polarisation_Vertical))
                else:
                    self.range_list.append((
                        start, stop,
                        eDVBFrontendParametersSatellite.Polarisation_Vertical))

            self.parm = self.setNextRange()
            if self.parm is not None:
                tparm = eDVBFrontendParameters()
                tparm.setDVBS(self.parm, False)
                self.frontend.tune(tparm)
                self.start_time = time()
                tmpstr = _("Try to find used satellite transponders...")
            else:
                tmpstr = _("Nothing to scan! Press Exit!")
            x = {}
            data = self.frontend.getFrontendData(x)
            tuner_no = x["tuner_number"]
        else:
            if "Sundtek DVB-S/S2" in tunername and "V" in tunername:
                tmpstr = _("Use Sundtek full hardware blind scan!")
            else:
                tmpstr = _(
                    "Dreambox blind scan is not supported by this tuner (%s)!"
                ) % tunername
            self.session.open(MessageBox, tmpstr, MessageBox.TYPE_ERROR)
            return
        self.satellite_search_session = self.session.openWithCallback(
            self.satelliteTransponderSearchSessionClosed, SatBlindscanState,
            tuner_no, tmpstr)
        #if self.auto_scan:
        self.timer = eTimer()
        self.timer.callback.append(self.updateStateSat)
        self.timer.stop()
        self.updateStateSat()
コード例 #9
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
コード例 #10
0
	def startSatelliteTransponderSearch(self, nim_idx, orb_pos):
		if hasattr(self, 'self.frontend'):
			del self.frontend
		if hasattr(self, 'self.channel'):
			del self.channel
		self.frontend = self.channel = None
		self.orb_pos = orb_pos
		self.nim = nimmanager.nim_slots[nim_idx]
		tunername = nimmanager.getNimName(nim_idx)
		self.__tlist = [ ]
		self.tp_found = [ ]
		self.current_range = None
		self.range_list = [ ]
		tuner_no = -1
		self.auto_scan = False

		print "tunername", tunername
		if tunername in ("BCM4505", "BCM4506 (internal)", "BCM4506", "Alps BSBE1 C01A/D01A.", "Si2166B"):
			self.auto_scan = tunername == 'Si2166B'
			(self.channel, self.frontend) = self.tryGetRawFrontend(nim_idx, False, False)
			if not self.frontend:
				self.session.nav.stopService()
				(self.channel, self.frontend) = self.tryGetRawFrontend(nim_idx, False, False)
				if not self.frontend:
					if self.session.pipshown:
						if hasattr(self.session, 'infobar'):
							try:
								slist = self.session.infobar.servicelist
								if slist and slist.dopipzap:
									slist.togglePipzap()
							except:
								pass
						self.session.pipshown = False
						if hasattr(self.session, 'pip'):
							del self.session.pip
					(self.channel, self.frontend) = self.tryGetRawFrontend(nim_idx, False, False)
					if not self.frontend:
						print "couldn't allocate tuner %d for blindscan!!!" %nim_idx
						text = _("Sorry, this tuner is in use.")
						if self.session.nav.getRecordings():
							text += "\n"
							text += _("Maybe the reason that recording is currently running.")
						self.session.open(MessageBox, text, MessageBox.TYPE_ERROR)
						return

			band_cutoff_frequency = 11700000

			s1 = self.scan_sat.bs_freq_start.value * 1000
			s2 = self.scan_sat.bs_freq_stop.value * 1000

			start = self.min_freq = min(s1,s2)
			stop = self.max_freq = max(s1,s2)

			if self.auto_scan: # hack for driver based blindscan... extend search range +/- 50Mhz
				limits = self.scan_sat.bs_freq_limits
				start -= 50000
				stop += 50000
				if start < limits[0]:
					start = limits[0]
				if stop >limits[1]:
					stop = limits[1]

			if self.scan_sat.bs_horizontal.value:
				if self.auto_scan and band_cutoff_frequency and stop > band_cutoff_frequency:
					if start < band_cutoff_frequency:
						self.range_list.append((start, min(stop, band_cutoff_frequency), eDVBFrontendParametersSatellite.Polarisation_Horizontal))
					if stop > band_cutoff_frequency:
						self.range_list.append((max(band_cutoff_frequency, start), stop, eDVBFrontendParametersSatellite.Polarisation_Horizontal))
				else:
					self.range_list.append((start, stop, eDVBFrontendParametersSatellite.Polarisation_Horizontal))

			if self.scan_sat.bs_vertical.value:
				if self.auto_scan and band_cutoff_frequency:
					if start < band_cutoff_frequency:
						self.range_list.append((start, min(stop, band_cutoff_frequency), eDVBFrontendParametersSatellite.Polarisation_Vertical))
					if stop > band_cutoff_frequency:
						self.range_list.append((max(band_cutoff_frequency, start), stop, eDVBFrontendParametersSatellite.Polarisation_Vertical))
				else:
					self.range_list.append((start, stop, eDVBFrontendParametersSatellite.Polarisation_Vertical))

			self.parm = self.setNextRange()
			if self.parm is not None:
				tparm = eDVBFrontendParameters()
				tparm.setDVBS(self.parm, False)
				self.frontend.tune(tparm)
				self.start_time = time()
				tmpstr = _("Try to find used satellite transponders...")
			else:
				tmpstr = _("Nothing to scan! Press Exit!")
			x = { }
			data = self.frontend.getFrontendData(x)
			tuner_no = x["tuner_number"]
		else:
			if "Sundtek DVB-S/S2" in tunername and "V" in tunername:
				tmpstr = _("Use Sundtek full hardware blind scan!")
			else:
				tmpstr = _("Dreambox blind scan is not supported by this tuner (%s)!") % tunername
			self.session.open(MessageBox, tmpstr, MessageBox.TYPE_ERROR)
			return
		self.satellite_search_session = self.session.openWithCallback(self.satelliteTransponderSearchSessionClosed, SatBlindscanState, tuner_no, tmpstr)
		#if self.auto_scan:
		self.timer = eTimer()
		self.timer.callback.append(self.updateStateSat)
		self.timer.stop()
		self.updateStateSat()
コード例 #11
0
ファイル: info.py プロジェクト: diglam/enigma2pc
def getInfo():
    # TODO: get webif versione somewhere!
    info = {}

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

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

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

    info['chipset'] = chipset

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

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

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

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

    info['fp_version'] = getFPVersion()

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

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

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

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

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

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

        info['hdd'].append({
            "model": hdd.model(),
            "capacity": size,
            "labelled_capacity": iecsize,
            "free": free
        })
    global STATICBOXINFO
    STATICBOXINFO = info
    return info
コード例 #12
0
    def startSatelliteTransponderSearch(self, nim_idx, orb_pos):
        self.frontend = None
        self.orb_pos = orb_pos
        self.nim = nimmanager.nim_slots[nim_idx]
        tunername = nimmanager.getNimName(nim_idx)
        self.__tlist = []
        self.tp_found = []
        self.current_range = None
        self.range_list = []
        tuner_no = -1
        self.auto_scan = False
        self.timer = eTimer()
        self.timer.callback.append(self.updateStateSat)

        print "tunername", tunername
        if tunername in ("BCM4505", "BCM4506 (internal)", "BCM4506",
                         "Alps BSBE1 C01A/D01A.", "Si2166B", "Si2169C"):
            self.auto_scan = tunername == 'Si2166B' or tunername == 'Si2169C'
            (self.channel,
             self.frontend) = self.tryGetRawFrontend(nim_idx, False, False)
            if not self.frontend:
                self.session.nav.stopService()
                (self.channel, self.frontend) = self.tryGetRawFrontend(
                    nim_idx, False, False)
                if not self.frontend:
                    if self.session.pipshown:  # try to disable pip
                        self.session.pipshown = False
                        self.session.deleteDialog(self.session.pip)
                        del self.session.pip
                    (self.channel, self.frontend) = self.tryGetRawFrontend(
                        nim_idx, False, False)
                    if not self.frontend:
                        print "couldn't allocate tuner %d for blindscan!!!" % nim_idx
                        return


#			self.frontend.getStateChangeSignal().append(self.frontendStateChanged)

            band_cutoff_frequency = self.nim_sat_band_cutoff_frequency[
                nim_idx][orb_pos][0]

            s1 = self.scan_sat.bs_freq_start.value * 1000
            s2 = self.scan_sat.bs_freq_stop.value * 1000

            start = self.min_freq = min(s1, s2)
            stop = self.max_freq = max(s1, s2)

            if self.auto_scan:  # hack for driver based blindscan... extend search range +/- 50MHz
                limits = self.scan_sat.bs_freq_limits
                start -= 50000
                stop += 50000
                if start < limits[0]:
                    start = limits[0]
                if stop > limits[1]:
                    stop = limits[1]

            if self.scan_sat.bs_horizontal.value:
                if self.auto_scan and band_cutoff_frequency and stop > band_cutoff_frequency:
                    if start < band_cutoff_frequency:
                        self.range_list.append(
                            (start, min(stop, band_cutoff_frequency),
                             eDVBFrontendParametersSatellite.
                             Polarisation_Horizontal))
                    if stop > band_cutoff_frequency:
                        self.range_list.append(
                            (max(band_cutoff_frequency,
                                 start), stop, eDVBFrontendParametersSatellite.
                             Polarisation_Horizontal))
                else:
                    self.range_list.append(
                        (start, stop, eDVBFrontendParametersSatellite.
                         Polarisation_Horizontal))

            if self.scan_sat.bs_vertical.value:
                if self.auto_scan and band_cutoff_frequency:
                    if start < band_cutoff_frequency:
                        self.range_list.append(
                            (start, min(stop, band_cutoff_frequency),
                             eDVBFrontendParametersSatellite.
                             Polarisation_Vertical))
                    if stop > band_cutoff_frequency:
                        self.range_list.append(
                            (max(band_cutoff_frequency,
                                 start), stop, eDVBFrontendParametersSatellite.
                             Polarisation_Vertical))
                else:
                    self.range_list.append((
                        start, stop,
                        eDVBFrontendParametersSatellite.Polarisation_Vertical))

            self.parm = self.setNextRange()
            if self.parm is not None:
                tparm = eDVBFrontendParameters()
                tparm.setDVBS(self.parm, False)
                self.frontend.tune(tparm)
                self.start_time = time()
                tmpstr = _("Try to find used satellite transponders...")
            else:
                tmpstr = _("Nothing to scan! Press Exit!")
            x = {}
            data = self.frontend.getFrontendData(x)
            tuner_no = x["tuner_number"]
            self.updateStateSat()
        else:
            tmpstr = _(
                "Blindscan is not supported by this tuner (%s)") % tunername
        self.satellite_search_session = self.session.openWithCallback(
            self.satelliteTransponderSearchSessionClosed, SatBlindscanState,
            tuner_no, tmpstr)
コード例 #13
0
ファイル: e2info.py プロジェクト: 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
コード例 #14
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
コード例 #15
0
ファイル: oeainfo.py プロジェクト: Temporalis/OpenStore
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
コード例 #16
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
コード例 #17
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
コード例 #18
0
ファイル: ScanSetup.py プロジェクト: regin92/enigma2
	def startCableTransponderSearch(self, nim_idx):
		def GetCommand(nimIdx):
			_supportNimType   = { 'SSH108':'ssh108' }
			_nimSocket = {}
			fp = file('/proc/bus/nim_sockets')

			sNo, sName = -1, ""
			for line in fp:
				line = line.strip()
				if line.startswith('NIM Socket'):
					try:	sNo = line.split()[2][:-1]
					except: sNo = -1
				elif line.startswith('Name:'):
					try:	sName = line.split()[3][4:-1]
					except: sName = ""
				if sNo >= 0 and sName != "":
					_nimSocket[sNo] = sName
					sNo, sName = -1, ''
			fp.close()
			print 'parsed nim_sockets :', _nimSocket

			try:
				sName = _nimSocket[str(nimIdx)]
				sType = _supportNimType[sName]
				return sType
			except: pass
			return 'tda1002x'

		if not self.tryGetRawFrontend(nim_idx):
			self.session.nav.stopService()
			if not self.tryGetRawFrontend(nim_idx):
				if self.session.pipshown: # try to disable pip
					self.session.pipshown = False
					del self.session.pip
				if not self.tryGetRawFrontend(nim_idx):
					self.cableTransponderSearchFinished()
					return
		self.__tlist = [ ]
		self.remainingdata = ""
		self.cable_search_container = eConsoleAppContainer()
		self.cable_search_container.appClosed.append(self.cableTransponderSearchClosed)
		self.cable_search_container.dataAvail.append(self.getCableTransponderData)
		cableConfig = config.Nims[nim_idx].cable
		tunername = nimmanager.getNimName(nim_idx)
		try:
			bus = nimmanager.getI2CDevice(nim_idx)
			if bus is None:
				print "ERROR: could not get I2C device for nim", nim_idx, "for cable transponder search"
				bus = 2
		except:
			# older API
			if nim_idx < 2:
				if HardwareInfo().get_device_name() == "dm500hd":
					bus = 2
				else:
					bus = nim_idx
			else:
				if nim_idx == 2:
					bus = 2 # DM8000 first nim is /dev/i2c/2
				else:
					bus = 4 # DM8000 second num is /dev/i2c/4

		if tunername == "CXD1981":
			cmd = "cxd1978 --init --scan --verbose --wakeup --inv 2 --bus %d" % bus
		elif tunername.startswith("Sundtek"):
			cmd = "mediaclient --blindscan %d" % nim_idx
		else:
			bin_name = GetCommand(nim_idx)
			cmd = "%(BIN_NAME)s --init --scan --verbose --wakeup --inv 2 --bus %(BUS)d" % {'BIN_NAME':bin_name , 'BUS':bus}

		if cableConfig.scan_type.getValue() == "bands":
			cmd += " --scan-bands "
			bands = 0
			if cableConfig.scan_band_EU_VHF_I.getValue():
				bands |= cable_bands["DVBC_BAND_EU_VHF_I"]
			if cableConfig.scan_band_EU_MID.getValue():
				bands |= cable_bands["DVBC_BAND_EU_MID"]
			if cableConfig.scan_band_EU_VHF_III.getValue():
				bands |= cable_bands["DVBC_BAND_EU_VHF_III"]
			if cableConfig.scan_band_EU_UHF_IV.getValue():
				bands |= cable_bands["DVBC_BAND_EU_UHF_IV"]
			if cableConfig.scan_band_EU_UHF_V.getValue():
				bands |= cable_bands["DVBC_BAND_EU_UHF_V"]
			if cableConfig.scan_band_EU_SUPER.getValue():
				bands |= cable_bands["DVBC_BAND_EU_SUPER"]
			if cableConfig.scan_band_EU_HYPER.getValue():
				bands |= cable_bands["DVBC_BAND_EU_HYPER"]
			if cableConfig.scan_band_US_LOW.getValue():
				bands |= cable_bands["DVBC_BAND_US_LO"]
			if cableConfig.scan_band_US_MID.getValue():
				bands |= cable_bands["DVBC_BAND_US_MID"]
			if cableConfig.scan_band_US_HIGH.getValue():
				bands |= cable_bands["DVBC_BAND_US_HI"]
			if cableConfig.scan_band_US_SUPER.getValue():
				bands |= cable_bands["DVBC_BAND_US_SUPER"]
			if cableConfig.scan_band_US_HYPER.getValue():
				bands |= cable_bands["DVBC_BAND_US_HYPER"]
			cmd += str(bands)
		else:
			cmd += " --scan-stepsize "
			cmd += str(cableConfig.scan_frequency_steps.getValue())
		if cableConfig.scan_mod_qam16.getValue():
			cmd += " --mod 16"
		if cableConfig.scan_mod_qam32.getValue():
			cmd += " --mod 32"
		if cableConfig.scan_mod_qam64.getValue():
			cmd += " --mod 64"
		if cableConfig.scan_mod_qam128.getValue():
			cmd += " --mod 128"
		if cableConfig.scan_mod_qam256.getValue():
			cmd += " --mod 256"
		if cableConfig.scan_sr_6900.getValue():
			cmd += " --sr 6900000"
		if cableConfig.scan_sr_6875.getValue():
			cmd += " --sr 6875000"
		if cableConfig.scan_sr_ext1.getValue() > 450:
			cmd += " --sr "
			cmd += str(cableConfig.scan_sr_ext1.getValue())
			cmd += "000"
		if cableConfig.scan_sr_ext2.getValue() > 450:
			cmd += " --sr "
			cmd += str(cableConfig.scan_sr_ext2.getValue())
			cmd += "000"
		print bin_name, " CMD is", cmd

		self.cable_search_container.execute(cmd)
		tmpstr = _("Try to find used transponders in cable network.. please wait...")
		tmpstr += "\n\n..."
		self.cable_search_session = self.session.openWithCallback(self.cableTransponderSearchSessionClosed, MessageBox, tmpstr, MessageBox.TYPE_INFO)
コード例 #19
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
コード例 #20
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
コード例 #21
0
	def startCableTransponderSearch(self, nim_idx):
		if not self.tryGetRawFrontend(nim_idx):
			self.session.nav.stopService()
			if not self.tryGetRawFrontend(nim_idx):
				if self.session.pipshown: # try to disable pip
					self.session.pipshown = False
					del self.session.pip
				if not self.tryGetRawFrontend(nim_idx):
					self.cableTransponderSearchFinished()
					return
		self.__tlist = [ ]
		self.remainingdata = ""
		self.cable_search_container = eConsoleAppContainer()
		self.cable_search_container.appClosed.append(self.cableTransponderSearchClosed)
		self.cable_search_container.dataAvail.append(self.getCableTransponderData)
		cableConfig = config.Nims[nim_idx].cable
		tunername = nimmanager.getNimName(nim_idx)
		try:
			bus = nimmanager.getI2CDevice(nim_idx)
			if bus is None:
				print "ERROR: could not get I2C device for nim", nim_idx, "for cable transponder search"
				bus = 2
		except:
			# older API
			if nim_idx < 2:
				if HardwareInfo().get_device_name() == "dm500hd":
					bus = 2
				else:
					bus = nim_idx
			else:
				if nim_idx == 2:
					bus = 2 # DM8000 first nim is /dev/i2c/2
				else:
					bus = 4 # DM8000 second num is /dev/i2c/4

		if tunername == "CXD1981":
			cmd = "cxd1978 --init --scan --verbose --wakeup --inv 2 --bus %d" % bus
		elif tunername.startswith("Sundtek"):
			cmd = "mediaclient --blindscan %d" % nim_idx
		else:
			cmd = "tda1002x --init --scan --verbose --wakeup --inv 2 --bus %d" % bus

		if cableConfig.scan_type.getValue() == "bands":
			cmd += " --scan-bands "
			bands = 0
			if cableConfig.scan_band_EU_VHF_I.getValue():
				bands |= cable_bands["DVBC_BAND_EU_VHF_I"]
			if cableConfig.scan_band_EU_MID.getValue():
				bands |= cable_bands["DVBC_BAND_EU_MID"]
			if cableConfig.scan_band_EU_VHF_III.getValue():
				bands |= cable_bands["DVBC_BAND_EU_VHF_III"]
			if cableConfig.scan_band_EU_UHF_IV.getValue():
				bands |= cable_bands["DVBC_BAND_EU_UHF_IV"]
			if cableConfig.scan_band_EU_UHF_V.getValue():
				bands |= cable_bands["DVBC_BAND_EU_UHF_V"]
			if cableConfig.scan_band_EU_SUPER.getValue():
				bands |= cable_bands["DVBC_BAND_EU_SUPER"]
			if cableConfig.scan_band_EU_HYPER.getValue():
				bands |= cable_bands["DVBC_BAND_EU_HYPER"]
			if cableConfig.scan_band_US_LOW.getValue():
				bands |= cable_bands["DVBC_BAND_US_LO"]
			if cableConfig.scan_band_US_MID.getValue():
				bands |= cable_bands["DVBC_BAND_US_MID"]
			if cableConfig.scan_band_US_HIGH.getValue():
				bands |= cable_bands["DVBC_BAND_US_HI"]
			if cableConfig.scan_band_US_SUPER.getValue():
				bands |= cable_bands["DVBC_BAND_US_SUPER"]
			if cableConfig.scan_band_US_HYPER.getValue():
				bands |= cable_bands["DVBC_BAND_US_HYPER"]
			cmd += str(bands)
		else:
			cmd += " --scan-stepsize "
			cmd += str(cableConfig.scan_frequency_steps.getValue())
		if cableConfig.scan_mod_qam16.getValue():
			cmd += " --mod 16"
		if cableConfig.scan_mod_qam32.getValue():
			cmd += " --mod 32"
		if cableConfig.scan_mod_qam64.getValue():
			cmd += " --mod 64"
		if cableConfig.scan_mod_qam128.getValue():
			cmd += " --mod 128"
		if cableConfig.scan_mod_qam256.getValue():
			cmd += " --mod 256"
		if cableConfig.scan_sr_6900.getValue():
			cmd += " --sr 6900000"
		if cableConfig.scan_sr_6875.getValue():
			cmd += " --sr 6875000"
		if cableConfig.scan_sr_ext1.getValue() > 450:
			cmd += " --sr "
			cmd += str(cableConfig.scan_sr_ext1.getValue())
			cmd += "000"
		if cableConfig.scan_sr_ext2.getValue() > 450:
			cmd += " --sr "
			cmd += str(cableConfig.scan_sr_ext2.getValue())
			cmd += "000"
		print "TDA1002x CMD is", cmd

		self.cable_search_container.execute(cmd)
		tmpstr = _("Try to find used transponders in cable network.. please wait...")
		tmpstr += "\n\n..."
		self.cable_search_session = self.session.openWithCallback(self.cableTransponderSearchSessionClosed, MessageBox, tmpstr, MessageBox.TYPE_INFO)
コード例 #22
0
	def startSatelliteTransponderSearch(self):
		self.releaseFrontend()
		self.nim = nimmanager.nim_slots[self.feid]
		tunername = nimmanager.getNimName(self.feid)
		self.__tlist = []
		self.tp_found = []
		self.current_range = None
		self.range_list = [] # contains tuples, (start, stop, polarisation), max length 4, i.e. 4 sub-bands
		tuner_no = -1
		self.auto_scan = False

		print("[dmmBlindscan][startSatelliteTransponderSearch] tunername", tunername)
		if nimmanager.nim_slots[self.feid].supportsBlindScan() or tunername in ("BCM4505", "BCM4506 (internal)", "BCM4506", "Alps BSBE1 C01A/D01A.", "Si2166B", "Si2169C"):
			self.auto_scan = nimmanager.nim_slots[self.feid].supportsBlindScan() or tunername in ("Si2166B", "Si2169C")
			if not self.prepareFrontend():
				print("[dmmBlindscan][startSatelliteTransponderSearch] couldn't allocate tuner %d for blindscan!" % self.feid)
				text = _("Sorry, this tuner is in use.")
				if self.session.nav.getRecordings():
					text += _("\nA recording is in progress.")
				self.session.open(MessageBox, text, MessageBox.TYPE_ERROR)
				return

			band_cutoff_frequency = 11700001

			s1 = self.dmmBlindscan.freq_start.value * 1000
			s2 = self.dmmBlindscan.freq_stop.value * 1000

			start = min(s1, s2)
			stop = max(s1, s2)

			if self.auto_scan: # hack for driver based blindscan... extend search range +/- 50Mhz
				freq_limits = list(map(lambda x: x * 1000, self.freq_limits))
				start -= 50000
				stop += 50000
				if start < freq_limits[0]:
					start = freq_limits[0]
				if stop > freq_limits[1]:
					stop = freq_limits[1]

			pols = {eDVBFrontendParametersSatellite.Polarisation_Horizontal: "horizontal", eDVBFrontendParametersSatellite.Polarisation_Vertical: "vertical"}
			for pol in (eDVBFrontendParametersSatellite.Polarisation_Vertical, eDVBFrontendParametersSatellite.Polarisation_Horizontal):
				if pols[pol] in self.dmmBlindscan.polarization.value:
					if self.auto_scan:
						pol or self.range_list.append((start, min(stop, start + 5000), pol)) # hack alert, this is crap and should not be here, but scan misses a lot of services without it.
						if start < band_cutoff_frequency:
							self.range_list.append((start, min(stop, band_cutoff_frequency - 1), pol))
						if stop > band_cutoff_frequency:
							self.range_list.append((max(band_cutoff_frequency, start), stop, pol))
					else:
						self.range_list.append((start, stop, pol))

#			if self.dmmBlindscan.multiple_scan.value > 1:
#				self.range_list = [self.range_list[i//self.dmmBlindscan.multiple_scan.value] for i in range(len(self.range_list)*self.dmmBlindscan.multiple_scan.value)]

			print("[dmmBlindscan][startSatelliteTransponderSearch] self.range_list", self.range_list)

			self.parm = self.setNextRange()
			if self.parm is not None:
				tparm = eDVBFrontendParameters()
				tparm.setDVBS(self.parm, False)
				self.frontend.tune(tparm, True)
				self.start_time = time()
				tmpstr = _("Searching for active satellite transponders...")
			else:
				tmpstr = _("Nothing to scan! Press Exit!")
			x = {}
			data = self.frontend.getFrontendData(x)
			tuner_no = x["tuner_number"]
		else:
			if "Sundtek DVB-S/S2" in tunername and "V" in tunername:
				tmpstr = _("Use Sundtek full hardware blind scan!")
			else:
				tmpstr = _("Hardware blind scan is not supported by this tuner (%s)!") % tunername
			self.session.open(MessageBox, tmpstr, MessageBox.TYPE_ERROR)
			return
		self.satellite_search_session = self.session.openWithCallback(self.satelliteTransponderSearchSessionClosed, DmmBlindscanState, tuner_no, tmpstr)
		#if self.auto_scan:
		self.timer = eTimer()
		self.timer.callback.append(self.updateStateSat)
		self.timer.stop()
		self.updateStateSat()
コード例 #23
0
ファイル: info.py プロジェクト: OpenLD/e2openplugin-OpenWebif
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
コード例 #24
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
コード例 #25
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
コード例 #26
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/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
コード例 #27
0
ファイル: e2info.py プロジェクト: Open-Plus/MetrixHD
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
コード例 #28
0
ファイル: info.py プロジェクト: rommalyshev/PITERKADET-DEPO
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
コード例 #29
0
ファイル: info.py プロジェクト: MOA-2011/e2openplugins
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
コード例 #30
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
コード例 #31
0
ファイル: info.py プロジェクト: betz/e2openplugin-OpenWebif
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
コード例 #32
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
コード例 #33
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
コード例 #34
0
	def startCableTransponderSearch(self, nim_idx):
		if not self.tryGetRawFrontend(nim_idx):
			self.session.nav.stopService()
			if not self.tryGetRawFrontend(nim_idx):
				if self.session.pipshown: # try to disable pip
					self.session.pipshown = False
					del self.session.pip
				if not self.tryGetRawFrontend(nim_idx):
					self.cableTransponderSearchFinished()
					return
		self.__tlist = [ ]
		self.remainingdata = ""
		self.cable_search_container = eConsoleAppContainer()
		self.cable_search_container.appClosed.append(self.cableTransponderSearchClosed)
		self.cable_search_container.dataAvail.append(self.getCableTransponderData)
		cableConfig = config.Nims[nim_idx].cable
		tunername = nimmanager.getNimName(nim_idx)
		try:
			bus = nimmanager.getI2CDevice(nim_idx)
			if bus is None:
				print "ERROR: could not get I2C device for nim", nim_idx, "for cable transponder search"
				bus = 2
		except:
			# older API
			if nim_idx < 2:
				if HardwareInfo().get_device_name() == "dm500hd":
					bus = 2
				else:
					bus = nim_idx
			else:
				if nim_idx == 2:
					bus = 2 # DM8000 first nim is /dev/i2c/2
				else:
					bus = 4 # DM8000 second num is /dev/i2c/4

		if tunername == "CXD1981":
			cmd = "cxd1978 --init --scan --verbose --wakeup --inv 2 --bus %d" % bus
		else:
			cmd = "tda1002x --init --scan --verbose --wakeup --inv 2 --bus %d" % bus
		
		if cableConfig.scan_type.value == "bands":
			cmd += " --scan-bands "
			bands = 0
			if cableConfig.scan_band_EU_VHF_I.value:
				bands |= cable_bands["DVBC_BAND_EU_VHF_I"]
			if cableConfig.scan_band_EU_MID.value:
				bands |= cable_bands["DVBC_BAND_EU_MID"]
			if cableConfig.scan_band_EU_VHF_III.value:
				bands |= cable_bands["DVBC_BAND_EU_VHF_III"]
			if cableConfig.scan_band_EU_UHF_IV.value:
				bands |= cable_bands["DVBC_BAND_EU_UHF_IV"]
			if cableConfig.scan_band_EU_UHF_V.value:
				bands |= cable_bands["DVBC_BAND_EU_UHF_V"]
			if cableConfig.scan_band_EU_SUPER.value:
				bands |= cable_bands["DVBC_BAND_EU_SUPER"]
			if cableConfig.scan_band_EU_HYPER.value:
				bands |= cable_bands["DVBC_BAND_EU_HYPER"]
			if cableConfig.scan_band_US_LOW.value:
				bands |= cable_bands["DVBC_BAND_US_LO"]
			if cableConfig.scan_band_US_MID.value:
				bands |= cable_bands["DVBC_BAND_US_MID"]
			if cableConfig.scan_band_US_HIGH.value:
				bands |= cable_bands["DVBC_BAND_US_HI"]
			if cableConfig.scan_band_US_SUPER.value:
				bands |= cable_bands["DVBC_BAND_US_SUPER"]
			if cableConfig.scan_band_US_HYPER.value:
				bands |= cable_bands["DVBC_BAND_US_HYPER"]
			cmd += str(bands)
		else:
			cmd += " --scan-stepsize "
			cmd += str(cableConfig.scan_frequency_steps.value)
		if cableConfig.scan_mod_qam16.value:
			cmd += " --mod 16"
		if cableConfig.scan_mod_qam32.value:
			cmd += " --mod 32"
		if cableConfig.scan_mod_qam64.value:
			cmd += " --mod 64"
		if cableConfig.scan_mod_qam128.value:
			cmd += " --mod 128"
		if cableConfig.scan_mod_qam256.value:
			cmd += " --mod 256"
		if cableConfig.scan_sr_6900.value:
			cmd += " --sr 6900000"
		if cableConfig.scan_sr_6875.value:
			cmd += " --sr 6875000"
		if cableConfig.scan_sr_ext1.value > 450:
			cmd += " --sr "
			cmd += str(cableConfig.scan_sr_ext1.value)
			cmd += "000"
		if cableConfig.scan_sr_ext2.value > 450:
			cmd += " --sr "
			cmd += str(cableConfig.scan_sr_ext2.value)
			cmd += "000"
		print "TDA1002x CMD is", cmd

		self.cable_search_container.execute(cmd)
		tmpstr = _("Try to find used transponders in cable network.. please wait...")
		tmpstr += "\n\n..."
		self.cable_search_session = self.session.openWithCallback(self.cableTransponderSearchSessionClosed, MessageBox, tmpstr, MessageBox.TYPE_INFO)
コード例 #35
0
ファイル: plugin.py プロジェクト: Dima73/oe-alliance-plugins
	def startSatelliteTransponderSearch(self, nim_idx, orb_pos):
		self.frontend = None
		self.orb_pos = orb_pos
		self.nim = nimmanager.nim_slots[nim_idx]
		tunername = nimmanager.getNimName(nim_idx)
		self.__tlist = [ ]
		self.tp_found = [ ]
		self.current_range = None
		self.range_list = [ ]
		tuner_no = -1
		self.auto_scan = False
		self.timer = eTimer()
		self.timer.callback.append(self.updateStateSat)

		print "tunername", tunername
		if tunername in ("BCM4505", "BCM4506 (internal)", "BCM4506", "Alps BSBE1 C01A/D01A.", "Si2166B", "Si2169C"):
			self.auto_scan = tunername == 'Si2166B' or tunername == 'Si2169C'
			(self.channel, self.frontend) = self.tryGetRawFrontend(nim_idx, False, False)
			if not self.frontend:
				self.session.nav.stopService()
				(self.channel, self.frontend) = self.tryGetRawFrontend(nim_idx, False, False)
				if not self.frontend:
					if self.session.pipshown: # try to disable pip
						self.session.pipshown = False
	                                        self.session.deleteDialog(self.session.pip)
						del self.session.pip
					(self.channel, self.frontend) = self.tryGetRawFrontend(nim_idx, False, False)
					if not self.frontend:
						print "couldn't allocate tuner %d for blindscan!!!" %nim_idx
						return
#			self.frontend.getStateChangeSignal().append(self.frontendStateChanged)

			band_cutoff_frequency = self.nim_sat_band_cutoff_frequency[nim_idx][orb_pos][0]

			s1 = self.scan_sat.bs_freq_start.value * 1000
			s2 = self.scan_sat.bs_freq_stop.value * 1000

			start = self.min_freq = min(s1,s2)
			stop = self.max_freq = max(s1,s2)

			if self.auto_scan: # hack for driver based blindscan... extend search range +/- 50MHz
				limits = self.scan_sat.bs_freq_limits
				start -= 50000
				stop += 50000
				if start < limits[0]:
					start = limits[0]
				if stop >limits[1]:
					stop = limits[1]

			if self.scan_sat.bs_horizontal.value:
				if self.auto_scan and band_cutoff_frequency and stop > band_cutoff_frequency:
					if start < band_cutoff_frequency:
						self.range_list.append((start, min(stop, band_cutoff_frequency), eDVBFrontendParametersSatellite.Polarisation_Horizontal))
					if stop > band_cutoff_frequency:
						self.range_list.append((max(band_cutoff_frequency, start), stop, eDVBFrontendParametersSatellite.Polarisation_Horizontal))
				else:
					self.range_list.append((start, stop, eDVBFrontendParametersSatellite.Polarisation_Horizontal))

			if self.scan_sat.bs_vertical.value:
				if self.auto_scan and band_cutoff_frequency:
					if start < band_cutoff_frequency:
						self.range_list.append((start, min(stop, band_cutoff_frequency), eDVBFrontendParametersSatellite.Polarisation_Vertical))
					if stop > band_cutoff_frequency:
						self.range_list.append((max(band_cutoff_frequency, start), stop, eDVBFrontendParametersSatellite.Polarisation_Vertical))
				else:
					self.range_list.append((start, stop, eDVBFrontendParametersSatellite.Polarisation_Vertical))

			self.parm = self.setNextRange()
			if self.parm is not None:
				tparm = eDVBFrontendParameters()
				tparm.setDVBS(self.parm, False)
				self.frontend.tune(tparm)
				self.start_time = time()
				tmpstr = _("Try to find used satellite transponders...")
			else:
				tmpstr = _("Nothing to scan! Press Exit!")
			x = { }
			data = self.frontend.getFrontendData(x)
			tuner_no = x["tuner_number"]
			self.updateStateSat()
		else:
			tmpstr = _("Blindscan is not supported by this tuner (%s)") %tunername
		self.satellite_search_session = self.session.openWithCallback(self.satelliteTransponderSearchSessionClosed, SatBlindscanState, tuner_no, tmpstr)