Example #1
0
	def box(self):
		box = getBoxType()
		machinename = getMachineName()
		if box in ('uniboxhd1', 'uniboxhd2', 'uniboxhd3'):
			box = "ventonhdx"
		elif box == "odinm6":
			box = getMachineName().lower()
		elif box == "xpeedlx3":
			box = "xpeedlx3"
		elif box == "xpeedlx1" or box == "xpeedlx2":
			box = "xpeedlx"
		elif box == "inihde" and machinename.lower() == "hd-1000":
			box = "sezam-1000hd"
		elif box == "ventonhdx" and machinename.lower() == "hd-5000":
			box = "sezam-5000hd"
		elif box == "ventonhdx" and machinename.lower() == "premium twin":
			box = "miraclebox-twin"
		elif box == "xp1000" and machinename.lower() == "sf8 hd":
			box = "sf8"
		elif box.startswith('et') and not box in ('et8000', 'et8500', 'et10000'):
			box = box[0:3] + 'x00'
		elif box == "odinm9":
			box = 'maram9'
		elif box == "dm525":
			box = 'dm520'
		return box
Example #2
0
def GetBoxName():
	box = getBoxType()
	machinename = getMachineName()
	if box in ('uniboxhd1', 'uniboxhd2', 'uniboxhd3'):
		box = "ventonhdx"
	elif box == 'odinm6':
		box = getMachineName().lower()
	elif box == "inihde" and machinename.lower() == "xpeedlx":
		box = "xpeedlx"
	elif box in ('xpeedlx1', 'xpeedlx2'):
		box = "xpeedlx"
	elif box == "inihde" and machinename.lower() == "hd-1000":
		box = "sezam-1000hd"
	elif box == "ventonhdx" and machinename.lower() == "hd-5000":
		box = "sezam-5000hd"
	elif box == "ventonhdx" and machinename.lower() == "premium twin":
		box = "miraclebox-twin"
	elif box == "xp1000" and machinename.lower() == "sf8 hd":
		box = "sf8"
	elif box.startswith('et') and not box in ('et8000', 'et8500', 'et8500s', 'et10000'):
		box = box[0:3] + 'x00'
	elif box == 'odinm9':
		box = 'maram9'
	elif box.startswith('sf8008'):
		box = "sf8008"
	return box
Example #3
0
	def __init__(self, session, retvalue=1):
		self.skin = """<screen name="QuitMainloopScreen" position="fill" flags="wfNoBorder">
				<ePixmap pixmap="icons/input_info.png" position="c-27,c-60" size="53,53" alphatest="on" />
				<widget name="text" position="center,c+5" size="720,100" font="Regular;22" halign="center" />
			</screen>"""
		Screen.__init__(self, session)
		from Components.Label import Label

		text = { 1: _("Your %s %s is shutting down") % (getMachineBrand(), getMachineName()),
			2: _("Your %s %s is rebooting") % (getMachineBrand(), getMachineName()),
			3: _("The user interface of your %s %s is restarting") % (getMachineBrand(), getMachineName()),
			4: _("Your front processor will be upgraded\nPlease wait until your %s %s reboots\nThis may take a few minutes") % (getMachineBrand(), getMachineName()),
			5: _("The user interface of your %s %s is restarting\ndue to an error in mytest.py") % (getMachineBrand(), getMachineName()),
			42: _("Upgrade in progress\nPlease wait until your %s %s reboots\nThis may take a few minutes") % (getMachineBrand(), getMachineName()),
			43: _("Reflash in progress\nPlease wait until your %s %s reboots\nThis may take a few minutes") % (getMachineBrand(), getMachineName()),
			44: _("Your front panel will be upgraded\nThis may take a few minutes")}.get(retvalue)
		self["text"] = Label(text)
		
		import os
		text2 = { 1: _("Shutting down"),
			2: _("Rebooting"),
			3: _("GUI restarting"),
			4: _("Front processor upgrade"),
			5: _("GUI restarting"),
			42: _("Upgrading"),
			43: _("Reflashing"),
			44: _("Front panel upgrade")}.get(retvalue)
		cmd = "echo " + text2 + " > /dev/dbox/oled0"
		os.system(cmd)
Example #4
0
 def checkNetworkStateFinished(self, result, retval, extra_args=None):
     if "bad address" in result:
         self.session.openWithCallback(
             self.InstallPackageFailed,
             MessageBox,
             _("Your %s %s is not connected to the internet, please check your network settings and try again.")
             % (getMachineBrand(), getMachineName()),
             type=MessageBox.TYPE_INFO,
             timeout=10,
             close_on_any_key=True,
         )
     elif ("wget returned 1" or "wget returned 255" or "404 Not Found") in result:
         self.session.openWithCallback(
             self.InstallPackageFailed,
             MessageBox,
             _("Sorry feeds are down for maintenance, please try again later."),
             type=MessageBox.TYPE_INFO,
             timeout=10,
             close_on_any_key=True,
         )
     else:
         self.session.openWithCallback(
             self.InstallPackage,
             MessageBox,
             _("Your %s %s will be restarted after the installation of service.\nReady to install %s ?")
             % (getMachineBrand(), getMachineName(), self.service_name),
             MessageBox.TYPE_YESNO,
         )
Example #5
0
	def box(self):
		box = getBoxType()
		machinename = getMachineName()
		if box in ('uniboxhd1', 'uniboxhd2', 'uniboxhd3'):
			box = "ventonhdx"
		elif box == 'odinm6':
			box = getMachineName().lower()
		elif box == "inihde" and machinename.lower() == "xpeedlx":
			box = "xpeedlx"
		elif box in ('xpeedlx1', 'xpeedlx2'):
			box = "xpeedlx"
		elif box == "inihde" and machinename.lower() == "hd-1000":
			box = "sezam-1000hd"
		elif box == "ventonhdx" and machinename.lower() == "hd-5000":
			box = "sezam-5000hd"
		elif box == "ventonhdx" and machinename.lower() == "premium twin":
			box = "miraclebox-twin"
		elif box == "xp1000" and machinename.lower() == "sf8 hd":
			box = "sf8"
		##Formuler not tested yet
		elif box == "formuler1" and machinename.lower() == "formuler1":
			box = "formuler1"
		elif box == "formuler3" and machinename.lower() == "formuler3":
			box = "formuler3"
		elif box.startswith('et') and not box in ('et8000', 'et10000'):
			box = box[0:3] + 'x00'
		elif box == 'odinm9' and self.feed == "nfr":
			box = 'maram9'
		return box
Example #6
0
 def delay(self, val):
     message = _("Changes need a system restart to take effect.\nRestart your %s %s now?") % (
         getMachineBrand(),
         getMachineName(),
     )
     ybox = self.session.openWithCallback(self.restartBox, MessageBox, message, MessageBox.TYPE_YESNO)
     ybox.setTitle(_("Restart %s %s.") % (getMachineBrand(), getMachineName()))
Example #7
0
	def __init__(self, session, retvalue=1, timeout=-1, default_yes = True):
		self.retval = retvalue
		self.ptsmainloopvalue = retvalue
		recordings = session.nav.getRecordings(False,Components.RecordingConfig.recType(config.recording.warn_box_restart_rec_types.getValue()))
		jobs = len(job_manager.getPendingJobs())
		inTimeshift = Screens.InfoBar.InfoBar and Screens.InfoBar.InfoBar.instance and Screens.InfoBar.InfoBar.ptsGetTimeshiftStatus(Screens.InfoBar.InfoBar.instance)
		self.connected = False
		reason = ""
		next_rec_time = -1
		if not recordings:
			next_rec_time = session.nav.RecordTimer.getNextRecordingTime()
#		if jobs:
#			reason = (ngettext("%d job is running in the background!", "%d jobs are running in the background!", jobs) % jobs) + '\n'
#			if jobs == 1:
#				job = job_manager.getPendingJobs()[0]
#				if job.name == "VFD Checker":
#					reason = ""
#				else:
#					reason += "%s: %s (%d%%)\n" % (job.getStatustext(), job.name, int(100*job.progress/float(job.end)))
#			else:
#				reason += (_("%d jobs are running in the background!") % jobs) + '\n'
		if inTimeshift:
			reason = _("You seem to be in timeshift!") + '\n'
			default_yes = True
			timeout=30
		if recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360):
			reason = _("Recording(s) are in progress or coming up in few seconds!") + '\n'
			default_yes = False
			timeout=30

		if reason and inStandby:
			session.nav.record_event.append(self.getRecordEvent)
			self.skinName = ""
		elif reason and not inStandby:
			text = { 1: _("Really shutdown now?"),
				2: _("Really reboot now?"),
				3: _("Really restart now?"),
				4: _("Really upgrade the frontprocessor and reboot now?"),
				9: _("The user interface of your %s %s is restarting") % (getMachineBrand(), getMachineName()),
				16: _("Really reboot into Recovery Mode?"),
				42: _("Really upgrade your %s %s and reboot now?") % (getMachineBrand(), getMachineName()),
				43: _("Really reflash your %s %s and reboot now?") % (getMachineBrand(), getMachineName()),
				44: _("Really upgrade the front panel and reboot now?"),
				45: _("Really WOL now?")}.get(retvalue)
			if text:
				MessageBox.__init__(self, session, reason+text, type = MessageBox.TYPE_YESNO, timeout = timeout, default = default_yes)
				self.skinName = "MessageBoxSimple"
				session.nav.record_event.append(self.getRecordEvent)
				self.connected = True
				self.onShow.append(self.__onShow)
				self.onHide.append(self.__onHide)
				return
		self.skin = """<screen position="1310,0" size="0,0"/>"""
		Screen.__init__(self, session)
		self.close(True)
Example #8
0
 def __init__(self, session):
     Screen.__init__(self, session)
     self.skinName = ['ModelPic', 'About']
     self['key_green'] = Button(_(' '))
     self['key_red'] = Button(_(' '))
     self['key_yellow'] = Button(_(' '))
     self['key_blue'] = Button(_('%s ') % getMachineName() + _('Info'))
     self['model'] = Label(_('%s %s') % (getMachineBrand(), getMachineName()))
     self['boxpic'] = Pixmap()
     self.onFirstExecBegin.append(self.poster_resize)
     self['actions'] = ActionMap(['ColorActions', 'SetupActions', 'DirectionActions'], {'cancel': self.close,
      'ok': self.close,
      'blue': self.close}, -2)
Example #9
0
 def __init__(self, session, retvalue = 1):
     self.skin = '<screen name="QuitMainloopScreen" position="fill" flags="wfNoBorder">\n\t\t\t<ePixmap pixmap="icons/input_info.png" position="c-27,c-60" size="53,53" alphatest="on" />\n\t\t\t<widget name="text" position="center,c+5" size="720,100" font="Regular;22" halign="center" />\n\t\t</screen>'
     Screen.__init__(self, session)
     from Components.Label import Label
     text = {1: _('Your %s %s is shutting down') % (getMachineBrand(), getMachineName()),
      2: _('Your %s %s is rebooting') % (getMachineBrand(), getMachineName()),
      3: _('The user interface of your %s %s is restarting') % (getMachineBrand(), getMachineName()),
      4: _('Your frontprocessor will be upgraded\nPlease wait until your %s %s reboots\nThis may take a few minutes') % (getMachineBrand(), getMachineName()),
      5: _('The user interface of your %s %s is restarting\ndue to an error in mytest.py') % (getMachineBrand(), getMachineName()),
      42: _('Upgrade in progress\nPlease wait until your %s %s reboots\nThis may take a few minutes') % (getMachineBrand(), getMachineName()),
      43: _('Reflash in progress\nPlease wait until your %s %s reboots\nThis may take a few minutes') % (getMachineBrand(), getMachineName()),
      44: _('Your front panel will be upgraded\nThis may take a few minutes'),
      45: _('Your %s %s goes to WOL') % (getMachineBrand(), getMachineName())}.get(retvalue)
     self['text'] = Label(text)
Example #10
0
	def __init__(self, session, retvalue=1, timeout=-1, default_yes = True):
		self.retval = retvalue
		self.ptsmainloopvalue = retvalue
		recordings = session.nav.getRecordings()
		jobs = []
		for job in job_manager.getPendingJobs():
			if job.name != dgettext('vix', 'SoftcamCheck'):
				jobs.append(job)
		
		inTimeshift = Screens.InfoBar.InfoBar and Screens.InfoBar.InfoBar.instance and Screens.InfoBar.InfoBar.ptsGetTimeshiftStatus(Screens.InfoBar.InfoBar.instance)
		self.connected = False
		reason = ""
		next_rec_time = -1
		if not recordings:
			next_rec_time = session.nav.RecordTimer.getNextRecordingTime()
		if len(jobs):
			reason = (ngettext("%d job is running in the background!", "%d jobs are running in the background!", len(jobs)) % len(jobs)) + '\n'
			if len(jobs) == 1:
				job = jobs[0]
				reason += "%s: %s (%d%%)\n" % (job.getStatustext(), job.name, int(100*job.progress/float(job.end)))
			else:
				reason += (_("%d jobs are running in the background!") % len(jobs)) + '\n'
		if inTimeshift:
			reason = _("You seem to be in timeshift!") + '\n'
		if recordings or (next_rec_time > 0 and (next_rec_time - time()) < 360):
			default_yes = False
			reason = _("Recording(s) are in progress or coming up in few seconds!") + '\n'

		if reason and inStandby:
			session.nav.record_event.append(self.getRecordEvent)
			self.skinName = ""
		elif reason and not inStandby:
			text = { 1: _("Really shutdown now?"),
				2: _("Really reboot now?"),
				3: _("Really restart now?"),
				4: _("Really upgrade the front processor and reboot now?"),
				42: _("Really upgrade your %s %s and reboot now?") % (getMachineBrand(), getMachineName()),
				43: _("Really reflash your %s %s and reboot now?") % (getMachineBrand(), getMachineName()),
				44: _("Really upgrade the front panel and reboot now?") }.get(retvalue)
			if text:
				MessageBox.__init__(self, session, reason+text, type = MessageBox.TYPE_YESNO, timeout = timeout, default = default_yes)
				self.skinName = "MessageBoxSimple"
				session.nav.record_event.append(self.getRecordEvent)
				self.connected = True
				self.onShow.append(self.__onShow)
				self.onHide.append(self.__onHide)
				return
		self.skin = """<screen position="1310,0" size="0,0"/>"""
		Screen.__init__(self, session)
		self.close(True)
Example #11
0
	def box(self):
		box = getBoxType()
		if image != 2:
			machinename = getMachineName()
			if box == 'odinm6':
				box = getMachineName().lower()
			elif box == "inihde" and machinename.lower() == "xpeedlx":
				box = "xpeedlx"
			elif box == "inihde" and machinename.lower() == "hd-1000":
				box = "sezam-1000hd"
			elif box == "ventonhdx" and machinename.lower() == "hd-5000":
				box = "sezam-5000hd"
			elif box == "ventonhdx" and machinename.lower() == "premium twin":
				box = "miraclebox-twin"
		return box
Example #12
0
	def __init__(self, session):
		MessageBox.__init__(self, session, _("When you do a factory reset, you will lose ALL your configuration data\n"
			"(including bouquets, services, satellite data ...)\n"
			"After completion of factory reset, your %s %s will restart automatically!\n\n"
			"Really do a factory reset?") % (getMachineBrand(), getMachineName()), MessageBox.TYPE_YESNO, default = False)
		self.setTitle(_("Factory reset"))
		self.skinName = "MessageBox"
Example #13
0
	def formatFinished(self):
		if not (self.failedJob or needHDDFormat()):
			msg = "Your %s %s will restart now.\n" % (getMachineBrand(), getMachineName())
			msg += "If you are setting up your %s, the setup will continue after the restart." % getMachineName()
			self.session.openWithCallback(self.tryReboot, MessageBox, _(msg), type=MessageBox.TYPE_INFO, timeout=10)
		else:
			msg = "Formatting the internal disk of your %s %s has failed." % (getMachineBrand(), getMachineName())
			msg += "\n\nPress OK to retry the format, POWER to shut down, or EXIT to skip the format."
			msg += "\n\nIf the internal HDD was pre-installed in your %s, please note down any error messages below and call %s support." % (getMachineName(), getMachineBrand())
			self["text"].setText(msg)
			errs = ""
			if self.failedTask:
				errs = self.failedTask.name
			if self.failedJob and self.failedJob.name:
				if self.failedJob.name.endswith(_("...")):
					failedJobname = self.failedJob.name[:-len(_("..."))]
				if errs:
					errs += " in job"
				errs += " " + failedJobname
			if not errs:
				errs = "Disk format"
			errs += " failed:\n"
			if self.failedConditions:
				errs += '\n'.join(x.getErrorMessage(self.failedTask)
						for x in self.failedConditions)
			else:
				errs += "No error information available"
			self["errors"].setText(errs)
			self["errors"].show()
			self["poweractions"].setEnabled(True)
			if self.failedJob:
				job_manager.errorCB(False)
Example #14
0
 def addItems(self, list, parentNode):
     for x in parentNode:
         if not x.tag:
             continue
         if x.tag == 'item':
             item_level = int(x.get('level', 0))
             if not self.onNotifiers:
                 self.onNotifiers.append(self.levelChanged)
                 self.onClose.append(self.removeNotifier)
             if item_level > self.onNotifiers.index:
                 continue
             requires = x.get('requires')
             if requires and requires.startswith('config.'):
                 item = eval(requires or '')
                 if item.value and not item.value == '0':
                     SystemInfo[requires] = True
                 else:
                     SystemInfo[requires] = False
             if requires and not SystemInfo.get(requires, False):
                 continue
             item_text = _(x.get('text', '??').encode('UTF-8'))
             item_text = item_text.replace('%s %s', '%s %s' % (getMachineBrand(), getMachineName()))
             item_description = _(x.get('description', ' ').encode('UTF-8'))
             item_description = item_description.replace('%s %s', '%s %s' % (getMachineBrand(), getMachineName()))
             b = eval(x.text or '')
             if b == '':
                 continue
             item = b
             if not isinstance(item, ConfigNothing):
                 list.append((item_text, item, item_description))
    def __init__(self, session):
        MessageBox.__init__(
            self,
            session,
            _(
                "When you do a factory reset, you will lose ALL your configuration data\n"
                "(including bouquets, services, satellite data ...)\n"
                "After completion of factory reset, your %s %s will restart automatically!\n\n"
                "Really do a factory reset?"
            )
            % (getMachineBrand(), getMachineName()),
            MessageBox.TYPE_YESNO,
            default=False,
        )
        self.setTitle(_("Factory reset"))
        self.skinName = "MessageBox"

        if self.isProtected() and config.ParentalControl.servicepin[0].value:
            self.onFirstExecBegin.append(
                boundFunction(
                    self.session.openWithCallback,
                    self.pinEntered,
                    PinInput,
                    pinList=[x.value for x in config.ParentalControl.servicepin],
                    triesEntry=config.ParentalControl.retries.servicepin,
                    title=_("Please enter the correct pin code"),
                    windowTitle=_("Enter pin code"),
                )
            )
Example #16
0
	def startActualUpgrade(self, answer):
		if not answer or not answer[1]:
			self.close()
			return

		if answer[1] == "menu":
			message = _("Do you want to update your %s %s ?") % (getMachineBrand(), getMachineName()) + "\n(%s " % self.total_packages + _("Packages") + ")"
			choices = [
				(_("View the changes"), "showlist"),
				(_("Update and ask to reboot"), "hot"),
				# (_("Upgrade and reboot system"), "cold")
			]
			choices.append((_("Cancel"), ""))
			upgrademessage = self.session.openWithCallback(self.startActualUpgrade, ChoiceBox, title=message, list=choices, skin_name="SoftwareUpdateChoices")
			upgrademessage.setTitle(_('Software update'))
		elif answer[1] == "showlist":
			format = "%-38.38s %-32.32s %-32.32s\n"
			text = format % ("Package name", "Current version", "New version")
			spaces = "-" * 50
			text += format % (spaces, spaces, spaces)
			for i in sorted(self.ipkg.getFetchedList(), key=lambda d: d[0]):
				text += format % (i[0], i[1], i[2])
			self.session.openWithCallback(boundFunction(self.ipkgCallback, IpkgComponent.EVENT_DONE, None), SoftwareUpdateChangeView, text)
		elif answer[1] == "cold":
			self.session.open(TryQuitMainloop, retvalue=42)
			self.close()
		else:
			self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE, args={'test_only': False})
Example #17
0
	def __init__(self, session, parent):
		Screen.__init__(self, session, parent=parent)
		self["selected"] = StaticText("ViX:" + getImageVersion())

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

		if path.exists('/proc/stb/info/chipset'):
			chipset = open('/proc/stb/info/chipset', 'r').read()
			AboutText += _("Chipset: BCM%s") % chipset.replace('\n', '') + "\n"

		AboutText += _("Version: %s") % getImageVersion() + "\n"
		AboutText += _("Build: %s") % getImageBuild() + "\n"
		AboutText += _("Kernel: %s") % about.getKernelVersionString() + "\n"

		string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))
		AboutText += _("Drivers: %s") % driversdate + "\n"
		AboutText += _("Last update: %s") % getEnigmaVersionString() + "\n\n"

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

		self["AboutText"] = StaticText(AboutText)
	def __init__(self, session, device):
		Screen.__init__(self, session)
		self.inputDevice = device
		iInputDevices.currentDevice = self.inputDevice
		self.onChangedEntry = [ ]
		self.setup_title = _("Input device setup")
		self.isStepSlider = None
		self.enableEntry = None
		self.repeatEntry = None
		self.delayEntry = None
		self.nameEntry = None
		self.enableConfigEntry = None

		self.list = [ ]
		ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changedEntry)

		self["actions"] = ActionMap(["SetupActions", "MenuActions"],
			{
				"cancel": self.keyCancel,
				"save": self.apply,
				"menu": self.closeRecursive,
			}, -2)

		self["key_red"] = StaticText(_("Cancel"))
		self["key_green"] = StaticText(_("OK"))
		self["key_yellow"] = StaticText()
		self["key_blue"] = StaticText()
		self["introduction"] = StaticText()

		# for generating strings into .po only
		devicenames = [_("%s %s front panel") % (getMachineBrand(), getMachineName()),_("%s %s front panel") % (getMachineBrand(), getMachineName()),_("%s %s remote control (native)") % (getMachineBrand(), getMachineName()),_("%s %s advanced remote control (native)") % (getMachineBrand(), getMachineName()),_("%s %s ir keyboard") % (getMachineBrand(), getMachineName()),_("%s %s ir mouse") % (getMachineBrand(), getMachineName())]

		self.createSetup()
		self.onLayoutFinish.append(self.layoutFinished)
		self.onClose.append(self.cleanup)
Example #19
0
	def imageInfo(self):
		AboutText = _("OpenHDF Full-Image Backupscript\n")
		AboutText += _("Support at") + " www.hdfreaks.cc\n\n"
		AboutText += _("[Image Info's]\n")
		AboutText += _("Model: %s %s\n") % (getMachineBrand(), getMachineName())
		AboutText += _("Backup Date: %s\n") % strftime("%Y-%m-%d", localtime(self.START))

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

		#AboutText += _("CPU: %s") % about.getCPUString() + "\n"
		AboutText += _("Cores: %s") % about.getCpuCoresString() + "\n"
		AboutText += _("Version: %s") % getImageVersion() + "\n"
		AboutText += _("Build: %s") % getImageBuild() + "\n"
		AboutText += _("Kernel: %s") % about.getKernelVersionString() + "\n"

		string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))

		AboutText += _("Drivers:\t%s") % driversdate + "\n"
		AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n\n"
		AboutText += _("[Enigma2 Settings]\n")
		AboutText += commands.getoutput("cat /etc/enigma2/settings")
		AboutText += _("\n[Installed Plugins]\n")
		AboutText += commands.getoutput("opkg list_installed | grep enigma2-plugin-")

		return AboutText
Example #20
0
	def __init__(self, session):
		Screen.__init__(self, session)

		self["actions"] = ActionMap(["SetupActions", "ColorActions"],
			{
				"cancel": self.close,
				"ok": self.getMemoryInfo,
				"green": self.getMemoryInfo,
				"blue": self.clearMemory,
			})

		self["key_red"] = Label(_("Cancel"))
		self["key_green"] = Label(_("Refresh"))
		self["key_blue"] = Label(_("Clear"))

		self['lmemtext'] = Label()
		self['lmemvalue'] = Label()
		self['rmemtext'] = Label()
		self['rmemvalue'] = Label()

		self['pfree'] = Label()
		self['pused'] = Label()
		self["slide"] = ProgressBar()
		self["slide"].setValue(100)

		self["params"] = MemoryInfoSkinParams()

		self['info'] = Label(_("This info is for developers only.\nFor a normal user it is not important.\nDon't panic please, if any suspicious information is displayed here!"))

		Typ = _("%s  ") % (getMachineName())
		self.setTitle(Typ + "[" + (_("Memory Info"))+ "]")
		self.onLayoutFinish.append(self.getMemoryInfo)
Example #21
0
	def showMessageBox(self):
		if config.usage.boot_action.getValue() == 'normal':
			message = _("Your %s %s was not shutdown properly.\n\n"
					"Do you want to put it in %s?") % (getMachineBrand(), getMachineName(), config.usage.shutdownNOK_action.getValue())
			self.session.openWithCallback(self.MsgBoxClosed, MessageBox, message, MessageBox.TYPE_YESNO, timeout = 60, default = True)
		else:
			self.MsgBoxClosed(True)
Example #22
0
 def __init__(self, session, parent):
     Screen.__init__(self, session, parent=parent)
     self['selected'] = StaticText('MediaSat:' + getImageVersion())
     AboutText = _('Model: %s %s\n') % (getMachineBrand(), getMachineName())
     if path.exists('/proc/stb/info/chipset'):
         chipset = open('/proc/stb/info/chipset', 'r').read()
         AboutText += _('Chipset: BCM%s') % chipset.replace('\n', '') + '\n'
     AboutText += _('Version: %s') % getImageVersion() + '\n'
     AboutText += _('Build: %s') % getImageBuild() + '\n'
     AboutText += _('Kernel: %s') % about.getKernelVersionString() + '\n'
     string = getDriverDate()
     year = string[0:4]
     month = string[4:6]
     day = string[6:8]
     driversdate = '-'.join((year, month, day))
     AboutText += _('Drivers: %s') % driversdate + '\n'
     AboutText += _('Last update: %s') % getEnigmaVersionString() + '\n\n'
     tempinfo = ''
     if path.exists('/proc/stb/sensors/temp0/value'):
         tempinfo = open('/proc/stb/sensors/temp0/value', 'r').read()
     elif path.exists('/proc/stb/fp/temp_sensor'):
         tempinfo = open('/proc/stb/fp/temp_sensor', 'r').read()
     if tempinfo and int(tempinfo.replace('\n', '')) > 0:
         mark = str('\xc2\xb0')
         AboutText += _('System temperature: %s') % tempinfo.replace('\n', '') + mark + 'C\n\n'
     self['AboutText'] = StaticText(AboutText)
Example #23
0
	def __init__(self, session, args = 0):
		Screen.__init__(self, session)
		self.session = session
		self.MODEL = getBoxType()
		self.OEM = getBrandOEM()
		self.MACHINENAME = getMachineName()
		self.MACHINEBRAND = getMachineBrand()
		print "[FULL BACKUP] BOX MACHINENAME = >%s<" %self.MACHINENAME
		print "[FULL BACKUP] BOX MACHINEBRAND = >%s<" %self.MACHINEBRAND
		print "[FULL BACKUP] BOX MODEL = >%s<" %self.MODEL
		print "[FULL BACKUP] OEM MODEL = >%s<" %self.OEM
		
		self["key_green"] = Button("USB")
		self["key_red"] = Button("HDD")
		self["key_blue"] = Button(_("Exit"))
		self["key_yellow"] = Button("")
		self["info-usb"] = Label(_("USB = Do you want to make a back-up on USB?\nThis will take between 4 and 15 minutes depending on the used filesystem and is fully automatic.\nMake sure you first insert an USB flash drive before you select USB."))
		self["info-hdd"] = Label(_("HDD = Do you want to make an USB-back-up image on HDD? \nThis only takes 2 or 10 minutes and is fully automatic."))
		self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], 
		{
			"blue": self.quit,
			"yellow": self.yellow,
			"green": self.green,
			"red": self.red,
			"cancel": self.quit,
		}, -2)
Example #24
0
 def checkNetworkStateFinished(self, result, retval, extra_args=None):
     if "bad address" in result:
         self.session.openWithCallback(
             self.close,
             MessageBox,
             _("Your %s %s is not connected to the internet, please check your network settings and try again.")
             % (getMachineBrand(), getMachineName()),
             type=MessageBox.TYPE_INFO,
             timeout=10,
             close_on_any_key=True,
         )
     elif ("wget returned 1" or "wget returned 255" or "404 Not Found") in result:
         self.session.openWithCallback(
             self.close,
             MessageBox,
             _(
                 "Sorry feeds are down for maintenance, please try again later. If this issue persists please check openvix.co.uk or world-of-satellite.com."
             ),
             type=MessageBox.TYPE_INFO,
             timeout=10,
             close_on_any_key=True,
         )
     elif "Collected errors" in result:
         self.session.openWithCallback(
             self.close,
             MessageBox,
             _("A background update check is in progress, please wait a few minutes and try again."),
             type=MessageBox.TYPE_INFO,
             timeout=10,
             close_on_any_key=True,
         )
     else:
         self.startCheck()
Example #25
0
 def startActualUpgrade(self, answer):
     if not answer or not answer[1]:
         self.close()
         return
     if answer[1] == 'menu':
         message = _('Do you want to update your %s %s ?') % (getMachineBrand(), getMachineName()) + '\n(%s ' % self.total_packages + _('Packages') + ')'
         choices = [(_('View the changes'), 'changes'), (_('Update and ask to reboot'), 'hot'), (_('Upgrade and reboot system'), 'cold')]
         choices.append((_('Update channel list only'), 'channels'))
         choices.append((_('Cancel'), ''))
         upgrademessage = self.session.openWithCallback(self.startActualUpgrade, ChoiceBox, title=message, list=choices, skin_name='SoftwareUpdateChoices', var=self.trafficLight)
         upgrademessage.setTitle(_('Software update'))
     elif answer[1] == 'changes':
         from Plugins.Extensions.EGAMINews.plugin import EGAMIMainNews
         self.session.openWithCallback(self.startActualUpgrade, EGAMIMainNews)
     elif answer[1] == 'backup':
         self.doSettingsBackup()
     elif answer[1] == 'imagebackup':
         self.doImageBackup()
     elif answer[1] == 'channels':
         self.channellist_only = 1
         self.slider.setValue(1)
         self.ipkg.startCmd(IpkgComponent.CMD_LIST, args={'installed_only': True})
     elif answer[1] == 'cold':
         self.session.open(TryQuitMainloop, retvalue=42)
         self.close()
     else:
         self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE, args={'test_only': False})
Example #26
0
	def __init__(self, session, retvalue=1):
		self.skin = """<screen name="QuitMainloopScreen" position="fill" flags="wfNoBorder">
				<ePixmap pixmap="icons/input_info.png" position="c-27,c-60" size="53,53" alphatest="on" />
				<widget name="text" position="center,c+5" size="720,100" font="Regular;22" halign="center" />
			</screen>"""
		Screen.__init__(self, session)
		from Components.Label import Label
		text = {
			QUIT_SHUTDOWN: _("Your %s %s is shutting down") % (getMachineBrand(), getMachineName()),
			QUIT_REBOOT: _("Your %s %s is rebooting") % (getMachineBrand(), getMachineName()),
			QUIT_RESTART: _("The user interface of your %s %s is restarting") % (getMachineBrand(), getMachineName()),
			QUIT_UPGRADE_FP: _("Your frontprocessor will be upgraded\nPlease wait until your %s %s reboots\nThis may take a few minutes") % (getMachineBrand(), getMachineName()),
			QUIT_ERROR_RESTART: _("The user interface of your %s %s is restarting\ndue to an error in mytest.py") % (getMachineBrand(), getMachineName()),
			QUIT_UPGRADE_PROGRAM: _("Upgrade in progress\nPlease wait until your %s %s reboots\nThis may take a few minutes") % (getMachineBrand(), getMachineName()),
			QUIT_IMAGE_RESTORE: _("Reflash in progress\nPlease wait until your %s %s reboots\nThis may take a few minutes") % (getMachineBrand(), getMachineName())
		}.get(retvalue)
		self["text"] = Label(text)
Example #27
0
	def __init__(self, session):
		MessageBox.__init__(self, session, default = False,
			 text = _("When you do a factory reset, you will lose ALL your configuration data, "
					"including timers, but not the contents of your hard disk.\n\n"
					"You can use the Backup Settings option in the Software Manager section "
					"of the Setup menu and then the Restore Settings option later.\n\n"
					"Your %s %s will reboot automatically after a factory reset.\n\n"
					"Do you really want to perform a factory reset now?") % (getMachineBrand(), getMachineName()))
		self.setTitle(_("Factory reset"))
Example #28
0
    def populate(self):
        self["lab1"] = StaticText(_("openATV"))
        self["lab2"] = StaticText(_("By openATV Image Team"))
        model = None
        AboutText = ""
        self["lab3"] = StaticText(_("Support at") + " www.opena.tv")
        AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName())

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

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

        AboutText += _("Version:\t%s") % getImageVersion() + "\n"
        AboutText += _("Build:\t%s") % getImageBuild() + "\n"
        AboutText += _("Kernel:\t%s") % about.getKernelVersionString() + "\n"

        string = getDriverDate()
        year = string[0:4]
        month = string[4:6]
        day = string[6:8]
        driversdate = "-".join((year, month, day))
        AboutText += _("Drivers:\t%s") % driversdate + "\n"

        AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n\n"

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

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

        tempinfo = ""
        if path.exists("/proc/stb/fp/temp_sensor_avs"):
            f = open("/proc/stb/fp/temp_sensor_avs", "r")
            tempinfo = f.read()
            f.close()
        if tempinfo and int(tempinfo.replace("\n", "")) > 0:
            mark = str("\xc2\xb0")
            AboutText += _("Processor temperature:\t%s") % tempinfo.replace("\n", "") + mark + "C\n"

        self["AboutScrollLabel"] = ScrollLabel(AboutText)
Example #29
0
	def addItems(self, list, parentNode):
		for x in parentNode:
			if not x.tag:
				continue
			if x.tag == 'item':
				item_level = int(x.get("level", 0))
				item_tunerlevel = int(x.get("tunerlevel", 0))
				item_rectunerlevel = int(x.get("rectunerlevel", 0))
				item_tuxtxtlevel = int(x.get("tt_level", 0))

				if not self.onNotifiers:
					self.onNotifiers.append(self.levelChanged)
					self.onClose.append(self.removeNotifier)

				if item_level > config.usage.setup_level.index:
					continue
				if (item_tuxtxtlevel == 1) and (config.usage.tuxtxt_font_and_res.value != "expert_mode"):
					continue
				if item_tunerlevel == 1 and not config.usage.frontend_priority.value in ("expert_mode", "experimental_mode"):
					continue
				if item_tunerlevel == 2 and not config.usage.frontend_priority.value == "experimental_mode":
					continue
				if item_rectunerlevel == 1 and not config.usage.recording_frontend_priority.value in ("expert_mode", "experimental_mode"):
					continue
				if item_rectunerlevel == 2 and not config.usage.recording_frontend_priority.value == "experimental_mode":
					continue

				requires = x.get("requires")
				if requires and requires.startswith('config.'):
					item = eval(requires or "")
					if item.value and not item.value == "0":
						SystemInfo[requires] = True
					else:
						SystemInfo[requires] = False

				if requires and not SystemInfo.get(requires, False):
					continue

				if self.PluginLanguageDomain:
					item_text = dgettext(self.PluginLanguageDomain, x.get("text", "??").encode("UTF-8"))
					item_description = dgettext(self.PluginLanguageDomain, x.get("description", " ").encode("UTF-8"))
				else:
					item_text = _(x.get("text", "??").encode("UTF-8"))
					item_description = _(x.get("description", " ").encode("UTF-8"))

				item_text = item_text.replace("%s %s","%s %s" % (getMachineBrand(), getMachineName()))
				item_description = item_description.replace("%s %s","%s %s" % (getMachineBrand(), getMachineName()))
				b = eval(x.text or "")
				if b == "":
					continue
				#add to configlist
				item = b
				# the first b is the item itself, ignored by the configList.
				# the second one is converted to string.
				if not isinstance(item, ConfigNothing):
					list.append((item_text, item, item_description))
Example #30
0
	def populate(self):
		self["lab1"] = StaticText(_("Virtuosso Image Xtreme"))
		self["lab2"] = StaticText(_("By Team ViX"))
		model = None
		AboutText = ""
		self["lab3"] = StaticText(_("Support at") + " www.world-of-satellite.com")

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

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

		AboutText += _("CPU:\t%s\n") % about.getCPUString()
		AboutText += _("CPU speed:\t%s\n") % about.getCPUSpeedString()
		AboutText += _("Cores:\t%s\n") % about.getCpuCoresString()
		imageSubBuild = ""
		if getImageType() != 'release':
			imageSubBuild = ".%s" % getImageDevBuild()
		AboutText += _("Build:\t%s.%s%s (%s)\n") % (getImageVersion(), getImageBuild(), imageSubBuild, getImageType().title())
		AboutText += _("Skin name:\t%s\n") % config.skin.primary_skin.value[0:-9]

		string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))
		AboutText += _("Drivers:\t%s\n") % driversdate
		AboutText += _("Kernel:\t%s\n") % about.getKernelVersionString()

		AboutText += _("GStreamer:\t%s\n") % about.getGStreamerVersionString().replace("GStreamer ","")
		AboutText += _("Python:\t%s\n") % about.getPythonVersionString()

		AboutText += _("Installed:\t%s\n") % about.getFlashDateString()
		AboutText += _("Last update:\t%s\n\n") % getEnigmaVersionString()

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

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

		self["AboutScrollLabel"] = ScrollLabel(AboutText)
Example #31
0
	def populate(self):
		self["lab1"] = StaticText(_("openHDF by HDF Image Team"))
		self["lab2"] = StaticText(_("Support at") + " www.HDFreaks.cc")
		model = None
		AboutText = ""
		self["lab2"] = StaticText(_("Support @") + " www.hdfreaks.cc")
		AboutText += _("Model:\t%s %s - OEM Model: %s\n") % (getMachineBrand(), getMachineName(), getBrandOEM())

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

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

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

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

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

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

		if path.exists('/boot/STARTUP'):
			f = open('/boot/STARTUP', 'r')
			f.seek(22)
			image = f.read(1)
			f.close()
			if bootname: bootname = "   (%s)" %bootname
			AboutText += _("Image started:\t%s") % "STARTUP_" + image + bootname + "\n"

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

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

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

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

		self["AboutScrollLabel"] = ScrollLabel(AboutText)
Example #32
0
def getAboutText():
    AboutText = ""
    AboutText += _("Model:\t\t%s %s\n") % (getMachineBrand(), getMachineName())
    AboutText += _("OEM Model:\t\t%s\n") % getMachineBuild()

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

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

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

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

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

    AboutText += _("Version:\t\t%s") % getImageVersion() + "\n"
    AboutText += _("Build:\t\t%s") % getImageBuild() + "\n"
    AboutText += _("Kernel:\t\t%s") % about.getKernelVersionString() + "\n"

    string = getDriverDate()
    year = string[0:4]
    month = string[4:6]
    day = string[6:8]
    driversdate = '-'.join((year, month, day))
    AboutText += _("Drivers:\t\t%s") % MyDateConverter(driversdate) + "\n"

    AboutText += _(
        "GStreamer:\t\t%s") % about.getGStreamerVersionString() + "\n"
    AboutText += _("Python:\t\t%s") % about.getPythonVersionString() + "\n"

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

    AboutText += _("Last update:\t\t%s") % MyDateConverter(
        getEnigmaVersionString()) + "\n"

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

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

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

    return AboutText, AboutLcdText
Example #33
0
    def __init__(self, session, args=0):
        Screen.__init__(self, session)
        self.session = session
        self.selection = 0
        self.MODEL = getBoxType()
        self.OEM = getBrandOEM()
        self.MACHINEBUILD = getMachineBuild()
        self.MACHINENAME = getMachineName()
        self.MACHINEBRAND = getMachineBrand()
        self.IMAGEFOLDER = getImageFolder()
        self.UBINIZE_ARGS = getMachineUBINIZE()
        self.MKUBIFS_ARGS = getMachineMKUBIFS()
        self.MTDKERNEL = getMachineMtdKernel()
        self.MTDROOTFS = getMachineMtdRoot()
        self.ROOTFSBIN = getMachineRootFile()
        self.KERNELBIN = getMachineKernelFile()
        self.ROOTFSTYPE = getImageFileSystem().strip()

        if self.MACHINEBUILD in ("hd51", "vs1500", "h7", "8100s"):
            self.MTDBOOT = "mmcblk0p1"
            self.EMMCIMG = "disk.img"
        elif self.MACHINEBUILD in ("xc7439", "osmio4k"):
            self.MTDBOOT = "mmcblk1p1"
            self.EMMCIMG = "emmc.img"
#		elif self.MACHINEBUILD in ("cc1","sf8008","ustym4kpr"):
#			self.MTDBOOT = "none"
#			self.EMMCIMG = "usb_update.bin"
        else:
            self.MTDBOOT = "none"
            self.EMMCIMG = "none"

        print "[FULL BACKUP] BOX MACHINEBUILD = >%s<" % self.MACHINEBUILD
        print "[FULL BACKUP] BOX MACHINENAME = >%s<" % self.MACHINENAME
        print "[FULL BACKUP] BOX MACHINEBRAND = >%s<" % self.MACHINEBRAND
        print "[FULL BACKUP] BOX MODEL = >%s<" % self.MODEL
        print "[FULL BACKUP] OEM MODEL = >%s<" % self.OEM
        print "[FULL BACKUP] IMAGEFOLDER = >%s<" % self.IMAGEFOLDER
        print "[FULL BACKUP] UBINIZE = >%s<" % self.UBINIZE_ARGS
        print "[FULL BACKUP] MKUBIFS = >%s<" % self.MKUBIFS_ARGS
        print "[FULL BACKUP] MTDBOOT = >%s<" % self.MTDBOOT
        print "[FULL BACKUP] MTDKERNEL = >%s<" % self.MTDKERNEL
        print "[FULL BACKUP] MTDROOTFS = >%s<" % self.MTDROOTFS
        print "[FULL BACKUP] ROOTFSBIN = >%s<" % self.ROOTFSBIN
        print "[FULL BACKUP] KERNELBIN = >%s<" % self.KERNELBIN
        print "[FULL BACKUP] ROOTFSTYPE = >%s<" % self.ROOTFSTYPE
        print "[FULL BACKUP] EMMCIMG = >%s<" % self.EMMCIMG

        self.error_files = ''
        self.list = self.list_files("/boot")
        self["key_green"] = StaticText("USB")
        self["key_red"] = StaticText("HDD")
        self["key_blue"] = StaticText(_("Exit"))
        if SystemInfo["HaveMultiBoot"]:
            self["key_yellow"] = StaticText(_("STARTUP"))
            self["info-multi"] = Label(
                _("You can select with yellow the OnlineFlash Image\n or select Recovery to create a USB Disk Image for clean Install."
                  ))
            self.read_current_multiboot()
        else:
            self["key_yellow"] = StaticText("")
            self["info-multi"] = Label(" ")
        self["info-usb"] = Label(
            _("USB = Do you want to make a back-up on USB?\nThis will take between 3 and 15 minutes depending on the used filesystem and is fully automatic.\nMake sure you first insert an USB flash drive before you select USB."
              ))
        self["info-hdd"] = Label(
            _("HDD = Do you want to make an USB-back-up image on HDD? \nThis only takes 1 or 10 minutes and is fully automatic."
              ))
        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions"], {
                "blue": self.quit,
                "yellow": self.yellow,
                "green": self.green,
                "red": self.red,
                "cancel": self.quit,
            }, -2)
        self.onShown.append(self.show_Errors)
Example #34
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
			info['streams'] = GetStreamInfo()

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

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

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

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

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

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

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

	info['textinputsupport'] = TEXTINPUTSUPPORT
	STATICBOXINFO = info
	return info
Example #35
0
    def __init__(self, session, retvalue=1, timeout=-1, default_yes=True):
        self.retval = retvalue
        self.ptsmainloopvalue = retvalue
        recordings = session.nav.getRecordings()
        jobs = []
        for job in job_manager.getPendingJobs():
            if job.name != dgettext('vix', 'SoftcamCheck'):
                jobs.append(job)

        inTimeshift = Screens.InfoBar.InfoBar and Screens.InfoBar.InfoBar.instance and Screens.InfoBar.InfoBar.ptsGetTimeshiftStatus(
            Screens.InfoBar.InfoBar.instance)
        self.connected = False
        reason = ""
        next_rec_time = -1
        if not recordings:
            next_rec_time = session.nav.RecordTimer.getNextRecordingTime()
        if len(jobs):
            reason = (ngettext("%d job is running in the background!",
                               "%d jobs are running in the background!",
                               len(jobs)) % len(jobs)) + '\n'
            if len(jobs) == 1:
                job = jobs[0]
                reason += "%s: %s (%d%%)\n" % (job.getStatustext(), job.name,
                                               int(100 * job.progress /
                                                   float(job.end)))
            else:
                reason += (_("%d jobs are running in the background!") %
                           len(jobs)) + '\n'
        if inTimeshift:
            reason = _("You seem to be in timeshift!") + '\n'
        if recordings or (next_rec_time > 0 and
                          (next_rec_time - time()) < 360):
            default_yes = False
            reason = _(
                "Recording(s) are in progress or coming up in few seconds!"
            ) + '\n'

        if reason and inStandby:
            session.nav.record_event.append(self.getRecordEvent)
            self.skinName = ""
        elif reason and not inStandby:
            text = {
                1:
                _("Really shutdown now?"),
                2:
                _("Really reboot now?"),
                3:
                _("Really restart now?"),
                4:
                _("Really upgrade the frontprocessor and reboot now?"),
                42:
                _("Really upgrade your %s %s and reboot now?") %
                (getMachineBrand(), getMachineName()),
                43:
                _("Really reflash your %s %s and reboot now?") %
                (getMachineBrand(), getMachineName())
            }.get(retvalue)
            if text:
                MessageBox.__init__(self,
                                    session,
                                    reason + text,
                                    type=MessageBox.TYPE_YESNO,
                                    timeout=timeout,
                                    default=default_yes)
                self.skinName = "MessageBoxSimple"
                session.nav.record_event.append(self.getRecordEvent)
                self.connected = True
                self.onShow.append(self.__onShow)
                self.onHide.append(self.__onHide)
                return
        self.skin = """<screen position="1310,0" size="0,0"/>"""
        Screen.__init__(self, session)
        self.close(True)
Example #36
0
	def okSubList(self):
		item = self["sublist"].getCurrent()

######## Select Network Menu ##############################
		if item[0] == _("Network Wizard"):
			self.session.open(NetworkWizard)
		elif item[0] == _("Network Adapter Selection"):
			self.session.open(NetworkAdapterSelection)
		elif item[0] == _("Network Interface"):
			self.session.open(AdapterSetup, self.activeInterface)
		elif item[0] == _("Network Restart"):
			self.session.open(RestartNetwork)
		elif item[0] == _("Network Services"):
			self.Qnetworkservices()
			self["sublist"].moveToIndex(0)
		elif item[0] == _("Samba"):
			self.session.open(NetworkSamba)
		elif item[0] == _("NFS"):
			self.session.open(NetworkNfs)
		elif item[0] == _("FTP"):
			self.session.open(NetworkFtp)
		elif item[0] == _("AFP"):
			self.session.open(NetworkAfp)
		elif item[0] == _("OpenVPN"):
			self.session.open(NetworkOpenvpn)
		elif item[0] == _("MiniDLNA"):
			self.session.open(NetworkMiniDLNA)
		elif item[0] == _("Inadyn"):
			self.session.open(NetworkInadyn)
		elif item[0] == _("SABnzbd"):
			self.session.open(NetworkSABnzbd)
		elif item[0] == _("uShare"):
			self.session.open(NetworkuShare)
		elif item[0] == _("Telnet"):
			self.session.open(NetworkTelnet)
######## Select System Setup Menu ##############################
		elif item[0] == _("Customise"):
			self.openSetup("usage")
		elif item[0] == _("Button Setup"):
			self.openSetup("remotesetup")
		elif item[0] == _("Display Settings"):
			self.openSetup("display")
		elif item[0] == _("LCD Skin Setup"):
			self.session.open(LcdSkinSelector)
		elif item[0] == _("Skin Setup"):
			self.session.open(SkinSelector)	
		elif item[0] == _("OSD settings"):
			self.openSetup("userinterface")
		elif item[0] == _("Channel selection"):
			self.openSetup("channelselection")
		elif item[0] == _("Recording settings"):
			self.openSetup("recording")
		elif item[0] == _("EPG settings"):
			self.openSetup("epgsettings")
######## Select Mounts Menu ##############################
		elif item[0] == _("Mount Manager"):
			self.session.open(AutoMountManager, None, plugin_path_networkbrowser)
		elif item[0] == _("Network Browser"):
			self.session.open(NetworkBrowser, None, plugin_path_networkbrowser)
		elif item[0] == _("Device Manager"):
			self.session.open(HddMount)
######## Select Softcam Menu ##############################
		elif item[0] == _("Softcam Setup"):
			self.session.open(SoftcamSetup)
		elif item[0] == _("Download Softcams"):
			self.session.open(ShowSoftcamPackages)
######## Select AV Setup Menu ##############################
		elif item[0] == _("Video Settings"):
			self.session.open(VideoSetup)
		elif item[0] == _("Audio Settings"):
			self.session.open(AudioSetup)
		elif item[0] == _("Auto Language"):
			self.openSetup("autolanguagesetup")
		elif item[0] == _("Audio Sync"):
			self.session.open(AC3LipSyncSetup, plugin_path_audiosync)
		elif item[0] == _("VideoEnhancement"):
			self.session.open(VideoEnhancementSetup)
######## Select TUNER Setup Menu ##############################
		elif item[0] == _("Tuner Configuration"):
			self.session.open(NimSelection)
		elif item[0] == _("Positioner Setup"):
			self.PositionerMain()
		elif item[0] == _("Automatic Scan"):
			self.session.open(ScanSimple)
		elif item[0] == _("Manual Scan"):
			self.session.open(ScanSetup)
		elif item[0] == _("Sat Finder"):
			self.SatfinderMain()
######## Select Software Manager Menu ##############################
		elif item[0] == _("Software Update"):
			self.session.open(SoftwarePanel)
		elif item[0] == _("Flash Online"):
			self.session.open(FlashOnline)
		elif item[0] == _("Complete Backup"):
			if DFLASH == True:
				self.session.open(dFlash)
			elif DBACKUP == True:
				self.session.open(dBackup)
			else:
				self.session.open(ImageBackup)
		elif item[0] == _("Backup Settings"):
			self.session.openWithCallback(self.backupDone, BackupScreen, runBackup = True)
		elif item[0] == _("Restore Settings"):
			self.backuppath = getBackupPath()
			if not path.isdir(self.backuppath):
				self.backuppath = getOldBackupPath()
			self.backupfile = getBackupFilename()
			self.fullbackupfilename = self.backuppath + "/" + self.backupfile
			if os_path.exists(self.fullbackupfilename):
				self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore your %s %s backup?\nSTB will restart after the restore") % (getMachineBrand(), getMachineName()), default = False)
			else:
				self.session.open(MessageBox, _("Sorry no backups found!"), MessageBox.TYPE_INFO, timeout = 10)
		elif item[0] == _("Show default backup files"):
			self.session.open(BackupSelection, title=_("Default files/folders to backup"), configBackupDirs=config.plugins.configurationbackup.backupdirs_default, readOnly=True)
		elif item[0] == _("Select additional backup files"):
			self.session.open(BackupSelection, title=_("Additional files/folders to backup"), configBackupDirs=config.plugins.configurationbackup.backupdirs, readOnly=False)
		elif item[0] == _("Select excluded backup files"):
			self.session.open(BackupSelection, title=_("Files/folders to exclude from backup"), configBackupDirs=config.plugins.configurationbackup.backupdirs_exclude, readOnly=False)
		elif item[0] == _("Software Manager Setup"):
			self.session.open(SoftwareManagerSetup)
######## Select PluginDownloadBrowser Menu ##############################
		elif item[0] == _("Plugin Browser"):
			self.session.open(PluginBrowser)
		elif item[0] == _("Download Plugins"):
			self.session.open(PluginDownloadBrowser, 0)
		elif item[0] == _("Remove Plugins"):
			self.session.open(PluginDownloadBrowser, 1)
		elif item[0] == _("Plugin Filter"):
			self.session.open(PluginFilter)
		elif item[0] == _("IPK Installer"):
			try:
				from Plugins.Extensions.MediaScanner.plugin import main
				main(self.session)
			except:
				self.session.open(MessageBox, _("Sorry MediaScanner is not installed!"), MessageBox.TYPE_INFO, timeout = 10)
######## Select Harddisk Menu ############################################
		elif item[0] == _("Harddisk Setup"):
			self.openSetup("harddisk")
		elif item[0] == _("Initialization"):
			self.session.open(HarddiskSelection)
		elif item[0] == _("Filesystem Check"):
			self.session.open(HarddiskFsckSelection)
		elif item[0] == _("Convert ext3 to ext4"):
			self.session.open(HarddiskConvertExt4Selection)
Example #37
0
    def imageInfo(self):
        AboutText = _("openHDF Full-Image Backupscript")
        AboutText += _("Support at") + " www.hdfreaks.cc\n\n"
        AboutText += _("[Image Info]\n")
        AboutText += _("Model: %s %s\n") % (getMachineBrand(),
                                            getMachineName())
        AboutText += _("Backup Date: %s\n") % strftime("%Y-%m-%d",
                                                       localtime(self.START))

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

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

        AboutText += _("Version: %s") % getImageVersion() + "\n"
        AboutText += _("Build: %s") % getImageBuild() + "\n"
        AboutText += _("Kernel: %s") % about.getKernelVersionString() + "\n"

        string = getDriverDate()
        year = string[0:4]
        month = string[4:6]
        day = string[6:8]
        driversdate = '-'.join((year, month, day))
        AboutText += _("Drivers:\t%s") % driversdate + "\n"

        AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n\n"

        AboutText += _("[Enigma2 Settings]\n")
        AboutText += commands.getoutput("cat /etc/enigma2/settings")
        AboutText += _("\n\n[User - bouquets (TV)]\n")
        try:
            f = open("/etc/enigma2/bouquets.tv", "r")
            lines = f.readlines()
            f.close()
            for line in lines:
                if line.startswith("#SERVICE:"):
                    bouqet = line.split()
                    if len(bouqet) > 3:
                        bouqet[3] = bouqet[3].replace('"', '')
                        f = open("/etc/enigma2/" + bouqet[3], "r")
                        userbouqet = f.readline()
                        AboutText += userbouqet.replace('#NAME ', '')
                        f.close()
        except:
            AboutText += "Error reading bouquets.tv"

        AboutText += _("\n[User - bouquets (RADIO)]\n")
        try:
            f = open("/etc/enigma2/bouquets.radio", "r")
            lines = f.readlines()
            f.close()
            for line in lines:
                if line.startswith("#SERVICE:"):
                    bouqet = line.split()
                    if len(bouqet) > 3:
                        bouqet[3] = bouqet[3].replace('"', '')
                        f = open("/etc/enigma2/" + bouqet[3], "r")
                        userbouqet = f.readline()
                        AboutText += userbouqet.replace('#NAME ', '')
                        f.close()
        except:
            AboutText += "Error reading bouquets.radio"

        AboutText += _("\n[Installed Plugins]\n")
        AboutText += commands.getoutput(
            "opkg list_installed | grep enigma2-plugin-")

        return AboutText
Example #38
0
import boxbranding
print "getMachineBuild=%s<" % boxbranding.getMachineBuild()
print "getMachineMake=%s<" % boxbranding.getMachineMake()
print "getMachineProcModel=%s<" % boxbranding.getMachineProcModel()
print "getMachineBrand=%s<" % boxbranding.getMachineBrand()
print "getMachineName=%s<" % boxbranding.getMachineName()
print "getMachineMtdKernel=%s<" % boxbranding.getMachineMtdKernel()
print "getMachineKernelFile=%s<" % boxbranding.getMachineKernelFile()
print "getMachineMtdRoot=%s<" % boxbranding.getMachineMtdRoot()
print "getMachineRootFile=%s<" % boxbranding.getMachineRootFile()
print "getMachineMKUBIFS=%s<" % boxbranding.getMachineMKUBIFS()
print "getMachineUBINIZE=%s<" % boxbranding.getMachineUBINIZE()
print "getBoxType=%s<" % boxbranding.getBoxType()
print "getBrandOEM=%s<" % boxbranding.getBrandOEM()
print "getOEVersion=%s<" % boxbranding.getOEVersion()
print "getDriverDate=%s<" % boxbranding.getDriverDate()
print "getImageVersion=%s<" % boxbranding.getImageVersion()
print "getImageBuild=%s<" % boxbranding.getImageBuild()
print "getImageDevBuild=%s<" % boxbranding.getImageDevBuild()
print "getImageType=%s<" % boxbranding.getImageType()
print "getImageDistro=%s<" % boxbranding.getImageDistro()
print "getImageFolder=%s<" % boxbranding.getImageFolder()
print "getImageFileSystem=%s<" % boxbranding.getImageFileSystem()
print "getImageDevBuild=%s<" % boxbranding.getImageDevBuild()
print "getImageType=%s<" % boxbranding.getImageType()
print "getMachineMake=%s<" % boxbranding.getMachineMake()
print "getImageArch=%s<" % boxbranding.getImageArch()
print "getFeedsUrl=%s<" % boxbranding.getFeedsUrl()
print "getDisplayType=%s<" % boxbranding.getDisplayType()
print "getHaveHDMI=%s<" % boxbranding.getHaveHDMI()
print "getHaveYUV=%s<" % boxbranding.getHaveYUV()
Example #39
0
	def getTranslation(self, text):
		return _(text).replace("%s %s","%s %s" % (getMachineBrand(), getMachineName()))
Example #40
0
    def __init__(self,
                 session,
                 retvalue=QUIT_SHUTDOWN,
                 timeout=-1,
                 default_yes=True):
        self.retval = retvalue
        self.ptsmainloopvalue = retvalue
        recordings = session.nav.getRecordings(
            False,
            Components.RecordingConfig.recType(
                config.recording.warn_box_restart_rec_types.getValue()))
        jobs = len(job_manager.getPendingJobs())
        inTimeshift = Screens.InfoBar.InfoBar and Screens.InfoBar.InfoBar.instance and Screens.InfoBar.InfoBar.ptsGetTimeshiftStatus(
            Screens.InfoBar.InfoBar.instance)
        self.connected = False
        reason = ""
        next_rec_time = -1
        if not recordings:
            next_rec_time = session.nav.RecordTimer.getNextRecordingTime()
#		if jobs:
#			reason = (ngettext("%d job is running in the background!", "%d jobs are running in the background!", jobs) % jobs) + '\n'
#			if jobs == 1:
#				job = job_manager.getPendingJobs()[0]
#				if job.name == "VFD Checker":
#					reason = ""
#				else:
#					reason += "%s: %s (%d%%)\n" % (job.getStatustext(), job.name, int(100*job.progress/float(job.end)))
#			else:
#				reason += (_("%d jobs are running in the background!") % jobs) + '\n'
        if inTimeshift:
            reason = _("You seem to be in timeshift!") + '\n'
            default_yes = True
            timeout = 30
        if recordings or (next_rec_time > 0 and
                          (next_rec_time - time()) < 360):
            reason = _(
                "Recording(s) are in progress or coming up in few seconds!"
            ) + '\n'
            default_yes = False
            timeout = 30

        if reason and inStandby:
            session.nav.record_event.append(self.getRecordEvent)
            self.skinName = ""
        elif reason and not inStandby:
            text = {
                QUIT_SHUTDOWN:
                _("Really shutdown now?"),
                QUIT_REBOOT:
                _("Really reboot now?"),
                QUIT_RESTART:
                _("Really restart now?"),
                QUIT_UPGRADE_FP:
                _("Really upgrade the frontprocessor and reboot now?"),
                QUIT_MAINT:
                _("Really reboot into Recovery Mode?"),
                QUIT_UPGRADE_PROGRAM:
                _("Really upgrade your %s %s and reboot now?") %
                (getMachineBrand(), getMachineName()),
                QUIT_IMAGE_RESTORE:
                _("Really reflash your %s %s and reboot now?") %
                (getMachineBrand(), getMachineName()),
                QUIT_UPGRADE_FRONTPANEL:
                _("Really upgrade the front panel and reboot now?"),
                QUIT_WOLSHUTDOWN:
                _("Really WOL now?")
            }.get(retvalue)
            if text:
                MessageBox.__init__(self,
                                    session,
                                    reason + text,
                                    type=MessageBox.TYPE_YESNO,
                                    timeout=timeout,
                                    default=default_yes)
                self.skinName = "MessageBoxSimple"
                session.nav.record_event.append(self.getRecordEvent)
                self.connected = True
                self.onShow.append(self.__onShow)
                self.onHide.append(self.__onHide)
                return
        self.skin = """<screen position="1310,0" size="0,0"/>"""
        Screen.__init__(self, session)
        self.close(True)
Example #41
0
	def populate(self):
		self["lab1"] = StaticText(_("Open Black Hole Image"))
		self["lab2"] = StaticText(_("By Bh Team"))
		model = None
		AboutText = ""
		self["lab3"] = StaticText(_("Support at") + " www.vuplus-community.net")

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

		if about.getChipSetString() != _("unavailable"):
			if about.getIsBroadcom():
				AboutText += _("Chipset:\tBCM%s\n") % about.getChipSetString().upper()
			else:
				AboutText += _("Chipset:\t%s\n") % about.getChipSetString().upper()

		AboutText += _("CPU:\t%s %s %s\n") % (about.getCPUArch(), about.getCPUSpeedString(), about.getCpuCoresString())

		imageSubBuild = ""
		if getImageType() != 'release':
			imageSubBuild = ".%s" % getImageDevBuild()
		AboutText += _("Image:\t%s.%s%s (%s)\n") % (getImageVersion(), getImageBuild(), imageSubBuild, getImageType().title())
		if SystemInfo["canMultiBoot"]:
			image = GetCurrentImage()
			bootmode = ""
			if SystemInfo["canMode12"]:
				bootmode = "bootmode = %s" %GetCurrentImageMode()
			AboutText += _("Image Slot:\t%s") % "STARTUP_" + str(image) + " " + bootmode + "\n"
		skinWidth = getDesktop(0).size().width()
		skinHeight = getDesktop(0).size().height()

		string = getDriverDate()
		year = string[0:4]
		month = string[4:6]
		day = string[6:8]
		driversdate = '-'.join((year, month, day))
		AboutText += _("Drivers:\t%s\n") % driversdate
		AboutText += _("Kernel:\t%s\n") % about.getKernelVersionString()
		AboutText += _("GStreamer:\t%s\n") % about.getGStreamerVersionString().replace("GStreamer ","")
		AboutText += _("Python:\t%s\n") % about.getPythonVersionString()
		AboutText += _("Installed:\t%s\n") % about.getFlashDateString()
		AboutText += _("Last update:\t%s\n") % getEnigmaVersionString()
		AboutText += _("E2 (re)starts:\t%s\n") % config.misc.startCounter.value
		AboutText += _("Skin:\t%s") % config.skin.primary_skin.value[0:-9] + _("  (%s x %s)") % (skinWidth, skinHeight) + "\n"

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

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

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

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

		self["AboutScrollLabel"] = ScrollLabel(AboutText)
Example #42
0
    def __init__(self, session):
        Screen.__init__(self, session)

        AboutText = _("Model:%s %s\n") % (getMachineBrand(), getMachineName())
        AboutText = _("Hardware: ") + about.getHardwareTypeString() + "\n"
        AboutText += _("CPU: ") + about.getCPUInfoString() + "\n"
        AboutText += _("Image: ") + about.getImageTypeString() + "\n"
        AboutText += _(
            "Kernel version: ") + about.getKernelVersionString() + "\n"

        EnigmaVersion = "Enigma: " + about.getEnigmaVersionString()
        self["EnigmaVersion"] = StaticText(EnigmaVersion)
        AboutText += EnigmaVersion + "\n"

        GStreamerVersion = "GStreamer: " + about.getGStreamerVersionString()
        self["GStreamerVersion"] = StaticText(GStreamerVersion)
        AboutText += GStreamerVersion + "\n"

        ImageVersion = _("Last upgrade: ") + about.getImageVersionString()
        self["ImageVersion"] = StaticText(ImageVersion)
        AboutText += ImageVersion + "\n"

        AboutText += _("DVB drivers: ") + about.getDriverInstalledDate() + "\n"

        AboutText += _("Moderator: Sodo ") + "\n"

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

        self["FPVersion"] = StaticText(fp_version)

        self["TunerHeader"] = StaticText(_("Detected NIMs:"))
        AboutText += "\n" + _("Detected NIMs:") + "\n"

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

        self["HDDHeader"] = StaticText(_("Detected HDD:"))
        AboutText += "\n" + _("Detected HDD:") + "\n"

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

        self["actions"] = ActionMap(
            ["ColorActions", "SetupActions", "DirectionActions"], {
                "cancel": self.close,
                "ok": self.close,
                "red": self.showCommits,
                "green": self.showTranslationInfo,
                "blue": self.showMemoryInfo,
                "up": self["AboutScrollLabel"].pageUp,
                "down": self["AboutScrollLabel"].pageDown
            })
Example #43
0
	def showPiP(self):
		slist = self.servicelist
		if self.session.pipshown:
			if slist and slist.dopipzap:
				slist.togglePipzap()
			if self.session.pipshown:
				del self.session.pip
				self.session.pipshown = False
		else:
			service = self.session.nav.getCurrentService()
			info = service and service.info()
			xres = str(info.getInfo(enigma.iServiceInformation.sVideoWidth))
			if int(xres) <= 720 or not getMachineBuild() == 'blackbox7405':  
				from Screens.PictureInPicture import PictureInPicture
				self.session.pip = self.session.instantiateDialog(PictureInPicture)
				self.session.pip.show()
				if self.session.pip.playService(slist.getCurrentSelection()):
					self.session.pipshown = True
					self.session.pip.servicePath = slist.getCurrentServicePath()
				else:
					self.session.pipshown = False
					del self.session.pip
			else:
				self.session.open(MessageBox, _("Your %s %s does not support PiP HD") % (getMachineBrand(), getMachineName()), type = MessageBox.TYPE_INFO,timeout = 5 )
Example #44
0
	def okSubList(self):
		item = self["sublist"].getCurrent()

######## Select Network Menu ##############################
		if item[0] == _("Network Wizard"):
			self.session.open(NetworkWizard)
		elif item[0] == _("Password"):
			from Plugins.Extensions.Infopanel.easy_setup import NFRPasswdScreen
			self.session.open(NFRPasswdScreen)
		elif item[0] == _("Network Adapter Selection"):
			self.session.open(NetworkAdapterSelection)
		elif item[0] == _("Network Interface"):
			self.session.open(AdapterSetup, self.activeInterface)
		elif item[0] == _("Network Restart"):
			self.session.open(RestartNetwork)
		elif item[0] == _("Network Services"):
			self.Qnetworkservices()
			self["sublist"].moveToIndex(0)
		elif item[0] == _("iperf Net_test"):
			self.session.open(Net_test)
		elif item[0] == _("Telnet Command"):
			self.session.open(TelnetCommand)
		elif item[0] == _("Samba"):
			self.session.open(NetworkSamba)
		elif item[0] == _("NFS"):
			self.session.open(NetworkNfs)
		elif item[0] == _("FTP"):
			self.session.open(NetworkFtp)
		elif item[0] == _("AFP"):
			self.session.open(NetworkAfp)
		elif item[0] == _("OpenVPN"):
			self.session.open(NetworkOpenvpn)
		elif item[0] == _("MiniDLNA"):
			self.session.open(NetworkMiniDLNA)
		elif item[0] == _("Inadyn"):
			self.session.open(NetworkInadyn)
		elif item[0] == _("SABnzbd"):
			self.session.open(NetworkSABnzbd)
		elif item[0] == _("uShare"):
			self.session.open(NetworkuShare)
		elif item[0] == _("Telnet"):
			self.session.open(NetworkTelnet)
######## Select System Setup Menu ##############################
		elif item[0] == _("Customise"):
			self.openSetup("usage")
		elif item[0] == _("Button Setup"):
			self.openSetup("remotesetup")
		elif item[0] == _("OSD settings"):
			self.openSetup("userinterface")
		elif item[0] == _("Channel selection"):
			self.openSetup("channelselection")
		elif item[0] == _("Recording settings"):
			self.openSetup("recording")
		elif item[0] == _("EPG settings"):
			self.openSetup("epgsettings")
######## Select Mounts Menu ##############################
		elif item[0] == _("Mount Manager"):
			self.session.open(AutoMountManager, None, plugin_path_networkbrowser)
		elif item[0] == _("Network Browser"):
			self.session.open(NetworkBrowser, None, plugin_path_networkbrowser)
		elif item[0] == _("HDD Manager"):
			self.session.open(HddSetup)
		elif item[0] == _("HDD Fast Umount"):
			self.session.open(HddFastRemove)
		elif item[0] == _("SWAP Manager"):
			self.session.open(SwapOverviewScreen)
######## Select Softcam Menu ##############################
		elif item[0] == _("Softcam Panel"):
			self.session.open(NFRCamManager)
		elif item[0] == _("Softcam Config Edit"):
			self.Qsoftcamedit()
			self["sublist"].moveToIndex(0)
######## Select OscamEdit Menu ##############################
		elif item[0] == _("Oscam Config Edit"):
			self.Qoscamedit()
			self["sublist"].moveToIndex(0)
######## Select CCcam Config Edit Menu ##############################
		elif item[0] == _("CCcam Config Edit"):
			self.QCCcamedit()
			self["sublist"].moveToIndex(0)
######## Select Mgcamd Config Edit Menu ##############################
		elif item[0] == _("Mgcamd Config Edit"):
			self.QMgcamdedit()
			self["sublist"].moveToIndex(0)
######## Select Camd3 Config Edit Menu ##############################
		elif item[0] == _("Camd3 Config Edit"):
			self.QCamd3edit()
			self["sublist"].moveToIndex(0)
######## Select Gbox Config Edit Menu ##############################
		elif item[0] == _("Gbox Config Edit"):
			self.QGboxedit()
			self["sublist"].moveToIndex(0)
######## Select Wicard Config Edit Menu ##############################
		elif item[0] == _("Wicard Config Edit"):
			self.QWicarddedit()
			self["sublist"].moveToIndex(0)
		elif item[0] == _("Oscam.server Edit"):
			self.session.open(cEditor, "/usr/keys/oscam.server")
		elif item[0] == _("Oscam.user Edit"):
			self.session.open(cEditor, "/usr/keys/oscam.user")
		elif item[0] == _("Oscam.conf Edit"):
			self.session.open(cEditor, "/usr/keys/oscam.conf")
		elif item[0] == _("Oscam.dvbapi Edit"):
			self.session.open(cEditor, "/usr/keys/oscam.dvbapi")
		elif item[0] == _("CCcam.cfg Edit"):
			self.session.open(cEditor, "/usr/keys/CCcam.cfg")
		elif item[0] == _("mg.cfg Edit"):
			self.session.open(cEditor, "/usr/keys/mg_cfg")
		elif item[0] == _("Mgcamd cccamd.list Edit"):
			self.session.open(cEditor, "/usr/keys/cccamd.list")
		elif item[0] == _("Mgcamd newcamd.list Edit"):
			self.session.open(cEditor, "/usr/keys/newcamd.list")
		elif item[0] == _("camd3.config Edit"):
			self.session.open(cEditor, "/usr/keys/camd3.config")
		elif item[0] == _("camd3.users Edit"):
			self.session.open(cEditor, "/usr/keys/camd3.users")
		elif item[0] == _("camd3.servers Edit"):
			self.session.open(cEditor, "/usr/keys/camd3.servers")
		elif item[0] == _("gbox.cfg Edit"):
			self.session.open(cEditor, "/usr/keys/gbox_cfg")
		elif item[0] == _("cwshare.cfg Edit"):
			self.session.open(cEditor, "/usr/keys/cwshare.cfg")
		elif item[0] == _("wicardd.conf Edit"):
			self.session.open(cEditor, "/usr/keys/wicardd.conf")
######## Select moveplugins Menu ##############################
		elif item[0] == _("Move Plugins to HDD/USB"):
			self.session.open(MovePlugins)
		elif item[0] == _("Move Plugins back to Box"):
			self.session.open(MovePlugins_int)
 ######## Select AV Setup Menu ##############################
		elif item[0] == _("AV Settings"):
			self.session.open(VideoSetup)
		elif item[0] == _("Auto Language"):
			self.openSetup("autolanguagesetup")
		elif item[0] == _("Audio Sync"):
			self.session.open(AC3LipSyncSetup, plugin_path_audiosync)
		elif item[0] == _("VideoEnhancement"):
			self.session.open(VideoEnhancementSetup)
		elif item[0] == _("AutoResolution"):
			self.session.open(AutoResSetupMenu)
######## Select TUNER Setup Menu ##############################
		elif item[0] == _("Tuner Configuration"):
			self.session.open(NimSelection)
		elif item[0] == _("Positioner Setup"):
			self.PositionerMain()
		elif item[0] == _("Automatic Scan"):
			self.session.open(ScanSimple)
		elif item[0] == _("Manual Scan"):
			self.session.open(ScanSetup)
		elif item[0] == _("Sat Finder"):
			self.SatfinderMain()
		elif item[0] == _("Sat Loader"):
			self.session.open(Satloader)
######## Select Software Manager Menu ##############################
		#elif item[0] == _("Software Update"):
			#self.session.open(UpdatePlugin)
			#self.session.open(SoftwarePanel)
		elif item[0] == _("Flash Local-Online"):
			self.session.open(FlashOnline)

		elif item[0] == _("Complete Backup"):
			if DFLASH == True:
				self.session.open(dFlash)
			else:
				self.session.open(TimerImageManager)
		elif item[0] == _("Backup Settings"):
			self.session.openWithCallback(self.backupDone, BackupScreen, runBackup = True)
		elif item[0] == _("Restore Settings"):
			self.backuppath = getBackupPath()
			self.backupfile = getBackupFilename()
			self.fullbackupfilename = self.backuppath + "/" + self.backupfile
			if os_path.exists(self.fullbackupfilename):
				self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore your %s %s backup?\nSTB will restart after the restore") % (getMachineBrand(), getMachineName()))
			else:
				self.session.open(MessageBox, _("Sorry no backups found!"), MessageBox.TYPE_INFO, timeout = 10)
		elif item[0] == _("Select Backup files"):
			self.session.openWithCallback(self.backupfiles_choosen, BackupSelection)
		elif item[0] == _("Software Manager Setup"):
			self.session.open(SoftwareManagerSetup)
######## Select PluginDownloadBrowser Menu ##############################
		elif item[0] == _("Plugin Browser"):
			self.session.open(PluginBrowser)
		elif item[0] == _("Download Plugins"):
			self.session.open(PluginDownloadBrowser, 0)
		elif item[0] == _("Remove Plugins"):
			self.session.open(PluginDownloadBrowser, 1)
		elif item[0] == _("IPK Installer"):
			try:
				from Plugins.Extensions.MediaScanner.plugin import main
				main(self.session)
			except:
				self.session.open(MessageBox, _("Sorry MediaScanner is not installed!"), MessageBox.TYPE_INFO, timeout = 10)
		elif item[0] == _("Move Plugins"):
			self.Qmoveplugins()	
			self["sublist"].moveToIndex(0)
######## Select Harddisk Menu ############################################
		elif item[0] == _("Harddisk Setup"):
			self.openSetup("harddisk")
		elif item[0] == _("Initialization"):
			self.session.open(HarddiskSelection)
		elif item[0] == _("Filesystem Check"):
			self.session.open(HarddiskFsckSelection)
		elif item[0] == _("Convert ext3 to ext4"):
			self.session.open(HarddiskConvertExt4Selection)
######## Select E2-Log Menu ############################################
		elif item[0] == _("E2 Log"):
			self.session.open(E2log)
		elif item[0] == _("LogManager"): 
			self.session.open(LogManager) 
			
######## Select tar Menu ############################################
		elif item[0] == _("PackageManager"):
			self.session.open(InfopanelManagerScreen)
######## Select Oscam Config Edit Menu ##############################
		a_pfad = "/usr/keys/"
		for ordner in os.listdir(a_pfad):
			if "oscam" in ordner:
				if item[0] == _("Oscam.server %s Edit" % ordner):
					self.session.open(cEditor, "/usr/keys/%s/oscam.server" % ordner)
					break
				elif item[0] == _("Oscam.user %s Edit" % ordner):
					self.session.open(cEditor, "/usr/keys/%s/oscam.user" % ordner)
					break
				elif item[0] == _("Oscam.conf %s Edit" % ordner):
					self.session.open(cEditor, "/usr/keys/%s/oscam.conf" % ordner)
					break
				elif item[0] == _("Oscam.dvbapi %s Edit" % ordner):
					self.session.open(cEditor, "/usr/keys/%s/oscam.dvbapi" % ordner)
					break
Example #45
0
 def restartGUI(self, ret=None):
     self.session.open(Console,
                       title=_("Your %s %s will Reboot...") %
                       (getMachineBrand(), getMachineName()),
                       cmdlist=["killall -9 enigma2"])
Example #46
0
	def delay(self, val):
		message = _("Changes need a system restart to take effect.\nRestart your %s %s now?") % (getMachineBrand(), getMachineName())
		ybox = self.session.openWithCallback(self.restartBox, MessageBox, message, MessageBox.TYPE_YESNO)
		ybox.setTitle(_("Restart %s %s.") % (getMachineBrand(), getMachineName()))
Example #47
0
	def __init__(self, session):
		Screen.__init__(self, session)
		self.list = []
		self.device_type = 'auto'
		self.device_uuid = ""
		ConfigListScreen.__init__(self, self.list)
		Screen.setTitle(self, _("Choose where to mount your devices to:"))
		self['key_green'] = Label(_("Save"))
		self['key_red'] = Label(_("Cancel"))
		self['Linconn'] = Label(_("Wait please while scanning your %s %s devices...") % (getMachineBrand(), getMachineName()))
		self['actions'] = ActionMap(['WizardActions', 'ColorActions'], {'green': self.saveMypoints, 'red': self.close, 'back': self.close})
		self.updateList()
Example #48
0
	def populate2(self):
		self.activityTimer.stop()
		self.Console = Console()
		
		self.AboutText = _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName())
		self.AboutText += "\n" + _("Detected NIMs:") + "\n"

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

		self.AboutText += "\n" + _("Detected HDD:") + "\n"

		self.list = []
		list2 = []
		f = open('/proc/partitions', 'r')
		for line in f.readlines():
			parts = line.strip().split()
			if not parts:
				continue
			device = parts[3]
			if not search('sd[a-z][1-9]', device) or not search('mmcblk1p[1-9]', device):
				continue
			if device in list2:
				continue

			mount = '/dev/' + device
			f = open('/proc/mounts', 'r')
			for line in f.readlines():
				if device in line:
					parts = line.strip().split()
					mount = str(parts[1])
					break
			f.close()

			if not mount.startswith('/dev/'):
				size = Harddisk(device).diskSize()
				free = Harddisk(device).free()

				if ((float(size) / 1024) / 1024) >= 1:
					sizeline = _("Size: ") + str(round(((float(size) / 1024) / 1024), 2)) + _("TB")
				elif (size / 1024) >= 1:
					sizeline = _("Size: ") + str(round((float(size) / 1024), 2)) + _("GB")
				elif size >= 1:
					sizeline = _("Size: ") + str(size) + _("MB")
				else:
					sizeline = _("Size: ") + _("unavailable")

				if ((float(free) / 1024) / 1024) >= 1:
					freeline = _("Free: ") + str(round(((float(free) / 1024) / 1024), 2)) + _("TB")
				elif (free / 1024) >= 1:
					freeline = _("Free: ") + str(round((float(free) / 1024), 2)) + _("GB")
				elif free >= 1:
					freeline = _("Free: ") + str(free) + _("MB")
				else:
					freeline = _("Free: ") + _("full")
				self.list.append(mount + '\t' + sizeline + ' \t' + freeline)
			else:
				self.list.append(mount + '\t' + _('Not mounted'))

			list2.append(device)
		self.list = '\n'.join(self.list)
		
		self.AboutText += self.list + "\n"
		self.AboutText += "\n" + _("Network Servers:") + "\n"
		self.mountinfo = _("none")
		self.Console.ePopen("df -mh | grep -v '^Filesystem'", self.Stage1Complete)
		self.AboutText +=self.mountinfo
		self["AboutScrollLabel"].setText(self.AboutText)
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"
    else:
        f = open("/proc/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("/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 ("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

    global STATICBOXINFO
    STATICBOXINFO = info
    return info
Example #50
0
 def __init__(self, resource):
     super(Request, self).__init__()
     self.params = {
         "api_key": "9019fa88-bd0c-4b1b-94ac-6761aa6a664f",
         "application_version": _version_string,
     }
     self.headers = {
         "Content-Type": "application/json",
         "Accept": "application/json",
         "User-Agent": "SystemPlugins.IceTV/%s (%s; %s; %s)" % (_version_string, getMachineBrand(), getMachineName(), getImageBuild()),
     }
     self.url = _protocol + config.plugins.icetv.server.name.value + resource
     self.data = {}
     self.response = None
    def ipkgCallback(self, event, param):
        if event == IpkgComponent.EVENT_DOWNLOAD:
            self.status.setText(_("Downloading"))
        elif event == IpkgComponent.EVENT_UPGRADE:
            if self.sliderPackages.has_key(param):
                self.slider.setValue(self.sliderPackages[param])
            self.package.setText(param)
            self.status.setText(
                _("Upgrading") + ": %s/%s" %
                (self.packages, self.total_packages))
            if not param in self.processed_packages:
                self.processed_packages.append(param)
                self.packages += 1
        elif event == IpkgComponent.EVENT_INSTALL:
            self.package.setText(param)
            self.status.setText(_("Installing"))
            if not param in self.processed_packages:
                self.processed_packages.append(param)
                self.packages += 1
        elif event == IpkgComponent.EVENT_REMOVE:
            self.package.setText(param)
            self.status.setText(_("Removing"))
            if not param in self.processed_packages:
                self.processed_packages.append(param)
                self.packages += 1
        elif event == IpkgComponent.EVENT_CONFIGURING:
            self.package.setText(param)
            self.status.setText(_("Configuring"))

        elif event == IpkgComponent.EVENT_MODIFIED:
            if config.plugins.softwaremanager.overwriteConfigFiles.value in (
                    "N", "Y"):
                self.ipkg.write(
                    True and
                    config.plugins.softwaremanager.overwriteConfigFiles.value)
            else:
                self.session.openWithCallback(
                    self.modificationCallback, MessageBox,
                    _("A configuration file (%s) has been modified since it was installed.\nDo you want to keep your modifications?"
                      ) % param)
        elif event == IpkgComponent.EVENT_ERROR:
            self.error += 1
        elif event == IpkgComponent.EVENT_DONE:
            if self.updating:
                self.updating = False
                self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE_LIST)
            elif self.ipkg.currentCommand == IpkgComponent.CMD_UPGRADE_LIST:
                from urllib import urlopen
                import socket
                currentTimeoutDefault = socket.getdefaulttimeout()
                socket.setdefaulttimeout(3)
                status = urlopen('http://feeds.italysat.eu/status').read()
                if '404 Not Found' in status:
                    status = '1'
                config.softwareupdate.updateisunstable.setValue(status)
                socket.setdefaulttimeout(currentTimeoutDefault)
                self.total_packages = None
                if config.softwareupdate.updateisunstable.value == '1' and config.softwareupdate.updatebeta.value:
                    self.total_packages = len(self.ipkg.getFetchedList())
                    message = _(
                        "The current update may be unstable") + "\n" + _(
                            "Are you sure you want to update your %s %s ?"
                        ) % (getMachineBrand(), getMachineName()) + "\n(" + (
                            ngettext("%s updated package available",
                                     "%s updated packages available",
                                     self.total_packages) %
                            self.total_packages) + ")"
                elif config.softwareupdate.updateisunstable.value == '0':
                    self.total_packages = len(self.ipkg.getFetchedList())
                    message = _("Do you want to update your %s %s ?") % (
                        getMachineBrand(), getMachineName()) + "\n(" + (
                            ngettext("%s updated package available",
                                     "%s updated packages available",
                                     self.total_packages) %
                            self.total_packages) + ")"
                if self.total_packages:
                    global ocram
                    for package_tmp in self.ipkg.getFetchedList():
                        if package_tmp[0].startswith(
                                'enigma2-plugin-picons-tv-ocram'):
                            ocram = ocram + '[ocram-picons] ' + package_tmp[
                                0].split('enigma2-plugin-picons-tv-ocram.')[
                                    1] + 'updated ' + package_tmp[2] + '\n'
                        elif package_tmp[0].startswith(
                                'enigma2-plugin-settings-ocram'):
                            ocram = ocram + '[ocram-settings] ' + package_tmp[
                                0].split('enigma2-plugin-picons-tv-ocram.')[
                                    1] + 'updated ' + package_tmp[2] + '\n'
                    config.softwareupdate.updatefound.setValue(True)
                    choices = [(_("View the changes"), "changes"),
                               (_("Upgrade and reboot system"), "cold")]
                    if path.exists(
                            "/usr/lib/enigma2/python/ItalySat/ItalysatBackupManager.pyo"
                    ):
                        if not config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value:
                            choices.append(
                                (_("Perform a settings backup,") + '\n\t' +
                                 _("making a backup before updating") +
                                 '\n\t' + _("is strongly advised."), "backup"))
                        if not config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value:
                            choices.append((_("Perform a full image backup"),
                                            "imagebackup"))
                    choices.append((_("Update channel list only"), "channels"))
                    choices.append((_("Cancel"), ""))
                    upgrademessage = self.session.openWithCallback(
                        self.startActualUpgrade,
                        ChoiceBox,
                        title=message,
                        list=choices,
                        skin_name="SoftwareUpdateChoices")
                    upgrademessage.setTitle(_('Software update'))
                else:
                    upgrademessage = self.session.openWithCallback(
                        self.close,
                        MessageBox,
                        _("Nothing to upgrade"),
                        type=MessageBox.TYPE_INFO,
                        timeout=10,
                        close_on_any_key=True)
                    upgrademessage.setTitle(_('Software update'))
            elif self.channellist_only > 0:
                if self.channellist_only == 1:
                    self.setEndMessage(
                        _("Could not find installed channel list."))
                elif self.channellist_only == 2:
                    self.slider.setValue(2)
                    self.ipkg.startCmd(IpkgComponent.CMD_REMOVE,
                                       {'package': self.channellist_name})
                    self.channellist_only += 1
                elif self.channellist_only == 3:
                    self.slider.setValue(3)
                    self.ipkg.startCmd(IpkgComponent.CMD_INSTALL,
                                       {'package': self.channellist_name})
                    self.channellist_only += 1
                elif self.channellist_only == 4:
                    self.showUpdateCompletedMessage()
                    eDVBDB.getInstance().reloadBouquets()
                    eDVBDB.getInstance().reloadServicelist()
            elif self.error == 0:
                self.showUpdateCompletedMessage()
            else:
                self.activityTimer.stop()
                self.activityslider.setValue(0)
                error = _(
                    "Your %s %s might be unusable now. Please consult the manual for further assistance before rebooting your %s %s."
                ) % (getMachineBrand(), getMachineName(), getMachineBrand(),
                     getMachineName())
                if self.packages == 0:
                    error = _("No updates available. Please try again later.")
                if self.updating:
                    error = _(
                        "Update failed. Your %s %s does not have a working internet connection."
                    ) % (getMachineBrand(), getMachineName())
                self.status.setText(_("Error") + " - " + error)
        elif event == IpkgComponent.EVENT_LISTITEM:
            if 'enigma2-plugin-settings-' in param[
                    0] and self.channellist_only > 0:
                self.channellist_name = param[0]
                self.channellist_only = 2
        #print event, "-", param
        pass
Example #52
0
    def __init__(self, session):
        Screen.__init__(self, session)
        self.setTitle(_("About"))
        hddsplit, = skin.parameters.get("AboutHddSplit", (0, ))

        AboutText = _("Model: %s %s") % (getMachineBrand(),
                                         getMachineName()) + "\n"
        AboutText += _("Image: ") + about.getImageTypeString() + "\n"
        AboutText += _(
            "Kernel version: ") + about.getKernelVersionString() + "\n"
        if path.exists('/proc/stb/info/chipset'):
            AboutText += _("Chipset: %s") % about.getChipSetString() + "\n"
        AboutText += _("CPU: %s") % about.getCPUString() + "\n"
        AboutText += _("Version: %s") % getImageVersion() + "\n"
        AboutText += _("Build: %s") % getImageBuild() + "\n"
        if path.exists('/proc/stb/info/release') and getBoxType() in (
                'et7000', 'et7500', 'et8500'):
            realdriverdate = open("/proc/stb/info/release", 'r')
            for line in realdriverdate:
                tmp = line.strip()
                AboutText += _("Drivers: %s") % tmp + "\n"
            realdriverdate.close()
        else:
            string = getDriverDate()
            year = string[0:4]
            month = string[4:6]
            day = string[6:8]
            driversdate = '-'.join((year, month, day))
            AboutText += _("Drivers: %s") % driversdate + "\n"
        EnigmaVersion = "Enigma: " + about.getEnigmaVersionString()
        self["EnigmaVersion"] = StaticText(EnigmaVersion)
        AboutText += EnigmaVersion + "\n"
        AboutText += _(
            "Enigma (re)starts: %d\n") % config.misc.startCounter.value

        GStreamerVersion = "GStreamer: " + about.getGStreamerVersionString(
        ).replace("GStreamer", "")
        self["GStreamerVersion"] = StaticText(GStreamerVersion)
        AboutText += GStreamerVersion + "\n"

        ImageVersion = _("Last upgrade: ") + about.getImageVersionString()
        self["ImageVersion"] = StaticText(ImageVersion)
        AboutText += ImageVersion + "\n"

        AboutText += _(
            "Python version: ") + about.getPythonVersionString() + "\n" + "\n"

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

        self["FPVersion"] = StaticText(fp_version)

        skinWidth = getDesktop(0).size().width()
        skinHeight = getDesktop(0).size().height()
        AboutText += _("Skin Name: %s") % config.skin.primary_skin.value[
            0:-9] + _("  (%s x %s)") % (skinWidth, skinHeight) + "\n"

        if path.exists('/etc/enigma2/EtRcType'):
            rfp = open('/etc/enigma2/EtRcType', "r")
            Remote = rfp.read()
            rfp.close
            AboutText += _("Remote control type") + _(": ") + Remote + "\n"
        else:
            AboutText += _("Remote control type") + _(
                ": ") + iRcTypeControl.getBoxType() + "\n"

        if path.exists('/proc/stb/ir/rc/type'):
            fp = open('/proc/stb/ir/rc/type', "r")
            RcID = fp.read()
            fp.close
            AboutText += _("Remote control ID") + _(": ") + RcID

        self["TunerHeader"] = StaticText(_("Detected NIMs:"))
        AboutText += "\n" + _("Detected NIMs:") + "\n"

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

        self["HDDHeader"] = StaticText(_("Detected HDD:"))
        AboutText += "\n" + _("Detected HDD:") + "\n"

        hddlist = harddiskmanager.HDDList()
        hddinfo = ""
        if hddlist:
            formatstring = hddsplit and "%s:%s, %.1f %sB %s" or "%s\n(%s, %.1f %sB %s)"
            for count in range(len(hddlist)):
                if hddinfo:
                    hddinfo += "\n"
                hdd = hddlist[count][1]
                if int(hdd.free()) > 1024:
                    hddinfo += formatstring % (hdd.model(), hdd.capacity(),
                                               hdd.free() / 1024.0, "G",
                                               _("free"))
                else:
                    hddinfo += formatstring % (hdd.model(), hdd.capacity(),
                                               hdd.free(), "M", _("free"))
        else:
            hddinfo = _("none")
        self["hddA"] = StaticText(hddinfo)
        AboutText += hddinfo + "\n\n" + _("Network Info:")
        for x in about.GetIPsFromNetworkInterfaces():
            AboutText += "\n" + x[0] + ": " + x[1]

        self["AboutScrollLabel"] = ScrollLabel(AboutText)
        self["key_green"] = Button(_("Translations"))
        self["key_red"] = Button(_("Latest Commits"))
        self["key_yellow"] = Button(_("Memory Info"))
        self["key_blue"] = Button(_("%s ") % getMachineName() + _("picture"))

        self["actions"] = ActionMap(
            ["ColorActions", "SetupActions", "DirectionActions"], {
                "cancel": self.close,
                "ok": self.close,
                "red": self.showCommits,
                "green": self.showTranslationInfo,
                "yellow": self.showMemoryInfo,
                "blue": self.showModelPic,
                "up": self["AboutScrollLabel"].pageUp,
                "down": self["AboutScrollLabel"].pageDown
            })
Example #53
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
    #: models transcoding feature
    TC_MODELS = ("Uno4K", "Uno4K SE", "Ultimo4K", "Solo4K", "Solo²", "Duo²",
                 "Solo SE", "Quad", "Quad Plus")

    #: machinebuilds transcoding feature
    TC_MACHINEBUILD = ('inihdp', 'hd2400', 'et10000', 'et13000', 'sf5008',
                       'xpeedlx3', 'ew7356', 'dags7356', 'dags7252',
                       'formuler1tc', 'gb7356', 'gb7252', 'tiviaraplus',
                       '8100s')

    if info['model'] in TC_MODELS or info['machinebuild'] in TC_MACHINEBUILD:
        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']
    current_language = language.getLanguage()
    for l in lang:
        if l in current_language:
            info['kinopoisk'] = True
            break

    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
Example #54
0
config.plugins.icetv.server.name = ConfigText(default="api.icetv.com.au")

config.plugins.icetv.member = ConfigSubsection()
config.plugins.icetv.member.email_address = ConfigText(show_help=False,
                                                       fixed_size=False)
config.plugins.icetv.member.token = ConfigText()
config.plugins.icetv.member.id = ConfigNumber()
config.plugins.icetv.member.region_id = ConfigNumber()
config.plugins.icetv.member.country = ConfigText(default="AUS")

config.plugins.icetv.member.password = NoSave(
    ConfigPassword(censor="●", show_help=False, fixed_size=False))

config.plugins.icetv.device = ConfigSubsection()
config.plugins.icetv.device.label = ConfigText(
    default="%s %s" % (getMachineBrand(), getMachineName()), show_help=False)
config.plugins.icetv.device.id = ConfigNumber()
config.plugins.icetv.device.type_id = ConfigNumber(
    default=getIceTVDeviceType())

config.plugins.icetv.last_update_time = ConfigNumber()
if config.plugins.icetv.last_update_time.value != 0:
    config.plugins.icetv.last_update_time.value = 0
    config.plugins.icetv.last_update_time.save()
    configfile.save()
config.plugins.icetv.last_update_time.disableSave()

config.plugins.icetv.enable_epg = ConfigYesNo(default=False)
config.plugins.icetv.configured = ConfigYesNo(default=False)

minute = 60
Example #55
0
class PowerTimerEntry(timer.TimerEntry, object):
	def __init__(self, begin, end, disabled = False, afterEvent = AFTEREVENT.NONE, timerType = TIMERTYPE.WAKEUP, checkOldTimers = False, autosleepdelay = 60):
		timer.TimerEntry.__init__(self, int(begin), int(end))
		if checkOldTimers:
			if self.begin < time() - 1209600:
				self.begin = int(time())

		if self.end < self.begin:
			self.end = self.begin

		self.dontSave = False
		self.disabled = disabled
		self.timer = None
		self.__record_service = None
		self.start_prepare = 0
		self.timerType = timerType
		self.afterEvent = afterEvent
		self.autoincrease = False
		self.autoincreasetime = 3600 * 24 # 1 day
		self.autosleepinstandbyonly = 'no'
		self.autosleepdelay = autosleepdelay
		self.autosleeprepeat = 'once'
		self.autosleepwindow = 'no'
		self.autosleepbegin = self.begin
		self.autosleepend = self.end

		self.nettraffic = 'no'
		self.trafficlimit = 100
		self.netip = 'no'
		self.ipadress = "0.0.0.0"

		self.log_entries = []
		self.resetState()

		self.messageBoxAnswerPending = False

		#check autopowertimer
		if (self.timerType == TIMERTYPE.AUTOSTANDBY or self.timerType == TIMERTYPE.AUTODEEPSTANDBY) and not self.disabled and time() > 3600 and self.begin > time():
			self.begin = int(time())						#the begin is in the future -> set to current time = no start delay of this timer

	def __repr__(self):
		timertype = {
			TIMERTYPE.NONE: "nothing",
			TIMERTYPE.WAKEUP: "wakeup",
			TIMERTYPE.WAKEUPTOSTANDBY: "wakeuptostandby",
			TIMERTYPE.AUTOSTANDBY: "autostandby",
			TIMERTYPE.AUTODEEPSTANDBY: "autodeepstandby",
			TIMERTYPE.STANDBY: "standby",
			TIMERTYPE.DEEPSTANDBY: "deepstandby",
			TIMERTYPE.REBOOT: "reboot",
			TIMERTYPE.RESTART: "restart"
			}[self.timerType]
		if not self.disabled:
			return "PowerTimerEntry(type=%s, begin=%s)" % (timertype, ctime(self.begin))
		else:
			return "PowerTimerEntry(type=%s, begin=%s Disabled)" % (timertype, ctime(self.begin))

	def log(self, code, msg):
		self.log_entries.append((int(time()), code, msg))

	def do_backoff(self):
		if Screens.Standby.inStandby and not wasTimerWakeup or RSsave or RBsave or aeDSsave or DSsave:
			self.backoff = 300
		else:
			if self.backoff == 0:
				self.backoff = 300
			else:
				self.backoff += 300
				if self.backoff > 900:
					self.backoff = 900
		self.log(10, "backoff: retry in %d minutes" % (int(self.backoff)/60))

	def activate(self):
		global RSsave, RBsave, DSsave, aeDSsave, wasTimerWakeup, InfoBar

		if not InfoBar:
			try:
				from Screens.InfoBar import InfoBar
			except Exception, e:
				print "[PowerTimer] import from 'Screens.InfoBar import InfoBar' failed:", e

		isRecTimerWakeup = breakPT = shiftPT = False
		now = time()
		next_state = self.state + 1
		self.log(5, "activating state %d" % next_state)
		if next_state == self.StatePrepared and (self.timerType == TIMERTYPE.AUTOSTANDBY or self.timerType == TIMERTYPE.AUTODEEPSTANDBY):
			eActionMap.getInstance().bindAction('', -0x7FFFFFFF, self.keyPressed)
			if self.autosleepwindow == 'yes':
				ltm = localtime(now)
				asb = strftime("%H:%M", localtime(self.autosleepbegin)).split(':')
				ase = strftime("%H:%M", localtime(self.autosleepend)).split(':')
				self.autosleepbegin = int(mktime(datetime(ltm.tm_year, ltm.tm_mon, ltm.tm_mday, int(asb[0]), int(asb[1])).timetuple()))
				self.autosleepend = int(mktime(datetime(ltm.tm_year, ltm.tm_mon, ltm.tm_mday, int(ase[0]), int(ase[1])).timetuple()))
				if self.autosleepend <= self.autosleepbegin:
					self.autosleepbegin -= 86400
			if self.getAutoSleepWindow():
				if now < self.autosleepbegin and now > self.autosleepbegin - self.prepare_time - 3:	#begin is in prepare time window
					self.begin = self.end = self.autosleepbegin + int(self.autosleepdelay)*60
				else:
					self.begin = self.end = int(now) + int(self.autosleepdelay)*60
			else:
				return False
			if self.timerType == TIMERTYPE.AUTODEEPSTANDBY:
				self.getNetworkTraffic(getInitialValue = True)

		if (next_state == self.StateRunning or next_state == self.StateEnded) and NavigationInstance.instance.PowerTimer is None:
			#TODO: running/ended timer at system start has no nav instance
			#First fix: crash in getPriorityCheck (NavigationInstance.instance.PowerTimer...)
			#Second fix: suppress the message (A finished powertimer wants to ...)
			if debug: print "*****NavigationInstance.instance.PowerTimer is None*****", self.timerType, self.state, ctime(self.begin), ctime(self.end)
			return True
		elif next_state == self.StateRunning and abs(self.begin - now) > 900: return True
		elif next_state == self.StateEnded and abs(self.end - now) > 900: return True

		if next_state == self.StateRunning or next_state == self.StateEnded:
			if NavigationInstance.instance.isRecordTimerImageStandard:
				isRecTimerWakeup = NavigationInstance.instance.RecordTimer.isRecTimerWakeup()
			if isRecTimerWakeup:
				wasTimerWakeup = True
			elif os.path.exists("/tmp/was_powertimer_wakeup") and not wasTimerWakeup:
				wasTimerWakeup = int(open("/tmp/was_powertimer_wakeup", "r").read()) and True or False

		if next_state == self.StatePrepared:
			self.log(6, "prepare ok, waiting for begin: %s" % ctime(self.begin))
			self.backoff = 0
			return True

		elif next_state == self.StateRunning:

			# if this timer has been cancelled, just go to "end" state.
			if self.cancelled:
				return True

			if self.failed:
				return True

			if self.timerType == TIMERTYPE.NONE:
				return True

			elif self.timerType == TIMERTYPE.WAKEUP:
				if Screens.Standby.inStandby:
					Screens.Standby.inStandby.Power()
				return True

			elif self.timerType == TIMERTYPE.WAKEUPTOSTANDBY:
				return True

			elif self.timerType == TIMERTYPE.STANDBY:
				if debug: print "self.timerType == TIMERTYPE.STANDBY:"
				prioPT = [TIMERTYPE.WAKEUP,TIMERTYPE.RESTART,TIMERTYPE.REBOOT,TIMERTYPE.DEEPSTANDBY]
				prioPTae = [AFTEREVENT.WAKEUP,AFTEREVENT.DEEPSTANDBY]
				shiftPT,breakPT = self.getPriorityCheck(prioPT,prioPTae)
				if not Screens.Standby.inStandby and not breakPT: # not already in standby
					callback = self.sendStandbyNotification
					message = _("A finished powertimer wants to set your\n%s %s to standby. Do that now?") % (getMachineBrand(), getMachineName())
					messageboxtyp = MessageBox.TYPE_YESNO
					timeout = 180
					default = True
					if InfoBar and InfoBar.instance:
						InfoBar.instance.openInfoBarMessageWithCallback(callback, message, messageboxtyp, timeout, default)
					else:
						Notifications.AddNotificationWithCallback(callback, MessageBox, message, messageboxtyp, timeout = timeout, default = default)
				return True

			elif self.timerType == TIMERTYPE.AUTOSTANDBY:
				if debug: print "self.timerType == TIMERTYPE.AUTOSTANDBY:"
				if not self.getAutoSleepWindow():
					return False
				if not Screens.Standby.inStandby and not self.messageBoxAnswerPending: # not already in standby
					self.messageBoxAnswerPending = True
					callback = self.sendStandbyNotification
					message = _("A finished powertimer wants to set your\n%s %s to standby. Do that now?") % (getMachineBrand(), getMachineName())
					messageboxtyp = MessageBox.TYPE_YESNO
					timeout = 180
					default = True
					if InfoBar and InfoBar.instance:
						InfoBar.instance.openInfoBarMessageWithCallback(callback, message, messageboxtyp, timeout, default)
					else:
						Notifications.AddNotificationWithCallback(callback, MessageBox, message, messageboxtyp, timeout = timeout, default = default)
					if self.autosleeprepeat == "once":
						eActionMap.getInstance().unbindAction('', self.keyPressed)
						return True
					else:
						self.begin = self.end = int(now) + int(self.autosleepdelay)*60
				else:
					self.begin = self.end = int(now) + int(self.autosleepdelay)*60

			elif self.timerType == TIMERTYPE.AUTODEEPSTANDBY:
				if debug: print "self.timerType == TIMERTYPE.AUTODEEPSTANDBY:"
				if not self.getAutoSleepWindow():
					return False
				if isRecTimerWakeup or (self.autosleepinstandbyonly == 'yes' and not Screens.Standby.inStandby) \
					or NavigationInstance.instance.PowerTimer.isProcessing() or abs(NavigationInstance.instance.PowerTimer.getNextPowerManagerTime() - now) <= 900 or self.getNetworkAdress() or self.getNetworkTraffic() \
					or NavigationInstance.instance.RecordTimer.isRecording() or abs(NavigationInstance.instance.RecordTimer.getNextRecordingTime() - now) <= 900 or abs(NavigationInstance.instance.RecordTimer.getNextZapTime() - now) <= 900:
					self.do_backoff()
					# retry
					self.begin = self.end = int(now) + self.backoff
					return False
				elif not Screens.Standby.inTryQuitMainloop: # not a shutdown messagebox is open
					if self.autosleeprepeat == "once":
						self.disabled = True
					if Screens.Standby.inStandby or self.autosleepinstandbyonly == 'noquery': # in standby or option 'without query' is enabled
						print "[PowerTimer] quitMainloop #1"
						quitMainloop(1)
						return True
					elif not self.messageBoxAnswerPending:
						self.messageBoxAnswerPending = True
						callback = self.sendTryQuitMainloopNotification
						message = _("A finished powertimer wants to shutdown your %s %s.\nDo that now?") % (getMachineBrand(), getMachineName())
						messageboxtyp = MessageBox.TYPE_YESNO
						timeout = 180
						default = True
						if InfoBar and InfoBar.instance:
							InfoBar.instance.openInfoBarMessageWithCallback(callback, message, messageboxtyp, timeout, default)
						else:
							Notifications.AddNotificationWithCallback(callback, MessageBox, message, messageboxtyp, timeout = timeout, default = default)
						if self.autosleeprepeat == "once":
							eActionMap.getInstance().unbindAction('', self.keyPressed)
							return True
					self.begin = self.end = int(now) + int(self.autosleepdelay)*60

			elif self.timerType == TIMERTYPE.RESTART:
				if debug: print "self.timerType == TIMERTYPE.RESTART:"
				#check priority
				prioPT = [TIMERTYPE.RESTART,TIMERTYPE.REBOOT,TIMERTYPE.DEEPSTANDBY]
				prioPTae = [AFTEREVENT.DEEPSTANDBY]
				shiftPT,breakPT = self.getPriorityCheck(prioPT,prioPTae)
				#a timer with higher priority was shifted - no execution of current timer
				if RBsave or aeDSsave or DSsave:
					if debug: print "break#1"
					breakPT = True
				#a timer with lower priority was shifted - shift now current timer and wait for restore the saved time values from other timer
				if False:
					if debug: print "shift#1"
					breakPT = False
					shiftPT = True
				#shift or break
				if isRecTimerWakeup or shiftPT or breakPT \
					or NavigationInstance.instance.RecordTimer.isRecording() or abs(NavigationInstance.instance.RecordTimer.getNextRecordingTime() - now) <= 900 or abs(NavigationInstance.instance.RecordTimer.getNextZapTime() - now) <= 900:
					if self.repeated and not RSsave:
						self.savebegin = self.begin
						self.saveend = self.end
						RSsave = True
					if not breakPT:
						self.do_backoff()
						#check difference begin to end before shift begin time
						if RSsave and self.end - self.begin > 3 and self.end - now - self.backoff <= 240: breakPT = True
					#breakPT
					if breakPT:
						if self.repeated and RSsave:
							try:
								self.begin = self.savebegin
								self.end = self.saveend
							except:
								pass
						RSsave = False
						return True
					# retry
					oldbegin = self.begin
					self.begin = int(now) + self.backoff
					if abs(self.end - oldbegin) <= 3:
						self.end = self.begin
					else:
						if not self.repeated and self.end < self.begin + 300:
							self.end = self.begin + 300
					return False
				elif not Screens.Standby.inTryQuitMainloop: # not a shutdown messagebox is open
					if self.repeated and RSsave:
						try:
							self.begin = self.savebegin
							self.end = self.saveend
						except:
							pass
					if Screens.Standby.inStandby: # in standby
						print "[PowerTimer] quitMainloop #4"
						quitMainloop(3)
					else:
						callback = self.sendTryToRestartNotification
						message = _("A finished powertimer wants to restart the user interface.\nDo that now?") % (getMachineBrand(), getMachineName())
						messageboxtyp = MessageBox.TYPE_YESNO
						timeout = 180
						default = True
						if InfoBar and InfoBar.instance:
							InfoBar.instance.openInfoBarMessageWithCallback(callback, message, messageboxtyp, timeout, default)
						else:
							Notifications.AddNotificationWithCallback(callback, MessageBox, message, messageboxtyp, timeout = timeout, default = default)
				RSsave = False
				return True

			elif self.timerType == TIMERTYPE.REBOOT:
				if debug: print "self.timerType == TIMERTYPE.REBOOT:"
				#check priority
				prioPT = [TIMERTYPE.REBOOT,TIMERTYPE.DEEPSTANDBY]
				prioPTae = [AFTEREVENT.DEEPSTANDBY]
				shiftPT,breakPT = self.getPriorityCheck(prioPT,prioPTae)
				#a timer with higher priority was shifted - no execution of current timer
				if aeDSsave or DSsave:
					if debug: print "break#1"
					breakPT = True
				#a timer with lower priority was shifted - shift now current timer and wait for restore the saved time values from other timer
				if RSsave:
					if debug: print "shift#1"
					breakPT = False
					shiftPT = True
				#shift or break
				if isRecTimerWakeup or shiftPT or breakPT \
					or NavigationInstance.instance.RecordTimer.isRecording() or abs(NavigationInstance.instance.RecordTimer.getNextRecordingTime() - now) <= 900 or abs(NavigationInstance.instance.RecordTimer.getNextZapTime() - now) <= 900:
					if self.repeated and not RBsave:
						self.savebegin = self.begin
						self.saveend = self.end
						RBsave = True
					if not breakPT:
						self.do_backoff()
						#check difference begin to end before shift begin time
						if RBsave and self.end - self.begin > 3 and self.end - now - self.backoff <= 240: breakPT = True
					#breakPT
					if breakPT:
						if self.repeated and RBsave:
							try:
								self.begin = self.savebegin
								self.end = self.saveend
							except:
								pass
						RBsave = False
						return True
					# retry
					oldbegin = self.begin
					self.begin = int(now) + self.backoff
					if abs(self.end - oldbegin) <= 3:
						self.end = self.begin
					else:
						if not self.repeated and self.end < self.begin + 300:
							self.end = self.begin + 300
					return False
				elif not Screens.Standby.inTryQuitMainloop: # not a shutdown messagebox is open
					if self.repeated and RBsave:
						try:
							self.begin = self.savebegin
							self.end = self.saveend
						except:
							pass
					if Screens.Standby.inStandby: # in standby
						print "[PowerTimer] quitMainloop #3"
						quitMainloop(2)
					else:
						callback = self.sendTryToRebootNotification
						message = _("A finished powertimer wants to reboot your %s %s.\nDo that now?") % (getMachineBrand(), getMachineName())
						messageboxtyp = MessageBox.TYPE_YESNO
						timeout = 180
						default = True
						if InfoBar and InfoBar.instance:
							InfoBar.instance.openInfoBarMessageWithCallback(callback, message, messageboxtyp, timeout, default)
						else:
							Notifications.AddNotificationWithCallback(callback, MessageBox, message, messageboxtyp, timeout = timeout, default = default)
				RBsave = False
				return True

			elif self.timerType == TIMERTYPE.DEEPSTANDBY:
				if debug: print "self.timerType == TIMERTYPE.DEEPSTANDBY:"
				#check priority
				prioPT = [TIMERTYPE.WAKEUP,TIMERTYPE.WAKEUPTOSTANDBY,TIMERTYPE.DEEPSTANDBY]
				prioPTae = [AFTEREVENT.WAKEUP,AFTEREVENT.WAKEUPTOSTANDBY,AFTEREVENT.DEEPSTANDBY]
				shiftPT,breakPT = self.getPriorityCheck(prioPT,prioPTae)
				#a timer with higher priority was shifted - no execution of current timer
				if False:
					if debug: print "break#1"
					breakPT = True
				#a timer with lower priority was shifted - shift now current timer and wait for restore the saved time values from other timer
				if RSsave or RBsave or aeDSsave:
					if debug: print "shift#1"
					breakPT = False
					shiftPT = True
				#shift or break
				if isRecTimerWakeup or shiftPT or breakPT \
					or NavigationInstance.instance.RecordTimer.isRecording() or abs(NavigationInstance.instance.RecordTimer.getNextRecordingTime() - now) <= 900 or abs(NavigationInstance.instance.RecordTimer.getNextZapTime() - now) <= 900:
					if self.repeated and not DSsave:
						self.savebegin = self.begin
						self.saveend = self.end
						DSsave = True
					if not breakPT:
						self.do_backoff()
						#check difference begin to end before shift begin time
						if DSsave and self.end - self.begin > 3 and self.end - now - self.backoff <= 240: breakPT = True
					#breakPT
					if breakPT:
						if self.repeated and DSsave:
							try:
								self.begin = self.savebegin
								self.end = self.saveend
							except:
								pass
						DSsave = False
						return True
					# retry
					oldbegin = self.begin
					self.begin = int(now) + self.backoff
					if abs(self.end - oldbegin) <= 3:
						self.end = self.begin
					else:
						if not self.repeated and self.end < self.begin + 300:
							self.end = self.begin + 300
					return False
				elif not Screens.Standby.inTryQuitMainloop: # not a shutdown messagebox is open
					if self.repeated and DSsave:
						try:
							self.begin = self.savebegin
							self.end = self.saveend
						except:
							pass
					if Screens.Standby.inStandby: # in standby
						print "[PowerTimer] quitMainloop #2"
						quitMainloop(1)
					else:
						callback = self.sendTryQuitMainloopNotification
						message = _("A finished powertimer wants to shutdown your %s %s.\nDo that now?") % (getMachineBrand(), getMachineName())
						messageboxtyp = MessageBox.TYPE_YESNO
						timeout = 180
						default = True
						if InfoBar and InfoBar.instance:
							InfoBar.instance.openInfoBarMessageWithCallback(callback, message, messageboxtyp, timeout, default)
						else:
							Notifications.AddNotificationWithCallback(callback, MessageBox, message, messageboxtyp, timeout = timeout, default = default)
				DSsave = False
				return True

		elif next_state == self.StateEnded:
			if self.afterEvent == AFTEREVENT.WAKEUP:
				if Screens.Standby.inStandby:
					Screens.Standby.inStandby.Power()
			elif self.afterEvent == AFTEREVENT.STANDBY:
				if not Screens.Standby.inStandby: # not already in standby
					callback = self.sendStandbyNotification
					message = _("A finished powertimer wants to set your\n%s %s to standby. Do that now?") % (getMachineBrand(), getMachineName())
					messageboxtyp = MessageBox.TYPE_YESNO
					timeout = 180
					default = True
					if InfoBar and InfoBar.instance:
						InfoBar.instance.openInfoBarMessageWithCallback(callback, message, messageboxtyp, timeout, default)
					else:
						Notifications.AddNotificationWithCallback(callback, MessageBox, message, messageboxtyp, timeout = timeout, default = default)
			elif self.afterEvent == AFTEREVENT.DEEPSTANDBY:
				if debug: print "self.afterEvent == AFTEREVENT.DEEPSTANDBY:"
				#check priority
				prioPT = [TIMERTYPE.WAKEUP,TIMERTYPE.WAKEUPTOSTANDBY,TIMERTYPE.DEEPSTANDBY]
				prioPTae = [AFTEREVENT.WAKEUP,AFTEREVENT.WAKEUPTOSTANDBY,AFTEREVENT.DEEPSTANDBY]
				shiftPT,breakPT = self.getPriorityCheck(prioPT,prioPTae)
				#a timer with higher priority was shifted - no execution of current timer
				if DSsave:
					if debug: print "break#1"
					breakPT = True
				#a timer with lower priority was shifted - shift now current timer and wait for restore the saved time values
				if RSsave or RBsave:
					if debug: print "shift#1"
					breakPT = False
					shiftPT = True
				#shift or break
				runningPT = False
				#option: check other powertimer is running (current disabled)
				#runningPT = NavigationInstance.instance.PowerTimer.isProcessing(exceptTimer = TIMERTYPE.NONE, endedTimer = self.timerType)
				if isRecTimerWakeup or shiftPT or breakPT or runningPT \
					or NavigationInstance.instance.RecordTimer.isRecording() or abs(NavigationInstance.instance.RecordTimer.getNextRecordingTime() - now) <= 900 or abs(NavigationInstance.instance.RecordTimer.getNextZapTime() - now) <= 900:
					if self.repeated and not aeDSsave:
						self.savebegin = self.begin
						self.saveend = self.end
						aeDSsave = True
					if not breakPT: self.do_backoff()
					#breakPT
					if breakPT:
						if self.repeated and aeDSsave:
							try:
								self.begin = self.savebegin
								self.end = self.saveend
							except:
								pass
						aeDSsave = False
						return True
					# retry
					self.end = int(now) + self.backoff
					return False
				elif not Screens.Standby.inTryQuitMainloop: # not a shutdown messagebox is open
					if self.repeated and aeDSsave:
						try:
							self.begin = self.savebegin
							self.end = self.saveend
						except:
							pass
					if Screens.Standby.inStandby: # in standby
						print "[PowerTimer] quitMainloop #5"
						quitMainloop(1)
					else:
						callback = self.sendTryQuitMainloopNotification
						message = _("A finished powertimer wants to shutdown your %s %s.\nDo that now?") % (getMachineBrand(), getMachineName())
						messageboxtyp = MessageBox.TYPE_YESNO
						timeout = 180
						default = True
						if InfoBar and InfoBar.instance:
							InfoBar.instance.openInfoBarMessageWithCallback(callback, message, messageboxtyp, timeout, default)
						else:
							Notifications.AddNotificationWithCallback(callback, MessageBox, message, messageboxtyp, timeout = timeout, default = default)
				aeDSsave = False
			NavigationInstance.instance.PowerTimer.saveTimer()
			resetTimerWakeup()
			return True
Example #56
0
    def populate(self):
        self["lab1"] = StaticText(_("Open Black Hole"))
        self["lab2"] = StaticText(_("From the BH Team"))
        model = None
        AboutText = ""
        self["lab3"] = StaticText(
            _("Support at %s") % "www.vuplus-community.net")

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

        if about.getChipSetString() != _("unavailable"):
            if SystemInfo["HasHiSi"]:
                AboutText += _("Chipset:\tHiSilicon %s\n"
                               ) % about.getChipSetString().upper()
            elif about.getIsBroadcom():
                AboutText += _("Chipset:\tBroadcom %s\n"
                               ) % about.getChipSetString().upper()
            else:
                AboutText += _(
                    "Chipset:\t%s\n") % about.getChipSetString().upper()

        AboutText += _("CPU:\t%s %s %s\n") % (about.getCPUArch(),
                                              about.getCPUSpeedString(),
                                              about.getCpuCoresString())
        imageSubBuild = ""
        if getImageType() != 'release':
            imageSubBuild = ".%s" % getImageDevBuild()
        AboutText += _("Image:\t%s.%s%s (%s)\n") % (getImageVersion(
        ), getImageBuild(), imageSubBuild, getImageType().title())

        if SystemInfo["HasH9SD"]:
            if "rootfstype=ext4" in open(
                    '/sys/firmware/devicetree/base/chosen/bootargs',
                    'r').read():
                part = "        - SD card in use for Image root \n"
            else:
                part = "        - eMMC slot in use for Image root \n"
            AboutText += _("%s") % part

        if SystemInfo["canMultiBoot"]:
            slot = image = GetCurrentImage()
            part = "eMMC slot %s" % slot
            bootmode = ""
            if SystemInfo["canMode12"]:
                bootmode = "bootmode = %s" % GetCurrentImageMode()
            print "[About] HasHiSi = %s, slot = %s" % (SystemInfo["HasHiSi"],
                                                       slot)
            if SystemInfo["HasHiSi"] and "sda" in SystemInfo["canMultiBoot"][
                    slot]['root']:
                if slot > 4:
                    image -= 4
                else:
                    image -= 1
                part = "SDcard slot %s (%s) " % (
                    image, SystemInfo["canMultiBoot"][slot]['root'])
            AboutText += _("Image Slot:\t%s") % "STARTUP_" + str(
                slot) + "  " + part + " " + bootmode + "\n"

        skinWidth = getDesktop(0).size().width()
        skinHeight = getDesktop(0).size().height()

        string = getDriverDate()
        year = string[0:4]
        month = string[4:6]
        day = string[6:8]
        driversdate = '-'.join((year, month, day))
        AboutText += _("Drivers:\t%s\n") % driversdate
        AboutText += _("Kernel:\t%s\n") % about.getKernelVersionString()
        AboutText += _("GStreamer:\t%s\n") % about.getGStreamerVersionString(
        ).replace("GStreamer ", "")
        AboutText += _("Python:\t%s\n") % about.getPythonVersionString()
        AboutText += _("Installed:\t%s\n") % about.getFlashDateString()
        AboutText += _("Last update:\t%s\n") % getEnigmaVersionString()
        AboutText += _("E2 (re)starts:\t%s\n") % config.misc.startCounter.value
        uptime = about.getBoxUptime()
        if uptime:
            AboutText += _("Uptime:\t%s\n") % uptime
        e2uptime = about.getEnigmaUptime()
        if e2uptime:
            AboutText += _("Enigma2 uptime:\t%s\n") % e2uptime
        AboutText += _("Skin:\t%s") % config.skin.primary_skin.value[0:-9] + _(
            "  (%s x %s)") % (skinWidth, skinHeight) + "\n"

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

        tempinfo = ""
        if path.exists('/proc/stb/fp/temp_sensor_avs'):
            with open('/proc/stb/fp/temp_sensor_avs', 'r') as f:
                tempinfo = f.read()
        elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'):
            try:
                with open('/sys/devices/virtual/thermal/thermal_zone0/temp',
                          'r') as f:
                    tempinfo = f.read()
                    tempinfo = tempinfo[:-4]
            except:
                tempinfo = ""
        elif path.exists('/proc/hisi/msp/pm_cpu'):
            try:
                tempinfo = search(
                    'temperature = (\d+) degree',
                    open("/proc/hisi/msp/pm_cpu").read()).group(1)
            except:
                tempinfo = ""
        if tempinfo and int(tempinfo) > 0:
            mark = str('\xc2\xb0')
            AboutText += _("Processor temp:\t%s") % tempinfo.replace(
                '\n', '').replace(' ', '') + mark + "C\n"
        AboutLcdText = AboutText.replace('\t', ' ')

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

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

        self["AboutScrollLabel"] = ScrollLabel(AboutText)
Example #57
0
from Components.Pixmap import Pixmap
from Components.config import config, ConfigBoolean, configfile

from Tools.Directories import resolveFilename, SCOPE_SKIN, SCOPE_ACTIVE_SKIN
from Tools.HardwareInfo import HardwareInfo

from os import system

config.misc.showtestcard = ConfigBoolean(default=False)

boxtype = getBoxType()

has_rca = False
has_dvi = False
if boxtype == 'gbquad' or boxtype == 'gbquadplus' or boxtype == 'et5x00' or boxtype == 'et6000' or boxtype == 'e3hd' or boxtype == 'odinm6' or getMachineName(
) == 'AX-Odin' or boxtype == 'ebox7358' or boxtype == 'eboxlumi' or boxtype == 'tmnano' or boxtype == 'ultra' or boxtype == "me" or boxtype == "minime" or boxtype == 'optimussos1' or boxtype == 'optimussos2' or boxtype == 'gb800seplus' or boxtype == 'gb800ueplus' or boxtype == 'sezam1000hd' or boxtype == 'mbmini' or boxtype == 'ixussone' or boxtype == 'ixusszero' or boxtype == 'enfinity' or boxtype == 'force1':
    has_rca = True
if boxtype == 'dm8000' or boxtype == 'dm800':
    has_dvi = True


class VideoWizardSummary(WizardSummary):
    skin = (
        """<screen name="VideoWizardSummary" position="0,0" size="132,64" id="1">
		<widget name="text" position="6,4" size="120,40" font="Regular;12" transparent="1" />
		<widget source="parent.list" render="Label" position="6,40" size="120,21" font="Regular;14">
			<convert type="StringListSelection" />
		</widget>
		<!--widget name="pic" pixmap="%s" position="6,22" zPosition="10" size="64,64" transparent="1" alphatest="on"/-->
	</screen>""",
        """<screen name="VideoWizardSummary" position="0,0" size="96,64" id="2">
Example #58
0
    def populate(self):
        def netspeed():
            netspeed = ""
            for line in popen('ethtool eth0 |grep Speed', 'r'):
                line = line.strip().split(":")
                line = line[1].replace(' ', '')
                netspeed += line
                return str(netspeed)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        self["AboutScrollLabel"] = ScrollLabel(AboutText)
Example #59
0
def getAboutText():
	AboutText = ""
	AboutText += _("Model:\t%s %s\n") % (getMachineBrand(), getMachineName())

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

	cpuMHz = ""
	if getBoxType() in ('vusolo4k'):
		cpuMHz = "   (1,5 GHz)"
	else:
		if path.exists('/proc/cpuinfo'):
			f = open('/proc/cpuinfo', 'r')
			temp = f.readlines()
			f.close()
			try:
				for lines in temp:
					lisp = lines.split(': ')
					if lisp[0].startswith('cpu MHz'):
						#cpuMHz = "   (" +  lisp[1].replace('\n', '') + " MHz)"
						cpuMHz = "   (" +  str(int(float(lisp[1].replace('\n', '')))) + " MHz)"
						break
			except:
				pass

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

	AboutText += _("Version:\t%s") % getImageVersion() + "\n"
	AboutText += _("Build:\t%s") % getImageBuild() + "\n"
	AboutText += _("Kernel:\t%s") % about.getKernelVersionString() + "\n"

	string = getDriverDate()
	year = string[0:4]
	month = string[4:6]
	day = string[6:8]
	driversdate = '-'.join((year, month, day))
	AboutText += _("Drivers:\t%s") % driversdate + "\n"

	AboutText += _("GStreamer:\t%s") % about.getGStreamerVersionString() + "\n"
	AboutText += _("Python:\t%s") % about.getPythonVersionString() + "\n"

	AboutText += _("Installed:\t%s") % about.getFlashDateString() + "\n"
	AboutText += _("Last update:\t%s") % getEnigmaVersionString() + "\n"

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

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

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

	return AboutText, AboutLcdText
Example #60
0
	def __init__(self, session):
		Screen.__init__(self, session)
		
		OpenNFRVersion = _("OpenNFR %s") % about.getImageVersionString()
		self["OpenNFRVersion"] = Label(OpenNFRVersion)
		
		AboutText = _("Model:\t\t%s %s\n") % (getMachineBrand(), getMachineName())
		
		bootloader = ""
                if path.exists('/sys/firmware/devicetree/base/bolt/tag'):
		        f = open('/sys/firmware/devicetree/base/bolt/tag', 'r')
	                bootloader = f.readline().replace('\x00', '').replace('\n', '')
		        f.close()
			AboutText += _("Bootloader:\t\t%s\n") % (bootloader)

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

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

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

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

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

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

		self["FPVersion"] = StaticText(fp_version)

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

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

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

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

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

		self["FPVersion"] = StaticText(fp_version)

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

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

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

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

		self["actions"] = ActionMap(["SetupActions", "ColorActions", "DirectionActions"], 
			{
				"cancel": self.close,
				"ok": self.close,
				"green": self.showTranslationInfo,
				"up": self["AboutScrollLabel"].pageUp,
				"down": self["AboutScrollLabel"].pageDown
			})