def setupConfigEntries(self,device): cmd = "config.inputDevices." + device + " = ConfigSubsection()" exec (cmd) if getBoxType() == 'dm800' or getBoxType() == 'odinm9' or getBoxType() == 'odinm7' or getBoxType() == 'odinm6' or getBoxType() == 'azboxhd': cmd = "config.inputDevices." + device + ".enabled = ConfigYesNo(default = False)" else: cmd = "config.inputDevices." + device + ".enabled = ConfigYesNo(default = False)" exec (cmd) cmd = "config.inputDevices." + device + ".enabled.addNotifier(self.inputDevicesEnabledChanged,config.inputDevices." + device + ".enabled)" exec (cmd) cmd = "config.inputDevices." + device + '.name = ConfigText(default="")' exec (cmd) cmd = "config.inputDevices." + device + ".name.addNotifier(self.inputDevicesNameChanged,config.inputDevices." + device + ".name)" exec (cmd) if getBoxType() == 'odinm9' or getBoxType() == 'odinm7' or getBoxType() == 'odinm6': cmd = "config.inputDevices." + device + ".repeat = ConfigSlider(default=400, increment = 10, limits=(0, 500))" elif getBoxType() == 'azboxhd': cmd = "config.inputDevices." + device + ".repeat = ConfigSlider(default=150, increment = 10, limits=(0, 500))" else: cmd = "config.inputDevices." + device + ".repeat = ConfigSlider(default=100, increment = 10, limits=(0, 500))" exec (cmd) cmd = "config.inputDevices." + device + ".repeat.addNotifier(self.inputDevicesRepeatChanged,config.inputDevices." + device + ".repeat)" exec (cmd) if getBoxType() == 'odinm9' or getBoxType() == 'odinm7' or getBoxType() == 'odinm6': cmd = "config.inputDevices." + device + ".delay = ConfigSlider(default=200, increment = 100, limits=(0, 5000))" else: cmd = "config.inputDevices." + device + ".delay = ConfigSlider(default=700, increment = 100, limits=(0, 5000))" exec (cmd) cmd = "config.inputDevices." + device + ".delay.addNotifier(self.inputDevicesDelayChanged,config.inputDevices." + device + ".delay)" exec (cmd)
def __init__(self): Renderer.__init__(self) self.PicLoad = ePicLoad() self.PicLoad.PictureData.get().append(self.updatePicon) self.piconsize = (0, 0) self.pngname = "" self.lastPath = None if getBoxType() == "vuultimo": pngname = findLcdPicon("lcd_picon_default") else: pngname = findLcdPicon("picon_default") self.defaultpngname = None if not pngname: if getBoxType() == "vuultimo": tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: tmp = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if pathExists(tmp): pngname = tmp else: if getBoxType() == "vuultimo": pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "lcd_picon_default.png") else: pngname = resolveFilename(SCOPE_ACTIVE_SKIN, "picon_default.png") if os.path.getsize(pngname): self.defaultpngname = pngname
def Plugins(**kwargs): from enigma import getBoxType if nimmanager.hasNimType("DVB-S") and (getBoxType().startswith('et') or getBoxType().startswith('vu') or getBoxType() == "osmini"): for n in nimmanager.nim_slots: if n.isCompatible("DVB-S") and n.description not in _unsupportedNims: return PluginDescriptor(name=_("Blind scan"), description=_("Scan satellites for new transponders"), where = PluginDescriptor.WHERE_MENU, fnc=BlindscanSetup) return []
def vrime(self): self.RecordingLed() if not getBoxType() == 'gb800se' and not getBoxType() == 'gb800solo': self.zaPrik.start(self.updatetime, 1) return if (config.plugins.VFD_Giga.showClock.value == 'True' or config.plugins.VFD_Giga.showClock.value == 'False' or config.plugins.VFD_Giga.showClock.value == 'True_Switch') and not Screens.Standby.inStandby: if config.plugins.VFD_Giga.showClock.value == 'True_Switch': if time() >= self.begin: self.endkeypress = False if self.endkeypress: self.__eventInfoChanged() else: self.prikaz() else: self.__eventInfoChanged() if config.plugins.VFD_Giga.showClock.value == 'Off': evfd.getInstance().vfd_write_string(" ") self.zaPrik.start(self.updatetime, 1) return else: self.zaPrik.start(1000, 1) if Screens.Standby.inStandby or config.plugins.VFD_Giga.showClock.value == 'True_All': self.prikaz()
def __init__(self): self.last_modes_preferred = [ ] self.on_hotplug = CList() self.current_mode = None self.current_port = None self.readAvailableModes() if self.modes.has_key("DVI-PC") and not self.getModeList("DVI-PC"): print "remove DVI-PC because of not existing modes" del self.modes["DVI-PC"] if getBoxType() == 'gbquad' or getBoxType() == 'et5x00' or getBoxType() == 'et6x00': del self.modes["Scart"] if getBoxType() == 'tm2t' or getBoxType() == 'tmsingle': del self.modes["YPbPr"] self.createConfig() self.readPreferredModes() # take over old AVSwitch component :) from Components.AVSwitch import AVSwitch config.av.aspectratio.notifiers = [ ] config.av.tvsystem.notifiers = [ ] config.av.wss.notifiers = [ ] AVSwitch.getOutputAspect = self.getOutputAspect config.av.aspect.addNotifier(self.updateAspect) config.av.wss.addNotifier(self.updateAspect) config.av.policy_169.addNotifier(self.updateAspect) config.av.policy_43.addNotifier(self.updateAspect)
def showTvButton(self): if enigma.getBoxType().startswith('gb'): self.toogleTvRadio() elif enigma.getBoxType() == 'ventonhdx': self.showMovies() else: self.showTv()
def __init__(self, session): self.skin = OSD3DSetupScreen.skin Screen.__init__(self, session) self.setup_title = _("OSD 3D Setup") self.skinName = "Setup" self["status"] = StaticText() self["HelpWindow"] = Pixmap() self["HelpWindow"].hide() self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("OK")) self["info1"] = Label(_("Use arrows Up/Down to select")) self["info2"] = Label(_("Use arrows Left/Right to adjust")) self["actions"] = ActionMap(["SetupActions"], { "cancel": self.keyCancel, "save": self.keySave, }, -2) self.onChangedEntry = [ ] self.list = [] ConfigListScreen.__init__(self, self.list, session = self.session, on_change = self.changedEntry) self.list.append(getConfigListEntry(_("3D Mode"), config.osd.threeDmode, _("This option lets you choose the 3D mode"))) self.list.append(getConfigListEntry(_("Depth"), config.osd.threeDznorm, _("This option lets you adjust the 3D depth"))) if getBoxType() == 'gb800se' or getBoxType() == 'gb800solo' or getBoxType() == 'gb800ue': self.list.append(getConfigListEntry(_("Set Mode"), config.osd.threeDsetmode, _("This option lets you adjust the 3D mode"))) self.list.append(getConfigListEntry(_("Show in extensions list ?"), config.osd.show3dextensions, _("This option lets you show the option in the extension screen"))) self["config"].list = self.list self["config"].l.setList(self.list) self.onLayoutFinish.append(self.layoutFinished) if not self.selectionChanged in self["config"].onSelectionChanged: self["config"].onSelectionChanged.append(self.selectionChanged) self.selectionChanged()
def profile(id): now = time.time() - profile_start if profile_file: profile_file.write("%7.3f\t%s\n" % (now, id)) if id in profile_data: t = profile_data[id] if total_time: perc = t * (PERCENTAGE_END - PERCENTAGE_START) / total_time + PERCENTAGE_START else: perc = PERCENTAGE_START try: if getBoxType() == "odinm7": f = open("/dev/dbox/oled0", "w") f.write("%d" % perc) elif getBoxType() == "gb800se" or getBoxType() == "gb800solo": f = open("/dev/dbox/oled0", "w") f.write("%d \n" % perc) elif getBoxType() == "ebox5000": f = open("/proc/progress", "w") f.write("%d" % perc) else: f = open("/proc/progress", "w") f.write("%d \n" % perc) f.close() except IOError: pass
def __init__(self): self.last_modes_preferred = [ ] self.on_hotplug = CList() self.current_mode = None self.current_port = None self.readAvailableModes() if self.modes.has_key("DVI-PC") and not self.getModeList("DVI-PC"): print "remove DVI-PC because of not existing modes" del self.modes["DVI-PC"] if getBoxType() == 'et4x00' or getBoxType() == 'xp1000' or getBoxType() == 'iqonios300hd' or getBoxType() == 'tm2t' or getBoxType() == 'tmsingle' or getBoxType() == 'tmnano' or getBoxType() == 'odimm7' or model == 'ini-3000' or getBoxType() == 'vusolo2' or getBoxType() == 'e3hd' or getBoxType() == 'dm500hd' or getBoxType() == 'dm800' or getBoxType() == 'ebox7358' or getBoxType() == 'ebox5100' or getBoxType() == 'ixusszero' or getBoxType() == 'optimussos1': del self.modes["YPbPr"] if self.hw_type == 'elite' or self.hw_type == 'premium' or self.hw_type == 'premium+' or self.hw_type == 'ultra' or self.hw_type == "me" or self.hw_type == "minime" : self.readPreferredModes() self.createConfig() self.readPreferredModes() # take over old AVSwitch component :) from Components.AVSwitch import AVSwitch config.av.aspectratio.notifiers = [ ] config.av.tvsystem.notifiers = [ ] config.av.wss.notifiers = [ ] AVSwitch.getOutputAspect = self.getOutputAspect config.av.aspect.addNotifier(self.updateAspect) config.av.wss.addNotifier(self.updateAspect) config.av.policy_169.addNotifier(self.updateAspect) config.av.policy_43.addNotifier(self.updateAspect)
def __eventInfoChanged(self): self.RecordingLed() if not getBoxType() == 'gb800se' and not getBoxType() == 'gb800solo': return if config.plugins.VFD_Giga.showClock.value == 'Off' or config.plugins.VFD_Giga.showClock.value == 'True_All': return service = self.session.nav.getCurrentService() info = service and service.info() if info is None: chnr = "---" else: chnr = self.getchannelnr() info = None service = None ########## Center Channel number ################# t = len(chnr) if t == 1: CentChnr = " 0" + chnr + " " + '\n' elif t == 2: CentChnr = " " + chnr + " " + '\n' elif t == 3: CentChnr = "0" + chnr + '\n' else: CentChnr = chnr + '\n' ################################################# open("/proc/vfd", "w").write(CentChnr)
def Qsoftware(self): self.sublist = [] self.sublist.append( QuickSubMenuEntryComponent( "Software Update", _("Online software update"), _("Check/Install online updates (you must have a working internet connection)"), ) ) if ( not getBoxType().startswith("az") and not getBoxType().startswith("dream") and not getBoxType().startswith("ebox") ): self.sublist.append( QuickSubMenuEntryComponent( "Flash Online", _("Flash Online a new image"), _("Flash on the fly your your Receiver software.") ) ) self.sublist.append( QuickSubMenuEntryComponent( "Complete Backup", _("Backup your current image"), _("Backup your current image to HDD or USB. This will make a 1:1 copy of your box"), ) ) self.sublist.append( QuickSubMenuEntryComponent( "Backup Settings", _("Backup your current settings"), _("Backup your current settings. This includes E2-setup, channels, network and all selected files"), ) ) self.sublist.append( QuickSubMenuEntryComponent( "Restore Settings", _("Restore settings from a backup"), _( "Restore your settings back from a backup. After restore the box will restart to activated the new settings" ), ) ) self.sublist.append( QuickSubMenuEntryComponent( "Select Backup files", _("Choose the files to backup"), _( "Here you can select which files should be added to backupfile. (default: E2-setup, channels, network" ), ) ) self.sublist.append( QuickSubMenuEntryComponent( "Software Manager Setup", _("Manage your online update files"), _("Here you can select which files should be updated with a online update"), ) ) self["sublist"].l.setList(self.sublist)
def setColorFormat(configElement): if getBoxType() == 'et6x00': map = {"cvbs": 3, "rgb": 3, "svideo": 2, "yuv": 3} elif getBoxType() == 'gbquad' or getBoxType().startswith('et'): map = {"cvbs": 0, "rgb": 3, "svideo": 2, "yuv": 3} else: map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3} iAVSwitch.setColorFormat(map[configElement.getValue()])
def revert(self): for count in range(fancontrol.getFanCount()): if not getBoxType().startswith('tm') or not getBoxType().startswith('vu'): fancontrol.getConfig(count).vlt.load() fancontrol.getConfig(count).pwm.load() if not getBoxType().startswith('tm') or not getBoxType().startswith('vu'): fancontrol.getConfig(count).vlt_standby.load() fancontrol.getConfig(count).pwm_standby.load() self.close()
def readRcTypeFromProc(self): if os.path.exists('/proc/stb/info/hwmodel'): model = self.readFile('/proc/stb/info/hwmodel') if model == 'tmtwinoe' or model == 'tm2toe' or model == 'tmsingle': self.currentRcType = self.RCTYPE_TM elif os.path.exists('/proc/stb/info/vumodel'): model = self.readFile('/proc/stb/info/vumodel') if model == 'ultimo': self.currentRcType = self.RCTYPE_VU2 else: self.currentRcType = self.RCTYPE_VU elif getBoxType() == 'dm8000': self.currentRcType = self.RCTYPE_DMM elif getBoxType() == 'dm7020hd': self.currentRcType = self.RCTYPE_DMM2 elif getBoxType() == 'dm800' or getBoxType() == 'dm800se' or getBoxType() == 'dm500hd': self.currentRcType = self.RCTYPE_DMM1 elif os.path.exists('/proc/stb/info/boxtype'): model = self.readFile('/proc/stb/info/boxtype') if model.startswith('et') or model.startswith('xp'): rc = self.readFile('/proc/stb/ir/rc/type') if rc == '3': self.currentRcType = self.RCTYPE_ODIN if rc == '4': self.currentRcType = self.RCTYPE_DMM elif rc == '5' and model == 'et9200': self.currentRcType = self.RCTYPE_ODIN elif rc == '5': self.currentRcType = self.RCTYPE_ET9X00 elif rc == '6': self.currentRcType = self.RCTYPE_DMM elif rc == '7': self.currentRcType = self.RCTYPE_ET6X00 elif rc == '8': self.currentRcType = self.RCTYPE_VU elif rc == '9' and model == 'et9500': self.currentRcType = self.RCTYPE_ET9500 elif rc == '9' and model == 'et6500': self.currentRcType = self.RCTYPE_ET6500 elif rc == '11' and model == 'et9200': self.currentRcType = self.RCTYPE_ET9500 elif rc == '11' and model == 'et9000': self.currentRcType = self.RCTYPE_ET9X00 elif rc == '13' and model == 'et4000': self.currentRcType = self.RCTYPE_ET4X00 elif rc == '14': self.currentRcType = self.RCTYPE_XP1000 elif model == 'gigablue': self.currentRcType = self.RCTYPE_GB elif model == 'ini-3000': self.currentRcType = self.RCTYPE_INI3000 elif model == 'ini-5000': self.currentRcType = self.RCTYPE_INI5000 elif model == 'ini-7000': self.currentRcType = self.RCTYPE_INI7000 elif model == 'xp1000': self.currentRcType = self.RCTYPE_XP1000
def setConfiguredSettings(): if SystemInfo["CanChange3DOsd"]: if getBoxType() == "gb800se" or getBoxType() == "gb800solo" or getBoxType() == "gb800ue": applySettings2( config.osd.threeDmode.getValue(), int(config.osd.threeDznorm.getValue()), config.osd.threeDsetmode.getValue(), ) else: applySettings(config.osd.threeDmode.getValue(), int(config.osd.threeDznorm.getValue()))
def __init__(self, session, parent): Screen.__init__(self, session, parent = parent) if about.getImageTypeString() == 'Release': self["selected"] = StaticText("ViX:" + about.getImageVersionString() + ' (R)') elif about.getImageTypeString() == 'Experimental': self["selected"] = StaticText("ViX:" + about.getImageVersionString() + ' (B)') if getBoxType() == 'vuuno': self["BoxType"] = StaticText(_("Hardware:") + " Vu+ Uno") elif getBoxType() == 'vuultimo': self["BoxType"] = StaticText(_("Hardware:") + " Vu+ Ultimo") elif getBoxType() == 'vusolo': self["BoxType"] = StaticText(_("Hardware:") + " Vu+ Solo") elif getBoxType() == 'vuduo': self["BoxType"] = StaticText(_("Hardware:") + " Vu+ Duo") elif getBoxType() == 'et5x00': self["BoxType"] = StaticText(_("Hardware:") + " Xtrend ET5x00 Series") elif getBoxType() == 'et6x00': self["BoxType"] = StaticText(_("Hardware:") + " Xtrend ET6x00 Series") elif getBoxType() == 'et9x00': self["BoxType"] = StaticText(_("Hardware:") + " Xtrend ET9x00 Series") elif getBoxType() == 'odin': self["BoxType"] = StaticText(_("Hardware:") + " Odin") else: self["BoxType"] = StaticText(_("Hardware:") + " " + getBoxType()) self["KernelVersion"] = StaticText(_("Kernel:") + " " + about.getKernelVersionString()) self["ImageType"] = StaticText(_("Image:") + " " + about.getImageTypeString()) self["ImageVersion"] = StaticText(_("Version:") + " " + about.getImageVersionString() + " " + _("Build:") + " " + about.getBuildVersionString()) self["EnigmaVersion"] = StaticText(_("Last Update:") + " " + about.getLastUpdateString())
def onMountpointRemoved(mountpoint): global searchPaths if getBoxType() == 'vuultimo' or getBoxType() == 'inihdp': path = os.path.join(mountpoint, 'piconlcd') + '/' else: path = os.path.join(mountpoint, 'picon') + '/' try: searchPaths.remove(path) print "[LcdPicon] removed path:", path except: pass
def setColorFormat(configElement): if config.av.videoport and config.av.videoport.getValue() == "Scart-YPbPr": iAVSwitch.setColorFormat(3) else: if getBoxType() == 'et6x00': map = {"cvbs": 3, "rgb": 3, "svideo": 2, "yuv": 3} elif getBoxType() == 'gbquad' or getBoxType() == 'gbquadplus' or getBoxType().startswith('et'): map = {"cvbs": 0, "rgb": 3, "svideo": 2, "yuv": 3} else: map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3} iAVSwitch.setColorFormat(map[configElement.getValue()])
def Qsoftware(self): self.sublist = [] self.sublist.append(QuickSubMenuEntryComponent('Software Update', _('Online software update'), _('Check/Install online updates (you must have a working internet connection)'))) if not getBoxType().startswith('az') and not getBoxType().startswith('dream') and not getBoxType().startswith('ebox'): self.sublist.append(QuickSubMenuEntryComponent('Flash Online', _('Flash Online a new image'), _('Flash on the fly your Receiver software.'))) self.sublist.append(QuickSubMenuEntryComponent('Complete Backup', _('Backup your current image'), _('Backup your current image to HDD or USB. This will make a 1:1 copy of your box'))) self.sublist.append(QuickSubMenuEntryComponent('Backup Settings', _('Backup your current settings'), _('Backup your current settings. This includes E2-setup, channels, network and all selected files'))) self.sublist.append(QuickSubMenuEntryComponent('Restore Settings', _('Restore settings from a backup'), _('Restore your settings back from a backup. After restore the box will restart to activate the new settings'))) self.sublist.append(QuickSubMenuEntryComponent('Select Backup files', _('Choose the files to backup'), _('Here you can select which files should be added to backupfile. (default: E2-setup, channels, network)'))) self.sublist.append(QuickSubMenuEntryComponent('Software Manager Setup', _('Manage your online update files'), _('Here you can select which files should be updated with a online update'))) self['sublist'].l.setList(self.sublist)
def setRTCtime(wutime): if getBoxType().startswith('gb')or getBoxType().startswith('ini'): setRTCoffset() try: f = open("/proc/stb/fp/rtc", "w") f.write(str(wutime)) f.close() except IOError: try: fp = open("/dev/dbox/fp0") ioctl(fp.fileno(), 0x101, pack('L', wutime)) # set wake up fp.close() except IOError: print "setRTCtime failed!"
def vrime(self): self.RecordingLed() if not getBoxType() == 'gb800se' and not getBoxType() == 'gb800solo': self.zaPrik.start(self.updatetime, 1) return if config.plugins.VFD_Giga.showClock.value == 'Off': evfd.getInstance().vfd_write_string(" ") self.zaPrik.start(self.updatetime, 1) return else: self.zaPrik.start(1000, 1) if Screens.Standby.inStandby or config.plugins.VFD_Giga.showClock.value == 'True_All': self.prikaz()
def onMountpointAdded(mountpoint): global searchPaths try: if getBoxType() == 'vuultimo' or getBoxType() == 'inihdp': path = os.path.join(mountpoint, 'piconlcd') + '/' else: path = os.path.join(mountpoint, 'picon') + '/' if os.path.isdir(path) and path not in searchPaths: for fn in os.listdir(path): if fn.endswith('.png'): print "[LcdPicon] adding path:", path searchPaths.append(path) break except Exception, ex: print "[LcdPicon] Failed to investigate %s:" % mountpoint, ex
def __init__(self, session, args = None): Screen.__init__(self, session) Screen.setTitle(self, _("Fan Control")) templist = sensors.getSensorsList(sensors.TYPE_TEMPERATURE) tempcount = len(templist) fanlist = sensors.getSensorsList(sensors.TYPE_FAN_RPM) fancount = len(fanlist) self["red"] = StaticText(_("Cancel")) self["green"] = StaticText(_("OK")) for count in range(8): if count < tempcount: id = templist[count] if not getBoxType().startswith('tm') and not getBoxType().startswith('vu'): self["SensorTempText%d" % count] = StaticText(sensors.getSensorName(id)) self["SensorTemp%d" % count] = SensorSource(sensorid = id) elif getBoxType().startswith('tm') or getBoxType().startswith('vu') and id < 1: self["SensorTempText%d" % count] = StaticText(sensors.getSensorName(id)) self["SensorTemp%d" % count] = SensorSource(sensorid = id) else: self["SensorTempText%d" % count] = StaticText("") self["SensorTemp%d" % count] = SensorSource() else: self["SensorTempText%d" % count] = StaticText("") self["SensorTemp%d" % count] = SensorSource() if count < fancount: id = fanlist[count] self["SensorFanText%d" % count] = StaticText(sensors.getSensorName(id)) self["SensorFan%d" % count] = SensorSource(sensorid = id) else: self["SensorFanText%d" % count] = StaticText("") self["SensorFan%d" % count] = SensorSource() self.list = [] for count in range(fancontrol.getFanCount()): if not getBoxType().startswith('tm') and not getBoxType().startswith('vu'): self.list.append(getConfigListEntry(_("Fan %d voltage") % (count + 1), fancontrol.getConfig(count).vlt)) self.list.append(getConfigListEntry(_("Fan %d PWM") % (count + 1), fancontrol.getConfig(count).pwm)) if not getBoxType().startswith('tm') and not getBoxType().startswith('vu'): self.list.append(getConfigListEntry(_("Standby fan %d voltage") % (count + 1), fancontrol.getConfig(count).vlt_standby)) self.list.append(getConfigListEntry(_("Standby fan %d PWM") % (count + 1), fancontrol.getConfig(count).pwm_standby)) ConfigListScreen.__init__(self, self.list, session = self.session) #self["config"].list = self.list #self["config"].setList(self.list) self["config"].l.setSeperation(300) self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "MenuActions"], { "ok": self.save, "cancel": self.revert, "red": self.revert, "green": self.save, "menu": self.closeRecursive, }, -1)
def checkTraficLight(self): self.activityTimer.callback.remove(self.checkTraficLight) self.activityTimer.start(100, False) message = "" picon = None try: # TODO: Use Twisted's URL fetcher, urlopen is evil. And it can # run in parallel to the package update. url = "https://openpli.org/status/" try: status = urlopen(url, timeout=5).read().split('!', 1) except: # OpenPli 5.0 uses python 2.7.11 and here we need to bypass the certificate check from ssl import _create_unverified_context status = urlopen(url, timeout=5, context=_create_unverified_context()).read().split('!', 1) print status if getBoxType() in status[0].split(','): message = len(status) > 1 and status[1] or _("The current image might not be stable.\nFor more information see %s.") % ("www.openpli.org") # strip any HTML that may be in the message, but retain line breaks import re message = message.replace("<br />", "\n\n").replace("<br>", "\n\n") message = re.sub('<[^<]+?>', '', re.sub('‑', '-', message)) picon = MessageBox.TYPE_ERROR except: message = _("The status of the current image could not be checked because %s can not be reached.") % ("www.openpli.org") picon = MessageBox.TYPE_ERROR if message != "": message += "\n" + _("Do you want to update your receiver?") self.session.openWithCallback(self.startActualUpdate, MessageBox, message, picon = picon) else: self.startActualUpdate(True)
def __init__(self,session): Screen.__init__(self,session) self.setTitle(_("Transcoding Setup")) TEXT = _("Transcoding can be started when there is no corresponding channel recordings.") if getBoxType() == "vusolo2": TEXT += _("\nWhen transcoding, both PIP and analog video outputs are disabled.") else: TEXT += _("\nWhen transcoding, PIP is disabled.") self.session = session self["shortcuts"] = ActionMap(["ShortcutActions", "SetupActions" ], { "ok": self.keySave, "cancel": self.keyCancel, "red": self.keyCancel, "green": self.keySave, "yellow" : self.KeyDefault, }, -2) self.list = [] ConfigListScreen.__init__(self, self.list,session = self.session) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("Save")) self["key_yellow"] = StaticText(_("Default")) self["text"] = StaticText(_("%s")%TEXT) self.createSetup() self.onLayoutFinish.append(self.checkEncoder) self.invaliedModelTimer = eTimer() self.invaliedModelTimer.callback.append(self.invalidmodel) global transcodingsetupinit transcodingsetupinit.pluginsetup = self self.onClose.append(self.onClosed)
def __init__(self): Renderer.__init__(self) VariableText.__init__(self) if getBoxType() == 'inihdp': self.stringlength = 25 else: self.stringlength = 12
def checkTraficLight(self): self.activityTimer.callback.remove(self.checkTraficLight) self.activityTimer.start(100, False) currentTimeoutDefault = socket.getdefaulttimeout() socket.setdefaulttimeout(3) message = "" picon = None default = True try: # TODO: Use Twisted's URL fetcher, urlopen is evil. And it can # run in parallel to the package update. status = urlopen("http://openpli.org/status/").read().split('!', 1) if getBoxType() in status[0].split(','): message = len(status) > 1 and status[1] or _("The current beta image might not be stable.\nFor more information see %s.") % ("www.openpli.org") picon = MessageBox.TYPE_ERROR default = False except: message = _("The status of the current beta image could not be checked because %s can not be reached.") % ("www.openpli.org") picon = MessageBox.TYPE_ERROR default = False socket.setdefaulttimeout(currentTimeoutDefault) if default: self.showDisclaimer() else: message += "\n" + _("Do you want to update your receiver?") self.session.openWithCallback(self.startActualUpdate, MessageBox, message, default = default, picon = picon)
def getBackupPath(): backuppath = config.plugins.configurationbackup.backuplocation.getValue() box = getBoxType() if backuppath.endswith('/'): return backuppath + 'backup_' + box else: return backuppath + '/backup_' + box
def doRun(self, tmp_list, tmp_pol, tmp_band): def GetCommand(nimIdx): _nimSocket = self.nimSockets try: sName = _nimSocket[str(nimIdx)][0] sType = _supportNimType[sName] return "vuplus_%(TYPE)sblindscan"%{'TYPE':sType}, sName except: pass return "vuplus_blindscan", "" if getBoxType().startswith('vu'): self.binName,nimName = GetCommand(self.scan_nims.value) self.makeNimSocket(nimName) if self.binName is None: self.session.open(MessageBox, "Blindscan is not supported in " + nimName + " tuner.", MessageBox.TYPE_ERROR) print nimName + " does not support blindscan." return self.full_data = "" self.total_list=[] for x in tmp_list: for y in tmp_pol: for z in tmp_band: self.total_list.append([x,y,z]) print "add scan item : ", x, ", ", y, ", ", z self.max_count = len(self.total_list) self.is_runable = True self.running_count = 0 self.clockTimer = eTimer() self.clockTimer.callback.append(self.doClock) self.clockTimer.start(1000)
def __init__(self): Renderer.__init__(self) VariableText.__init__(self) if getBoxType() == 'vuduo': self.stringlength = 16 else: self.stringlength = 12
def profile(id): now = time.time() - profile_start if profile_file: profile_file.write("%7.3f\t%s\n" % (now, id)) if id in profile_data: t = profile_data[id] if total_time: perc = t * (PERCENTAGE_END - PERCENTAGE_START) / total_time + PERCENTAGE_START else: perc = PERCENTAGE_START try: if getBoxType() == "odinm7" or getBoxType( ) == "odinm6" or getBoxType() == "xp1000s": f = open("/dev/dbox/oled0", "w") f.write("%d" % perc) elif getBoxType() == "gb800se" or getBoxType() == "gb800solo": f = open("/dev/dbox/oled0", "w") f.write("%d \n" % perc) elif getBoxType() == "ebox5000": f = open("/proc/progress", "w") f.write("%d" % perc) else: f = open("/proc/progress", "w") f.write("%d \n" % perc) f.close() except IOError: pass
def getTempSensor(self): if getBoxType() not in ("dm7020hd", "dm7020hdv2"): try: sensor_info = sensors.getSensorsList(sensors.TYPE_TEMPERATURE) except: return 'Temp: N/A' sensor_info = None if sensor_info is not None: if len(sensor_info) > 0: return 'Temp: %s\xc2\xb0C' % sensors.getSensorValue( sensor_info[0]) return 'Temp: No Sensor'
def mainInMenu(menuid, **kwargs): if getBoxType() in ("gbipbox", "gbx2"): if menuid == "setup": return [(_("Remote channel stream converter"), main, "streamconvert", 20)] else: return [] else: if menuid == "scan": return [(_("Remote channel stream converter"), main, "streamconvert", 99)] else: return []
def Recording(self): if fileExists("/proc/stb/lcd/symbol_circle"): recordings = len(NavigationInstance.instance.getRecordings()) if recordings > 0: open("/proc/stb/lcd/symbol_circle", "w").write("3") else: open("/proc/stb/lcd/symbol_circle", "w").write("0") elif getBoxType() == 'ebox5000': recordings = len(NavigationInstance.instance.getRecordings()) if recordings > 0: open("/proc/stb/lcd/symbol_recording", "w").write("1") else: open("/proc/stb/lcd/symbol_recording", "w").write("0") elif getBoxType() == 'ixussone': recordings = len(NavigationInstance.instance.getRecordings()) self.blink = not self.blink if recordings > 0 and self.blink: open("/proc/stb/lcd/powerled", "w").write("1") else: open("/proc/stb/lcd/powerled", "w").write("0") else: if not fileExists("/proc/stb/lcd/symbol_recording") or not fileExists("/proc/stb/lcd/symbol_record_1") or not fileExists("/proc/stb/lcd/symbol_record_2"): return recordings = len(NavigationInstance.instance.getRecordings()) if recordings > 0: open("/proc/stb/lcd/symbol_recording", "w").write("1") if recordings == 1: open("/proc/stb/lcd/symbol_record_1", "w").write("1") open("/proc/stb/lcd/symbol_record_2", "w").write("0") elif recordings >= 2: open("/proc/stb/lcd/symbol_record_1", "w").write("1") open("/proc/stb/lcd/symbol_record_2", "w").write("1") else: open("/proc/stb/lcd/symbol_recording", "w").write("0") open("/proc/stb/lcd/symbol_record_1", "w").write("0") open("/proc/stb/lcd/symbol_record_2", "w").write("0")
def __init__(self): if HardwareInfo.device_name is not None: # print "using cached result" return HardwareInfo.device_name = "unknown" try: file = open("/proc/stb/info/model", "r") HardwareInfo.device_name = file.readline().strip() file.close() if getBoxType().startswith('tm') or getBoxType().startswith( 'iqon') or getBoxType().startswith( 'media') or getBoxType().startswith('opti'): HardwareInfo.device_name = "dm800se" try: file = open("/proc/stb/info/version", "r") HardwareInfo.device_version = file.readline().strip() file.close() except: pass except: print "----------------" print "you should upgrade to new drivers for the hardware detection to work properly" print "----------------" print "fallback to detect hardware via /proc/cpuinfo!!" try: rd = open("/proc/cpuinfo", "r").read() if rd.find("Brcm4380 V4.2") != -1: HardwareInfo.device_name = "dm8000" print "dm8000 detected!" elif rd.find("Brcm7401 V0.0") != -1: HardwareInfo.device_name = "dm800" print "dm800 detected!" elif rd.find("MIPS 4KEc V4.8") != -1: HardwareInfo.device_name = "dm7025" print "dm7025 detected!" except: pass
def __init__(self): if pathExists('/proc/stb/ir/rc/type') and pathExists('/proc/stb/info/boxtype'): self.isSupported = True fd = open('/proc/stb/info/boxtype', 'r') self.boxType = fd.read() fd.close() if config.plugins.remotecontroltype.rctype.getValue() != 0: self.writeRcType(config.plugins.remotecontroltype.rctype.getValue()) else: self.isSupported = False if getBoxType().startswith('gb'): self.isSupported = False
def setRTCtime(wutime): if getBoxType().startswith('gb'): setRTCoffset() try: f = open("/proc/stb/fp/rtc", "w") f.write(str(wutime)) f.close() except IOError: try: fp = open("/dev/dbox/fp0") ioctl(fp.fileno(), 0x101, pack('L', wutime)) # set wake up fp.close() except IOError: print "setRTCtime failed!"
def onMountpointAdded(mountpoint): global searchPaths try: if getBoxType() == 'vuultimo': path = os.path.join(mountpoint, 'piconlcd') + '/' else: path = os.path.join(mountpoint, 'picon') + '/' if os.path.isdir(path) and path not in searchPaths: for fn in os.listdir(path): if fn.endswith('.png'): print "[LcdPicon] adding path:", path searchPaths.append(path) break except Exception, ex: print "[LcdPicon] Failed to investigate %s:" % mountpoint, ex
def listInputChannels(self): hw_type = getBoxType() has_hdmi = HardwareInfo().has_hdmi() list = [] for port in self.hw.getPortList(): if self.hw.isPortUsed(port): descr = port if descr == 'DVI' and has_hdmi: descr = 'HDMI' if port != "DVI-PC": list.append((descr, port)) list.sort(key=lambda x: x[0]) print "[VideoWizard] listInputChannels:", list return list
def dualBoot(self): if getBoxType() == "et8500": rootfs2 = False kernel2 = False f = open("/proc/mtd") l = f.readlines() for x in l: if 'rootfs2' in x: rootfs2 = True if 'kernel2' in x: kernel2 = True f.close() if rootfs2 and kernel2: return True return False
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
def configStrings(iface): driver = iNetwork.detectWlanModule(iface) ret = "" if existBcmWifi(iface): encryption = config.plugins.wlan.encryption.value psk = config.plugins.wlan.psk.value essid = config.plugins.wlan.essid.value ret += '\tpre-up wl-config.sh -m ' + encryption.lower() + ' -k "' + psk + '" -s "' + essid + '" \n' ret += '\tpost-down wl-down.sh\n' else: if (driver == 'madwifi' or getBoxType() == "dm8000") and config.plugins.wlan.hiddenessid.value: ret += "\tpre-up iwconfig " + iface + " essid \"" + re.escape(config.plugins.wlan.essid.value) + "\" || true\n" ret += "\tpre-up wpa_supplicant -i" + iface + " -c" + getWlanConfigName(iface) + " -B -dd -D" + driver + " || true\n" ret += "\tpre-down wpa_cli -i" + iface + " terminate || true\n" return ret
def Plugins(**kwargs): if getBoxType() == "spark": return [ PluginDescriptor(where=[ PluginDescriptor.WHERE_AUTOSTART, PluginDescriptor.WHERE_SESSIONSTART ], fnc=sessionstart), PluginDescriptor(name="LED Display Setup", description="Change VFD display settings", where=PluginDescriptor.WHERE_MENU, fnc=main) ] else: return []
def __evUpdatedInfo(self): self.service = self.session.nav.getCurrentService() if getBoxType() in ("dinoboth265","axashistwin"): self.Resolution() self.Audio() self.Crypted() self.Teletext() self.Hbbtv() self.PauseSymbol() self.PlaySymbol() self.PowerSymbol() self.Timer() self.Subtitle() self.ParentalControl() del self.service
def createSetup(self): self.list = [] if fileExists("/proc/stb/encoder/0/vcodec"): self.list.append( getConfigListEntry(_("Bitrate in bits"), config.plugins.transcodingsetup.bitrate)) self.list.append( getConfigListEntry(_("Framerate"), config.plugins.transcodingsetup.framerate)) self.list.append( getConfigListEntry(_("Resolution"), config.plugins.transcodingsetup.resolution)) self.list.append( getConfigListEntry(_("Video codec"), config.plugins.transcodingsetup.vcodec)) self.list.append( getConfigListEntry( _("Aspect Ratio"), config.plugins.transcodingsetup.aspectratio)) self.list.append( getConfigListEntry(_("Interlaced"), config.plugins.transcodingsetup.interlaced)) elif getBoxType() in ("x2plus", "formuler1"): self.list.append( getConfigListEntry(_("Bitrate in bits"), config.plugins.transcodingsetup.bitrate)) self.list.append( getConfigListEntry(_("Framerate"), config.plugins.transcodingsetup.framerate)) else: self.list.append( getConfigListEntry(_("Bitrate in bits"), config.plugins.transcodingsetup.bitrate)) self.list.append( getConfigListEntry(_("Framerate"), config.plugins.transcodingsetup.framerate)) self.list.append( getConfigListEntry(_("Resolution"), config.plugins.transcodingsetup.resolution)) self.list.append( getConfigListEntry( _("Aspect Ratio"), config.plugins.transcodingsetup.aspectratio)) self.list.append( getConfigListEntry(_("Interlaced"), config.plugins.transcodingsetup.interlaced)) self["config"].list = self.list self["config"].l.setList(self.list)
def blindscanContainerClose(self, retval): lines = self.full_data.split('\n') self.full_data = "" # Clear this string so we don't get duplicates on subsequent runs for line in lines: data = line.split() print "cnt :", len(data), ", data :", data if len(data) >= 10 and self.dataIsGood(data) : if data[0] == 'OK': parm = eDVBFrontendParametersSatellite() sys = { "DVB-S" : eDVBFrontendParametersSatellite.System_DVB_S, "DVB-S2" : eDVBFrontendParametersSatellite.System_DVB_S2} qam = { "QPSK" : parm.Modulation_QPSK, "8PSK" : parm.Modulation_8PSK} inv = { "INVERSION_OFF" : parm.Inversion_Off, "INVERSION_ON" : parm.Inversion_On, "INVERSION_AUTO" : parm.Inversion_Unknown} fec = { "FEC_AUTO" : parm.FEC_Auto, "FEC_1_2" : parm.FEC_1_2, "FEC_2_3" : parm.FEC_2_3, "FEC_3_4" : parm.FEC_3_4, "FEC_5_6": parm.FEC_5_6, "FEC_7_8" : parm.FEC_7_8, "FEC_8_9" : parm.FEC_8_9, "FEC_3_5" : parm.FEC_3_5, "FEC_9_10" : parm.FEC_9_10, "FEC_NONE" : parm.FEC_None} roll ={ "ROLLOFF_20" : parm.RollOff_alpha_0_20, "ROLLOFF_25" : parm.RollOff_alpha_0_25, "ROLLOFF_35" : parm.RollOff_alpha_0_35} pilot={ "PILOT_ON" : parm.Pilot_On, "PILOT_OFF" : parm.Pilot_Off} pol = { "HORIZONTAL" : parm.Polarisation_Horizontal, "VERTICAL" : parm.Polarisation_Vertical} parm.orbital_position = self.orb_position if getBoxType().startswith('azbox'): parm.polarisation = self.polsave else: parm.polarisation = pol[data[1]] parm.frequency = int(data[2]) parm.symbol_rate = int(data[3]) parm.system = sys[data[4]] parm.inversion = inv[data[5]] parm.pilot = pilot[data[6]] parm.fec = fec[data[7]] parm.modulation = qam[data[8]] parm.rolloff = roll[data[9]] self.tmp_tplist.append(parm) self.blindscan_session.close(True)
def createConfig(self): config.plugins.transcodingsetup = ConfigSubsection() config.plugins.transcodingsetup.transcoding = ConfigSelection(default = "enable", choices = [ ("enable", _("enable")), ("disable", _("disable"))] ) config.plugins.transcodingsetup.port = ConfigSelection(default = "8002", choices = [ ("8001", "8001"), ("8002", "8002")] ) global TranscodingConfigList for x in TranscodingConfigList: if x[0] == "Bitrate": if getBoxType() == "vusolo2": default_bitrate = 400000 else: default_bitrate = 2000000 config.plugins.transcodingsetup.bitrate = ConfigSelection(default = "500000", choices = [ ("100000", "100 Kbits"), ("500000", "500 Kbits"), ("1000000", "1 Mbits"), ("1500000", "1.5 Mbits"), ("2000000", "2 Mbits"), ("2500000", "2.5 Mbits"), ("3000000", "3 Mbits"), ("3500000", "3.5 Mbits"), ("4000000", "4 Mbits"), ("4500000", "4.5 Mbits"), ("5000000", "5 Mbits")]) x.append(config.plugins.transcodingsetup.bitrate) elif x[0] == "Framerate": config.plugins.transcodingsetup.framerate = ConfigSelection(default = "30000", choices = [ ("23976", "23.976 fps"), ("24000", "24 fps"), ("29970", "29.970 fps"), ("30000", "30 fps"), ("59940", "59.940 fps"), ("60000", "60 fps")]) x.append(config.plugins.transcodingsetup.framerate)
def flashimage(self): files = "^.*\.(zip|bin)" model = getBoxType() if model in ("vuduo","vusolo","vuultimo","vuuno") or model.startswith("ebox"): files = "^.*\.(zip|bin|jffs2)" elif "4k" or "uhd" in model or model in ("hd51","hd60","hd61","h7","sf4008","sf5008","sf8008","sf8008m","vs1500","et11000","et13000","cc1","multibox","v8plus","e4hdultra"): files = "^.*\.(zip|bin|bz2)" elif model in ("h9","h9combo","i55plus","h10","dinobotu55","iziboxx3","dinoboth265","axashistwin","protek4kx1"): files = "^.*\.(zip|bin|ubi)" elif model.startswith("dm"): self.session.open(MessageBox, _("No supported receiver found!"), MessageBox.TYPE_ERROR) return else: files = "^.*\.(zip|bin)" curdir = '/media/' self.session.open(FlashImageConfig, curdir, files)
def Plugins(**kwargs): if getBoxType() in ("xpeedlx1", "atemio6000", "atemio6100", "bwidowx", "bwidowx2", "mbhybrid", "opticumtt"): return [ PluginDescriptor(where=[ PluginDescriptor.WHERE_AUTOSTART, PluginDescriptor.WHERE_SESSIONSTART ], fnc=sessionstart), PluginDescriptor(name="INI LED Display Setup", description="Change VFD display settings", where=PluginDescriptor.WHERE_MENU, fnc=main) ] else: return []
def checkTraficLight(self): self.activityTimer.callback.remove(self.checkTraficLight) self.activityTimer.start(100, False) currentTimeoutDefault = socket.getdefaulttimeout() socket.setdefaulttimeout(3) message = "" picon = None try: # TODO: Use Twisted's URL fetcher, urlopen is evil. And it can # run in parallel to the package update. url = "https://openpli.org/status/" try: status = urlopen(url, timeout=5).read().split('!', 1) except: # OpenPli 5.0 uses python 2.7.11 and here we need to bypass the certificate check from ssl import _create_unverified_context status = urlopen( url, timeout=5, context=_create_unverified_context()).read().split('!', 1) print status if getBoxType() in status[0].split(','): message = len(status) > 1 and status[1] or _( "The current image might not be stable.\nFor more information see %s." ) % ("www.nonsolosat.net") # strip any HTML that may be in the message, but retain line breaks import re message = message.replace("<br />", "\n\n").replace("<br>", "\n\n") message = re.sub('<[^<]+?>', '', re.sub('‑', '-', message)) picon = MessageBox.TYPE_ERROR except: message = _( "The status of the current image could not be checked because %s can not be reached." ) % ("www.nonsolosat.net") picon = MessageBox.TYPE_ERROR socket.setdefaulttimeout(currentTimeoutDefault) if message != "": message += "\n" + _("Do you want to update your receiver?") self.session.openWithCallback(self.startActualUpdate, MessageBox, message, picon=picon) else: self.startActualUpdate(True)
def getDriverInstalledDate(): try: from glob import glob try: if getBoxType() in ("dm800", "dm8000"): print("[About] Read /var/lib/opkg/info/dvb-modules.control") driver = [ x.split("-")[-2:-1][0][-9:] for x in open( glob("/var/lib/opkg/info/*dvb-modules*.control")[0], "r") if x.startswith("Version:") ][0] return "%s-%s-%s" % (driver[:4], driver[4:6], driver[6:]) else: print("[About] Read /var/lib/opkg/info/dvb-modules.control") driver = [ x.split("-")[-2:-1][0][-8:] for x in open( glob("/var/lib/opkg/info/*dvb-modules*.control")[0], "r") if x.startswith("Version:") ][0] return "%s-%s-%s" % (driver[:4], driver[4:6], driver[6:]) except: print( "[About] Read /var/lib/opkg/info/dvb-modules.control failed.") try: print("[About] Read /var/lib/opkg/info/dvb-proxy.control") driver = [ x.split("Version:") for x in open( glob("/var/lib/opkg/info/*dvb-proxy*.control")[0], "r") if x.startswith("Version:") ][0] return "%s" % driver[1].replace("\n", "") except: print( "[About] Read /var/lib/opkg/info/dvb-proxy.control failed." ) print("[About] Read /var/lib/opkg/info/platform-util.control") driver = [ x.split("Version:") for x in open( glob("/var/lib/opkg/info/*platform-util*.control")[0], "r") if x.startswith("Version:") ][0] return "%s" % driver[1].replace("\n", "") except: print("[About] Read driver date failed.") return _("unknown")
def keyOk(self): self.currentSelected = self["list"].l.getCurrentSelection() slot = self.currentSelected[0][1] if slot != "Waiter": if slot == "Recovery": shutil.copyfile("/tmp/startupmount/STARTUP_RECOVERY", "/tmp/startupmount/STARTUP") elif slot == "Android": shutil.copyfile("/tmp/startupmount/STARTUP_ANDROID", "/tmp/startupmount/STARTUP") else: model = getBoxType() if SystemInfo["canMultiBoot"][3]: shutil.copyfile("/tmp/startupmount/STARTUP_%s" % slot, "/tmp/startupmount/STARTUP") elif os.path.isfile( "/tmp/startupmount/STARTUP_LINUX_4_BOXMODE_12"): if slot < 12: shutil.copyfile( "/tmp/startupmount/STARTUP_LINUX_%s_BOXMODE_1" % slot, "/tmp/startupmount/STARTUP") else: slot -= 12 shutil.copyfile( "/tmp/startupmount/STARTUP_LINUX_%s_BOXMODE_12" % slot, "/tmp/startupmount/STARTUP") elif os.path.isfile("/tmp/startupmount/STARTUP_LINUX_4"): shutil.copyfile( "/tmp/startupmount/STARTUP_LINUX_%s" % slot, "/tmp/startupmount/STARTUP") elif os.path.isfile("/tmp/startupmount/STARTUP_4"): shutil.copyfile("/tmp/startupmount/STARTUP_%s" % slot, "/tmp/startupmount/STARTUP") else: if slot < 12: startupFileContents = "boot emmcflash0.kernel%s 'root=/dev/mmcblk0p%s rw rootwait %s_4.boxmode=1'\n" % ( slot, slot * 2 + 1, model) else: slot -= 12 startupFileContents = "boot emmcflash0.kernel%s 'brcm_cma=520M@248M brcm_cma=%s@768M root=/dev/mmcblk0p%s rw rootwait %s_4.boxmode=12'\n" % ( slot, SystemInfo["canMode12"], slot * 2 + 1, model) open('/tmp/startupmount/STARTUP', 'w').write(startupFileContents) from Screens.Standby import TryQuitMainloop self.session.open(TryQuitMainloop, 2)
def createInfo(self): uid = self.createUid() stb_model = getBoxType() firmware_version = os.popen("cat /etc/issue.net").read() #testing time bug, restore to #vas_installed = int(time.time()) self.now = time.time() vas_installed = int(self.now) self.info["uid"] = str(uid) self.info["stb_model"] = stb_model self.info["firmware_version"] = firmware_version self.info["vas_installed"] = vas_installed self.info["vas_version"] = self.vas_version os.system("mkdir -p /home/vas/")
def getLatestImageTimestamp(self): currentTimeoutDefault = socket.getdefaulttimeout() socket.setdefaulttimeout(3) latestImageTimestamp = "" try: # TODO: Use Twisted's URL fetcher, urlopen is evil. And it can # run in parallel to the package update. latestImageTimestamp = re.findall( '<dd>(.*?)</dd>', urlopen("http://sfteam.es/download/" + getBoxType() + "/").read())[0][:16] latestImageTimestamp = time.strftime( _("%d-%b-%Y %-H:%M"), time.strptime(latestImageTimestamp, "%Y/%m/%d %H:%M")) except: pass socket.setdefaulttimeout(currentTimeoutDefault) return latestImageTimestamp
def ContainterFallback(self, data=None, retval=None, extra_args=None): self.container.killAll() slot = self.currentSelected[0][1] model = getBoxType() if SystemInfo["canMultiBoot"][3]: shutil.copyfile("/tmp/startupmount/STARTUP_%s" % slot, "/tmp/startupmount/STARTUP") else: if slot < 12: startupFileContents = "boot emmcflash0.kernel%s 'root=/dev/mmcblk0p%s rw rootwait %s_4.boxmode=1'\n" % ( slot, slot * 2 + 1, model) else: slot -= 12 startupFileContents = "boot emmcflash0.kernel%s 'brcm_cma=520M@248M brcm_cma=%s@768M root=/dev/mmcblk0p%s rw rootwait %s_4.boxmode=12'\n" % ( slot, SystemInfo["canMode12"], slot * 2 + 1, model) open('/tmp/startupmount/STARTUP', 'w').write(startupFileContents) from Screens.Standby import TryQuitMainloop self.session.open(TryQuitMainloop, 2)
def getFPVersion(): ret = "unknown" try: if getBoxBrand() == "blackbox" and fileExists("/proc/stb/info/micomver"): ret = open("/proc/stb/info/micomver", "r").read() elif fileExists("/proc/stb/fp/version"): if getMachineBuild() == "dm4kgen" or getBoxType() in ("dm520","dm7080","dm820"): ret = open("/proc/stb/fp/version", "r").read() else: ret = long(open("/proc/stb/fp/version", "r").read()) elif fileExists("/sys/firmware/devicetree/base/bolt/tag"): ret = open("/sys/firmware/devicetree/base/bolt/tag", "r").read().rstrip("\0") else: fp = open("/dev/dbox/fp0") ret = ioctl(fp.fileno(),0) except IOError: print("[StbHardware] getFPVersion failed!") return ret
def checkTraficLight(self): self.activityTimer.callback.remove(self.checkTraficLight) self.activityTimer.start(100, False) currentTimeoutDefault = socket.getdefaulttimeout() socket.setdefaulttimeout(3) message = "" picon = None default = True try: # TODO: Use Twisted's URL fetcher, urlopen is evil. And it can # run in parallel to the package update. url = "http://openpli.org/status/" try: status = urlopen(url, timeout=5).read().split('!', 1) except: # OpenPli 5.0 uses python 2.7.11 and here we need to bypass the certificate check from ssl import _create_unverified_context status = urlopen( url, timeout=5, context=_create_unverified_context()).read().split('!', 1) print status if getBoxType() in status[0].split(','): message = len(status) > 1 and status[1] or _( "The current beta image might not be stable.\nFor more information see %s." ) % ("www.openpli.org") picon = MessageBox.TYPE_ERROR default = False except: message = _( "The status of the current beta image could not be checked because %s can not be reached." ) % ("www.openpli.org") picon = MessageBox.TYPE_ERROR default = False socket.setdefaulttimeout(currentTimeoutDefault) if default: self.showDisclaimer() else: message += "\n" + _("Do you want to update your receiver?") self.session.openWithCallback(self.startActualUpdate, MessageBox, message, default=default, picon=picon)
def prerequisiteMet(self, prerequisites): met = True if self.neededTag is None: if "tag" in prerequisites: return False elif self.neededTag == 'ALL_TAGS': return True else: if "tag" in prerequisites: if not self.neededTag in prerequisites["tag"]: return False else: return False if self.neededFlag is None: if "flag" in prerequisites: return False else: if "flag" in prerequisites: if not self.neededFlag in prerequisites["flag"]: return False else: return True if "satellite" in prerequisites: for sat in prerequisites["satellite"]: if int(sat) not in nimmanager.getConfiguredSats(): return False if "bcastsystem" in prerequisites: has_system = False for bcastsystem in prerequisites["bcastsystem"]: if nimmanager.hasNimType(bcastsystem): has_system = True if not has_system: return False if "hardware" in prerequisites: hardware_found = False for hardware in prerequisites["hardware"]: if hardware == getBoxType(): hardware_found = True if not hardware_found: return False return True
def getDriverInstalledDate(): try: from glob import glob try: if getBoxType() in ("dm800","dm8000"): driver = [x.split("-")[-2:-1][0][-9:] for x in open(glob("/var/lib/opkg/info/*-dvb-modules-*.control")[0], "r") if x.startswith("Version:")][0] return "%s-%s-%s" % (driver[:4], driver[4:6], driver[6:]) else: driver = [x.split("-")[-2:-1][0][-8:] for x in open(glob("/var/lib/opkg/info/*-dvb-modules-*.control")[0], "r") if x.startswith("Version:")][0] return "%s-%s-%s" % (driver[:4], driver[4:6], driver[6:]) except: try: driver = [x.split("Version:") for x in open(glob("/var/lib/opkg/info/*-dvb-proxy-*.control")[0], "r") if x.startswith("Version:")][0] return "%s" % driver[1].replace("\n","") except: driver = [x.split("Version:") for x in open(glob("/var/lib/opkg/info/*-platform-util-*.control")[0], "r") if x.startswith("Version:")][0] return "%s" % driver[1].replace("\n","") except: return _("unknown")
def openTest(self): ldeps = len(self.depends) if ldeps == 0: self.viewLog() else: name1 = self.depends[0] missing = name1 + "_" slist = 'cams eglibc firmware fonts gstreamer lib mips32el perl plugins python qt4 skins ' + str( getBoxType()) source = slist.split() self.found = 0 i = 0 while i < 12: addn = source[i] ftxt = '/tmp/.' + addn + '.txt' if not fileExists(ftxt): cmd1 = "wget -O /tmp/." + addn + ".txt 'https://openvision.tech/pedm/mipsel/" + addn + "/index.html'" os.system(cmd1) f1 = file(ftxt) flist1 = f1.read() if missing in flist1: self.addon = addn n4 = flist1.find(missing, 0) n5 = flist1.find(".ipk", n4) self.ipk = flist1[n4:(n5 + 4)] self.found = 1 break else: i = i + 1 if self.found == 0: txt = name1 + "\nNot Found On The Server !" self.session.open(MessageBox, txt, type=1) self.close else: xurl1 = 'https://openvision.tech/pedm/mipsel/' + self.addon + '/' xurl2 = xurl1 + self.ipk self.idx = self.idx + 1 cmd2 = 'opkg install --force-reinstall --force-overwrite ' + xurl2 + ' > /tmp/.log' + str( self.idx) + '.txt' title = _("Installing addons %s" % (self.ipk)) self.session.openWithCallback(self.newdeps, Console, _(title), [cmd2])