本文整理汇总了Python中Tools.HardwareInfo.HardwareInfo类的典型用法代码示例。如果您正苦于以下问题:Python HardwareInfo类的具体用法?Python HardwareInfo怎么用?Python HardwareInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HardwareInfo类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, session, request):
WebScreen.__init__(self, session, request)
from WebComponents.Sources.About import About
from WebComponents.Sources.Frontend import Frontend
from WebComponents.Sources.Hdd import Hdd
from WebComponents.Sources.Network import Network
from Components.config import config
from Components.About import about
from Components.Sources.StaticText import StaticText
try:
from Tools.StbHardware import getFPVersion
except:
from Tools.DreamboxHardware import getFPVersion
from Tools.HardwareInfo import HardwareInfo
hw = HardwareInfo()
self["About"] = About(session)
self["Network"] = Network()
self["Hdd"] = Hdd()
self["Frontends"] = Frontend()
try:
from enigma import getImageVersionString, getBuildVersionString, getEnigmaVersionString
self["EnigmaVersion"] = StaticText(getEnigmaVersionString())
self["ImageVersion"] = StaticText(getVersionString() + '.' + getBuildVersionString())
except:
self["EnigmaVersion"] = StaticText(about.getEnigmaVersionString())
self["ImageVersion"] = StaticText(about.getVersionString())
self["WebIfVersion"] = StaticText(config.plugins.Webinterface.version.value)
self["FpVersion"] = StaticText(str(getFPVersion()))
self["DeviceName"] = StaticText(hw.get_device_name())
示例2: __init__
def __init__(self, session, cancelable = True, close_on_finish = False):
self.skin = NFIFlash.skin
Screen.__init__(self, session)
self["job_progressbar"] = Progress()
self["job_progresslabel"] = StaticText("")
self["finished"] = Boolean()
self["infolabel"] = StaticText("")
self["statusbar"] = StaticText(_("Please select .NFI flash image file from medium"))
self["listlabel"] = StaticText(_("select .NFI flash file")+":")
self["key_green"] = StaticText()
self["key_yellow"] = StaticText()
self["key_blue"] = StaticText()
self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions"],
{
"green": self.ok,
"yellow": self.reboot,
"ok": self.ok,
"left": self.left,
"right": self.right,
"up": self.up,
"down": self.down
}, -1)
currDir = "/media/usb/"
self.filelist = FileList(currDir, matchingPattern = "^.*\.(nfi|NFI)")
self["filelist"] = self.filelist
self.nfifile = ""
self.md5sum = ""
self.job = None
self.box = HardwareInfo().get_device_name()
示例3: __init__
def __init__(self):
self.model = HardwareInfo().get_device_model()
# cfg files has modelname rcname entries.
# modelname is boxname optionally followed by .rctype
for line in open((resolveFilename(SCOPE_SKIN, "rc_models/rc_models.cfg")), "r"):
if line.startswith(self.model):
m, r = line.strip().split()
self.RcModels[m] = r
示例4: __init__
def __init__(self):
self.model = HardwareInfo().get_device_model()
# cfg files has modelname rcname entries.
# modelname is boxname optionally followed by .rctype
for line in open((resolveFilename(SCOPE_SKIN, 'rc_models/rc_models.cfg')), 'r'):
if line[:len(self.model)] == self.model:
m, r = line.strip().split()
self.RcModels[m] = r
# on spark has only one rc
break
示例5: getDeviceName
def getDeviceName(self):
device_name = "unknown"
try:
file = open("/proc/stb/info/vumodel", "r")
device_name = file.readline().strip()
file.close()
except IOError:
from Tools.HardwareInfo import HardwareInfo
device_name = HardwareInfo.get_device_name()
return device_name
示例6: __init__
class RcModel:
RcModels = {}
def __init__(self):
self.model = HardwareInfo().get_device_model()
# cfg files has modelname rcname entries.
# modelname is boxname optionally followed by .rctype
if "technomate" in open("/etc/.brandtype","r").readline():
for line in open((resolveFilename(SCOPE_SKIN, 'rc_models/rc_models_te.cfg')), 'r'):
if line.startswith(self.model):
m, r = line.strip().split()
self.RcModels[m] = r
elif "edision" in open("/etc/.brandtype","r").readline():
for line in open((resolveFilename(SCOPE_SKIN, 'rc_models/rc_models_ed.cfg')), 'r'):
if line.startswith(self.model):
m, r = line.strip().split()
self.RcModels[m] = r
else:
for line in open((resolveFilename(SCOPE_SKIN, 'rc_models/rc_models.cfg')), 'r'):
if line.startswith(self.model):
m, r = line.strip().split()
self.RcModels[m] = r
def rcIsDefault(self):
# Default RC can only happen with DMM type remote controls...
return self.model.startswith('dm')
def getRcFile(self, ext):
# check for rc/type every time so rctype changes will be noticed
if os.path.exists('/proc/stb/ir/rc/type'):
rc = open('/proc/stb/ir/rc/type').read().strip()
modeltype = '%s.%s' % (self.model, rc)
else:
modeltype = None
if modeltype is not None and modeltype in self.RcModels.keys():
remote = self.RcModels[modeltype]
elif self.model in self.RcModels.keys():
remote = self.RcModels[self.model]
else:
remote = 'dmm' # default. Assume files for dmm exists
f = resolveFilename(SCOPE_SKIN, 'rc_models/' + remote + '.' + ext)
if not os.path.exists(f):
f = resolveFilename(SCOPE_SKIN, 'rc_models/dmm.' + ext)
return f
def getRcImg(self):
return self.getRcFile('png')
def getRcPositions(self):
return self.getRcFile('xml')
示例7: __init__
def __init__(self):
self.iService = None
self.iServiceReference = None
self.iAudioDelay = None
self.channelAudio = AC3
self.whichAudio = AC3
self.bIsRecording = False
# Current audio- delay
self.systemDelay = {}
self.getAudioInformation()
self.activateTimer = eTimer()
self.activateTimer.callback.append(self.activateDelay)
self.activateWait = config.plugins.AC3LipSync.activationDelay.getValue()
# Current value for movie start behaviour
self.movieStart = config.usage.on_movie_start.getValue()
# find out box type
self.oHWInfo = HardwareInfo()
self.bHasToRestartService = self.oHWInfo.get_device_name() == "dm7025"
示例8: resolveFilename
###################################################
MAIN_PAGE = "http://www.zdf.de"
PNG_PATH = resolveFilename(SCOPE_PLUGINS)+"/Extensions/ZDFMediathek/"
TYPE_NOTHING = 0
TYPE_MOVIE = 1
TYPE_PODCAST = 2
TYPE_MOVIELIST_CATEGORY = 3
LIST_LEFT = 0
LIST_RIGHT = 1
LIST_NONE = 2
deviceName = HardwareInfo().get_device_name()
PLAY_MP4 = False
if not deviceName.startswith("dm7025"):
try:
#FIXMEE add better check ! ? !
for line in popen("opkg info gst-plugin-rtsp").readlines():
if line.find("Version: ") != -1:
if line[9:] >= "0.10.23-r7.1":
PLAY_MP4 = True
except:
pass
try:
from LT.LTStreamPlayer import streamplayer
示例9: __init__
class AC3delay:
def __init__(self):
self.iService = None
self.iServiceReference = None
self.isStreamService = False
self.iAudioDelay = None
self.channelAudio = AC3
self.whichAudio = AC3
self.bIsRecording = False
# Current audio- delay
self.systemDelay = {}
self.getAudioInformation()
self.activateTimer = eTimer()
self.activateTimer.callback.append(self.activateDelay)
self.activateWait = config.plugins.AC3LipSync.activationDelay.getValue()
# Current value for movie start behaviour
self.movieStart = config.usage.on_movie_start.getValue()
# find out box type
self.oHWInfo = HardwareInfo()
self.bHasToRestartService = self.oHWInfo.get_device_name() == "dm7025"
def initAudio(self):
self.iService = NavigationInstance.instance.getCurrentService()
self.iServiceReference = NavigationInstance.instance.getCurrentlyPlayingServiceReference()
self.isStreamService = self.iServiceReference and '%3a//' in self.iServiceReference.toString()
self.iAudioDelay = self.iService and self.iService.audioDelay()
self.iSeek = self.iService and self.iService.seek()
def deleteAudio(self):
self.iService = None
self.iAudioDelay = None
self.iSeek = None
def setChannelAudio(self, sAudio):
self.channelAudio = sAudio
def delayedActivateDelay(self):
if self.activateTimer.isActive:
self.activateTimer.stop()
self.activateTimer.start(self.activateWait, True)
def activateDelay(self):
# This activation code is only neccessary for DM7025.
# DM800, DM8000 and DM500HD directly activate the delay after using "setAC3Delay" and "setPCMDelay", they don't need the service restart
if self.activateTimer.isActive:
self.activateTimer.stop()
if self.bHasToRestartService == True:
bInitialized = False
if self.iService is None:
self.initAudio()
bInitialized = True
if self.iServiceReference is not None:
lCurPosition = self.cueGetCurrentPosition()
self.deleteAudio()
if self.whichAudio == self.channelAudio:
config.usage.on_movie_start.setValue("beginning")
NavigationInstance.instance.stopService()
NavigationInstance.instance.playService(self.iServiceReference)
config.usage.on_movie_start.setValue(self.movieStart)
if lCurPosition is not None:
self.lCurPosition = lCurPosition
self.timer = eTimer()
self.timer.callback.append(self.seekAfterWait)
self.timer.start(200, True)
else:
self.deleteAudio()
def seekAfterWait(self):
self.timer.stop()
self.initAudio()
if self.iSeek is not None:
self.iSeek.seekTo(self.lCurPosition)
self.deleteAudio()
def cueGetCurrentPosition(self):
if self.iSeek is None:
return None
r = self.iSeek.getPlayPosition()
if r[0]:
return None
return long(r[1])
def getSystemDelay(self, sAudio):
bInitialized = False
if self.iService is None:
self.initAudio()
bInitialized = True
iDelay = 0
if self.iAudioDelay is not None:
if sAudio == AC3:
iDelay = self.iAudioDelay.getAC3Delay()
elif sAudio == PCM:
iDelay = self.iAudioDelay.getPCMDelay()
elif sAudio == AC3GLOB:
iDelay = config.av.generalAC3delay.getValue()
#.........这里部分代码省略.........
示例10: resolveFilename
###################################################
MAIN_PAGE = "http://www.zdf.de"
PNG_PATH = resolveFilename(SCOPE_PLUGINS)+"/Extensions/ZDFMediathek/"
TYPE_NOTHING = 0
TYPE_MOVIE = 1
TYPE_PODCAST = 2
TYPE_MOVIELIST_CATEGORY = 3
LIST_LEFT = 0
LIST_RIGHT = 1
LIST_NONE = 2
deviceName = HardwareInfo().get_device_name()
PLAY_MP4 = False
PLAY_WMV = False
if not deviceName.startswith("dm7025"):
PLAY_MP4 = True
if deviceName.startswith("dm7020hd"):
PLAY_WMV = True
try:
from LT.LTStreamPlayer import streamplayer
except ImportError:
try:
from Plugins.Extensions.LTMediaCenter.LTStreamPlayer import streamplayer
except ImportError:
streamplayer = None
示例11: HardwareInfo
import os
import re
from Tools.HardwareInfo import HardwareInfo
try:
device_name = HardwareInfo().get_device_name()
except:
device_name = None
#sfdisk_version_bug = '2.28.1' in os.popen('/usr/sbin/sfdisk -v').read()
BOX_NAME = "none"
MODEL_NAME = "none"
if os.path.exists("/proc/stb/info/boxtype"):
BOX_NAME = "all"
try:
f = open("/proc/stb/info/boxtype")
MODEL_NAME = f.read().strip()
f.close()
except:
pass
elif os.path.exists("/proc/stb/info/hwmodel"):
BOX_NAME = "all"
try:
f = open("/proc/stb/info/hwmodel")
MODEL_NAME = f.read().strip()
f.close()
except:
pass
elif os.path.exists("/proc/stb/info/vumodel"):
BOX_NAME = "vu"
示例12: NFIFlash
class NFIFlash(Screen):
skin = """
<screen name="NFIFlash" position="90,95" size="560,420" title="Image flash utility">
<ePixmap pixmap="skin_default/buttons/green.png" position="140,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
<ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
<ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
<widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />
<widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#a08500" transparent="1" />
<widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#18188b" transparent="1" />
<widget source="listlabel" render="Label" position="16,44" size="200,21" valign="center" font="Regular;18" />
<widget name="filelist" position="0,68" size="260,260" scrollbarMode="showOnDemand" />
<widget source="infolabel" render="Label" position="270,44" size="280,284" font="Regular;16" />
<widget source="job_progressbar" render="Progress" position="10,374" size="540,26" borderWidth="1" backgroundColor="#254f7497" />
<widget source="job_progresslabel" render="Label" position="180,378" zPosition="2" font="Regular;18" halign="center" transparent="1" size="200,22" foregroundColor="#000000" />
<widget source="statusbar" render="Label" position="10,404" size="540,16" font="Regular;16" foregroundColor="#cccccc" />
</screen>"""
def __init__(self, session, cancelable = True, close_on_finish = False):
self.skin = NFIFlash.skin
Screen.__init__(self, session)
self["job_progressbar"] = Progress()
self["job_progresslabel"] = StaticText("")
self["finished"] = Boolean()
self["infolabel"] = StaticText("")
self["statusbar"] = StaticText(_("Please select .NFI flash image file from medium"))
self["listlabel"] = StaticText(_("select .NFI flash file")+":")
self["key_green"] = StaticText()
self["key_yellow"] = StaticText()
self["key_blue"] = StaticText()
self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions"],
{
"green": self.ok,
"yellow": self.reboot,
"ok": self.ok,
"left": self.left,
"right": self.right,
"up": self.up,
"down": self.down
}, -1)
currDir = "/media/usb/"
self.filelist = FileList(currDir, matchingPattern = "^.*\.(nfi|NFI)")
self["filelist"] = self.filelist
self.nfifile = ""
self.md5sum = ""
self.job = None
self.box = HardwareInfo().get_device_name()
def closeCB(self):
if ( self.job is None or self.job.status is not self.job.IN_PROGRESS ) and not self.no_autostart:
self.close()
#else:
#if self.cancelable:
#self.cancel()
def up(self):
self["filelist"].up()
self.check_for_NFO()
def down(self):
self["filelist"].down()
self.check_for_NFO()
def right(self):
self["filelist"].pageDown()
self.check_for_NFO()
def left(self):
self["filelist"].pageUp()
self.check_for_NFO()
def check_for_NFO(self):
self.session.summary.setText(self["filelist"].getFilename())
if self["filelist"].getFilename() is None:
return
if self["filelist"].getCurrentDirectory() is not None:
self.nfifile = self["filelist"].getCurrentDirectory()+self["filelist"].getFilename()
if self.nfifile.upper().endswith(".NFI"):
self["key_green"].text = _("Flash")
nfofilename = self.nfifile[0:-3]+"nfo"
if fileExists(nfofilename):
nfocontent = open(nfofilename, "r").read()
self["infolabel"].text = nfocontent
pos = nfocontent.find("MD5:")
if pos > 0:
self.md5sum = nfocontent[pos+5:pos+5+32] + " " + self.nfifile
else:
self.md5sum = ""
else:
self["infolabel"].text = _("No details for this image file") + ":\n" + self["filelist"].getFilename()
self.md5sum = ""
else:
self["infolabel"].text = ""
self["key_green"].text = ""
#.........这里部分代码省略.........