當前位置: 首頁>>代碼示例>>Python>>正文


Python HardwareInfo.startswith方法代碼示例

本文整理匯總了Python中Tools.HardwareInfo.HardwareInfo.startswith方法的典型用法代碼示例。如果您正苦於以下問題:Python HardwareInfo.startswith方法的具體用法?Python HardwareInfo.startswith怎麽用?Python HardwareInfo.startswith使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tools.HardwareInfo.HardwareInfo的用法示例。


在下文中一共展示了HardwareInfo.startswith方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from Tools.HardwareInfo import HardwareInfo [as 別名]
# 或者: from Tools.HardwareInfo.HardwareInfo import startswith [as 別名]
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')
開發者ID:wslee2,項目名稱:enigma2,代碼行數:55,代碼來源:RcModel.py

示例2: __init__

# 需要導入模塊: from Tools.HardwareInfo import HardwareInfo [as 別名]
# 或者: from Tools.HardwareInfo.HardwareInfo import startswith [as 別名]
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
        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")
開發者ID:0sc0d3r,項目名稱:enigma2-1,代碼行數:42,代碼來源:RcModel.py

示例3: resolveFilename

# 需要導入模塊: from Tools.HardwareInfo import HardwareInfo [as 別名]
# 或者: from Tools.HardwareInfo.HardwareInfo import startswith [as 別名]
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
except ImportError:
	try:
		from Plugins.Extensions.LTMediaCenter.LTStreamPlayer import streamplayer
	except ImportError:
開發者ID:13K-OMAR,項目名稱:enigma2-plugins-sh4,代碼行數:33,代碼來源:plugin.py

示例4: HardwareInfo

# 需要導入模塊: from Tools.HardwareInfo import HardwareInfo [as 別名]
# 或者: from Tools.HardwareInfo.HardwareInfo import startswith [as 別名]
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

try:
	from Plugins.Extensions.VlcPlayer.VlcServerConfig import vlcServerConfig
except ImportError:
	vlcServerConfig = None
開發者ID:Haehnchen,項目名稱:enigma2-plugins,代碼行數:32,代碼來源:plugin.py

示例5: open

# 需要導入模塊: from Tools.HardwareInfo import HardwareInfo [as 別名]
# 或者: from Tools.HardwareInfo.HardwareInfo import startswith [as 別名]
	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"
	try:
		f = open("/proc/stb/info/vumodel")
		MODEL_NAME = f.read().strip()
		f.close()
	except:
		pass
elif device_name and device_name.startswith('dm') and os.path.exists("/proc/stb/info/model"):
	BOX_NAME = "dmm"
	try:
		f = open("/proc/stb/info/model")
		MODEL_NAME = f.read().strip()
		f.close()
	except:
		pass
elif os.path.exists("/proc/stb/info/gbmodel"):
	BOX_NAME = "all"
	try:
		f = open("/proc/stb/info/gbmodel")
		MODEL_NAME = f.read().strip()
		f.close()
	except:
		pass
開發者ID:fairbird,項目名稱:OpenPLI-BlackHole,代碼行數:33,代碼來源:Disks.py


注:本文中的Tools.HardwareInfo.HardwareInfo.startswith方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。