本文整理汇总了Python中Tools.Transponder.ConvertToHumanReadable.keys方法的典型用法代码示例。如果您正苦于以下问题:Python ConvertToHumanReadable.keys方法的具体用法?Python ConvertToHumanReadable.keys怎么用?Python ConvertToHumanReadable.keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tools.Transponder.ConvertToHumanReadable
的用法示例。
在下文中一共展示了ConvertToHumanReadable.keys方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: information
# 需要导入模块: from Tools.Transponder import ConvertToHumanReadable [as 别名]
# 或者: from Tools.Transponder.ConvertToHumanReadable import keys [as 别名]
def information(self):
if self.type == TYPE_SERVICE_INFO:
if self.session.nav.getCurrentlyPlayingServiceReference():
name = ServiceReference(self.session.nav.getCurrentlyPlayingServiceReference()).getServiceName()
refstr = self.session.nav.getCurrentlyPlayingServiceReference().toString()
else:
name = _("N/A")
refstr = _("N/A")
aspect = self.getServiceInfoValue(iServiceInformation.sAspect)
if aspect in ( 1, 2, 5, 6, 9, 0xA, 0xD, 0xE ):
aspect = _("4:3")
else:
aspect = _("16:9")
width = self.info and self.info.getInfo(iServiceInformation.sVideoWidth) or -1
height = self.info and self.info.getInfo(iServiceInformation.sVideoHeight) or -1
if width != -1 and height != -1:
Labels = ( (_("Name"), name, TYPE_TEXT),
(_("Provider"), self.getServiceInfoValue(iServiceInformation.sProvider), TYPE_TEXT),
(_("Aspect ratio"), aspect, TYPE_TEXT),
(_("Resolution"), "%dx%d" %(width, height), TYPE_TEXT),
(_("Namespace"), self.getServiceInfoValue(iServiceInformation.sNamespace), TYPE_VALUE_HEX, 8),
(_("Service reference"), refstr, TYPE_TEXT))
else:
Labels = ( (_("Name"), name, TYPE_TEXT),
(_("Provider"), self.getServiceInfoValue(iServiceInformation.sProvider), TYPE_TEXT),
(_("Aspect ratio"), aspect, TYPE_TEXT),
(_("Namespace"), self.getServiceInfoValue(iServiceInformation.sNamespace), TYPE_VALUE_HEX, 8),
(_("Service reference"), refstr, TYPE_TEXT))
self.fillList(Labels)
else:
if self.transponder_info:
tp_info = ConvertToHumanReadable(self.transponder_info)
conv = { "tuner_type" : _("Type"),
"system" : _("System"),
"modulation" : _("Modulation"),
"orbital_position" : _("Orbital position"),
"frequency" : _("Frequency"),
"symbol_rate" : _("Symbol rate"),
"bandwidth" : _("Bandwidth"),
"polarization" : _("Polarization"),
"inversion" : _("Inversion"),
"pilot" : _("Pilot"),
"rolloff" : _("Roll-off"),
"fec_inner" : _("FEC"),
"code_rate_lp" : _("Code rate LP"),
"code_rate_hp" : _("Code rate HP"),
"constellation" : _("Constellation"),
"transmission_mode" : _("Transmission mode"),
"guard_interval" : _("Guard interval"),
"hierarchy_information" : _("Hierarchy info"),
"plp_id" : _("Stream Id"),
"is_id" : _("Stream Id"),
"pls_mode" : _("PLS Mode"),
"pls_code" : _("PLS Code")}
Labels = [(conv[i], tp_info[i], TYPE_VALUE_DEC) for i in tp_info.keys()]
self.fillList(Labels)
示例2: information
# 需要导入模块: from Tools.Transponder import ConvertToHumanReadable [as 别名]
# 或者: from Tools.Transponder.ConvertToHumanReadable import keys [as 别名]
def information(self):
if self.type == TYPE_SERVICE_INFO:
if self.session.nav.getCurrentlyPlayingServiceOrGroup():
name = ServiceReference(self.session.nav.getCurrentlyPlayingServiceReference()).getServiceName()
refstr = self.session.nav.getCurrentlyPlayingServiceReference().toString()
else:
name = _("N/A")
refstr = _("N/A")
aspect = "-"
videocodec = "-"
resolution = "-"
if self.info:
videocodec = ("MPEG2", "MPEG4", "MPEG1", "MPEG4-II", "VC1", "VC1-SM", "-" )[self.info and self.info.getInfo(iServiceInformation.sVideoType)]
width = self.info.getInfo(iServiceInformation.sVideoWidth)
height = self.info.getInfo(iServiceInformation.sVideoHeight)
if width > 0 and height > 0:
resolution = "%dx%d" % (width,height)
resolution += ("i", "p", "")[self.info.getInfo(iServiceInformation.sProgressive)]
resolution += str((self.info.getInfo(iServiceInformation.sFrameRate) + 500) / 1000)
aspect = self.getServiceInfoValue(iServiceInformation.sAspect)
if aspect in ( 1, 2, 5, 6, 9, 0xA, 0xD, 0xE ):
aspect = "4:3"
else:
aspect = "16:9"
Labels = ( (_("Name"), name, TYPE_TEXT),
(_("Provider"), self.getServiceInfoValue(iServiceInformation.sProvider), TYPE_TEXT),
(_("Videoformat"), aspect, TYPE_TEXT),
(_("Videosize"), resolution, TYPE_TEXT),
(_("Videocodec"), videocodec, TYPE_TEXT),
(_("Namespace"), self.getServiceInfoValue(iServiceInformation.sNamespace), TYPE_VALUE_HEX, 8),
(_("Service reference"), refstr, TYPE_TEXT))
self.fillList(Labels)
else:
if self.transponder_info:
tp_info = ConvertToHumanReadable(self.transponder_info)
conv = { "tuner_type" : _("Transponder type"),
"system" : _("System"),
"modulation" : _("Modulation"),
"orbital_position" : _("Orbital position"),
"frequency" : _("Frequency"),
"symbol_rate" : _("Symbol rate"),
"bandwidth" : _("Bandwidth"),
"polarization" : _("Polarization"),
"inversion" : _("Inversion"),
"pilot" : _("Pilot"),
"rolloff" : _("Roll-off"),
"fec_inner" : _("FEC"),
"code_rate_lp" : _("Coderate LP"),
"code_rate_hp" : _("Coderate HP"),
"constellation" : _("Constellation"),
"transmission_mode": _("Transmission mode"),
"guard_interval" : _("Guard interval"),
"hierarchy_information": _("Hierarchy information") }
Labels = [(conv[i], tp_info[i], i == "orbital_position" and TYPE_VALUE_ORBIT_DEC or TYPE_VALUE_DEC) for i in tp_info.keys() if i in conv]
self.fillList(Labels)
示例3: information
# 需要导入模块: from Tools.Transponder import ConvertToHumanReadable [as 别名]
# 或者: from Tools.Transponder.ConvertToHumanReadable import keys [as 别名]
def information(self):
if self.type == TYPE_SERVICE_INFO:
if self.session.nav.getCurrentlyPlayingServiceOrGroup():
name = ServiceReference(self.session.nav.getCurrentlyPlayingServiceReference()).getServiceName()
refstr = self.session.nav.getCurrentlyPlayingServiceReference().toString()
else:
name = _("N/A")
refstr = _("N/A")
aspect = "-"
videocodec = "-"
videomode = "-"
resolution = "-"
if self.info:
videocodec = ("MPEG2", "MPEG4", "MPEG1", "MPEG4-II", "VC1", "VC1-SM", "-" )[self.info and self.info.getInfo(iServiceInformation.sVideoType)]
video_height = 0
video_width = 0
video_pol = " "
video_rate = 0
if path.exists("/proc/stb/vmpeg/0/yres"):
f = open("/proc/stb/vmpeg/0/yres", "r")
try:
video_height = int(f.read(),16)
except:
pass
f.close()
if path.exists("/proc/stb/vmpeg/0/xres"):
f = open("/proc/stb/vmpeg/0/xres", "r")
try:
video_width = int(f.read(),16)
except:
pass
f.close()
if path.exists("/proc/stb/vmpeg/0/progressive"):
f = open("/proc/stb/vmpeg/0/progressive", "r")
try:
video_pol = "p" if int(f.read(),16) else "i"
except:
pass
f.close()
if path.exists("/proc/stb/vmpeg/0/framerate"):
f = open("/proc/stb/vmpeg/0/framerate", "r")
try:
video_rate = int(f.read())
except:
pass
f.close()
fps = str((video_rate + 500) / 1000)
resolution = str(video_width) + "x" + str(video_height) + video_pol + fps
aspect = self.getServiceInfoValue(iServiceInformation.sAspect)
if aspect in ( 1, 2, 5, 6, 9, 0xA, 0xD, 0xE ):
aspect = "4:3"
else:
aspect = "16:9"
f = open("/proc/stb/video/videomode")
videomode = f.read()[:-1].replace('\n','')
f.close()
Labels = ( (_("Name"), name, TYPE_TEXT),
(_("Provider"), self.getServiceInfoValue(iServiceInformation.sProvider), TYPE_TEXT),
(_("Videoformat"), aspect, TYPE_TEXT),
(_("Videomode"), videomode, TYPE_TEXT),
(_("Videosize"), resolution, TYPE_TEXT),
(_("Videocodec"), videocodec, TYPE_TEXT),
(_("Namespace"), self.getServiceInfoValue(iServiceInformation.sNamespace), TYPE_VALUE_HEX, 8),
(_("Service reference"), refstr, TYPE_TEXT))
self.fillList(Labels)
else:
if self.transponder_info:
tp_info = ConvertToHumanReadable(self.transponder_info)
conv = { "tuner_type" : _("Transponder type"),
"system" : _("System"),
"modulation" : _("Modulation"),
"orbital_position" : _("Orbital position"),
"frequency" : _("Frequency"),
"symbol_rate" : _("Symbol rate"),
"bandwidth" : _("Bandwidth"),
"polarization" : _("Polarization"),
"inversion" : _("Inversion"),
"pilot" : _("Pilot"),
"rolloff" : _("Roll-off"),
"fec_inner" : _("FEC"),
"code_rate_lp" : _("Coderate LP"),
"code_rate_hp" : _("Coderate HP"),
"constellation" : _("Constellation"),
"transmission_mode": _("Transmission mode"),
"guard_interval" : _("Guard interval"),
"hierarchy_information": _("Hierarchy information") }
Labels = [(conv[i], tp_info[i], i == "orbital_position" and TYPE_VALUE_ORBIT_DEC or TYPE_VALUE_DEC) for i in tp_info.keys() if i in conv]
self.fillList(Labels)
示例4: information
# 需要导入模块: from Tools.Transponder import ConvertToHumanReadable [as 别名]
# 或者: from Tools.Transponder.ConvertToHumanReadable import keys [as 别名]
def information(self):
if self.type == TYPE_SERVICE_INFO:
if self.session.nav.getCurrentlyPlayingServiceOrGroup():
name = ServiceReference(self.session.nav.getCurrentlyPlayingServiceReference()).getServiceName()
refstr = self.session.nav.getCurrentlyPlayingServiceReference().toString()
else:
name = _("N/A")
refstr = _("N/A")
aspect = "-"
videocodec = "-"
videomode = "-"
resolution = "-"
if self.info:
videocodec = ("MPEG2", "MPEG4", "MPEG1", "MPEG4-VC", "VC1", "VC1-SM", "HEVC", "-")[self.info.getInfo(iServiceInformation.sVideoType)]
width = self.info.getInfo(iServiceInformation.sVideoWidth)
height = self.info.getInfo(iServiceInformation.sVideoHeight)
if width > 0 and height > 0:
resolution = "%dx%d" % (width,height)
resolution += ("i", "p", "")[self.info.getInfo(iServiceInformation.sProgressive)]
resolution += str((self.info.getInfo(iServiceInformation.sFrameRate) + 500) / 1000)
aspect = self.getServiceInfoValue(iServiceInformation.sAspect)
if aspect in ( 1, 2, 5, 6, 9, 0xA, 0xD, 0xE ):
aspect = "4:3"
else:
aspect = "16:9"
f = open("/proc/stb/video/videomode")
videomode = f.read()[:-1].replace('\n','')
f.close()
codenumbers = subprocess.check_output(['timeout -t 2 -s kill dvbsnoop -n 1 -nph 1 | grep CA_system_ID | awk -F "=" "{print $2}" | awk -F "]" "{print $1}" | wc -l'], shell=True)
codesystem = subprocess.check_output(["timeout -t 2 -s kill dvbsnoop -n 1 -nph 1 | grep CA_system_ID | awk -F '=' '{print $2}' | awk -F ']' '{print $1}'"], shell=True)
caidssyst = subprocess.check_output(["timeout -t 2 -s kill dvbsnoop -n 1 -nph 1 | grep CA_system_ID | awk -F '(' '{print $2}' | awk -F ')' '{print $1}'"], shell=True)
Labels = ( (_("Name"), name, TYPE_TEXT),
(_("Provider"), self.getServiceInfoValue(iServiceInformation.sProvider), TYPE_TEXT),
(_("Videoformat"), aspect, TYPE_TEXT),
(_("Videomode"), videomode, TYPE_TEXT),
(_("Videosize"), resolution, TYPE_TEXT),
(_("Videocodec"), videocodec, TYPE_TEXT),
(_("Namespace"), self.getServiceInfoValue(iServiceInformation.sNamespace), TYPE_VALUE_HEX, 8),
(_("Service reference"), refstr, TYPE_TEXT),
(_("Coding Systems"), codenumbers, TYPE_TEXT))
if codenumbers > 0:
i = 0
caidssyst1 = caidssyst.splitlines()
codesystem1 = codesystem.splitlines()
while i < int(codenumbers):
caidsystem = caidssyst1[i] + " " + codesystem1[i]
i += 1
newlabel = ( (_("%s " %i), caidsystem, TYPE_TEXT))
Labels = Labels + (newlabel,)
self.fillList(Labels)
else:
if self.transponder_info:
tp_info = ConvertToHumanReadable(self.transponder_info)
conv = { "tuner_type" : _("Transponder type"),
"system" : _("System"),
"modulation" : _("Modulation"),
"orbital_position" : _("Orbital position"),
"frequency" : _("Frequency"),
"symbol_rate" : _("Symbol rate"),
"bandwidth" : _("Bandwidth"),
"polarization" : _("Polarization"),
"inversion" : _("Inversion"),
"pilot" : _("Pilot"),
"rolloff" : _("Roll-off"),
"is_id" : _("Input Stream ID"),
"pls_mode" : _("PLS Mode"),
"pls_code" : _("PLS Code"),
"fec_inner" : _("FEC"),
"code_rate_lp" : _("Coderate LP"),
"code_rate_hp" : _("Coderate HP"),
"constellation" : _("Constellation"),
"transmission_mode": _("Transmission mode"),
"guard_interval" : _("Guard interval"),
"hierarchy_information": _("Hierarchy information")}
Labels = [(conv[i], tp_info[i], i == "orbital_position" and TYPE_VALUE_ORBIT_DEC or TYPE_VALUE_DEC) for i in tp_info.keys() if i in conv]
self.fillList(Labels)
示例5: information
# 需要导入模块: from Tools.Transponder import ConvertToHumanReadable [as 别名]
# 或者: from Tools.Transponder.ConvertToHumanReadable import keys [as 别名]
def information(self):
if self.type == TYPE_SERVICE_INFO:
if self.session.nav.getCurrentlyPlayingServiceOrGroup():
name = ServiceReference(self.session.nav.getCurrentlyPlayingServiceReference()).getServiceName()
refstr = self.session.nav.getCurrentlyPlayingServiceReference().toString()
else:
name = _('N/A')
refstr = _('N/A')
aspect = '-'
videocodec = '-'
videomode = '-'
resolution = '-'
if self.info:
videocodec = ('MPEG2', 'MPEG4', 'MPEG1', 'MPEG4-II', 'VC1', 'VC1-SM', '-')[self.info and self.info.getInfo(iServiceInformation.sVideoType)]
video_height = 0
video_width = 0
video_pol = ' '
video_rate = 0
if path.exists('/proc/stb/vmpeg/0/yres'):
f = open('/proc/stb/vmpeg/0/yres', 'r')
try:
video_height = int(f.read(), 16)
except:
pass
f.close()
if path.exists('/proc/stb/vmpeg/0/xres'):
f = open('/proc/stb/vmpeg/0/xres', 'r')
try:
video_width = int(f.read(), 16)
except:
pass
f.close()
if path.exists('/proc/stb/vmpeg/0/progressive'):
f = open('/proc/stb/vmpeg/0/progressive', 'r')
try:
video_pol = 'p' if int(f.read(), 16) else 'i'
except:
pass
f.close()
if path.exists('/proc/stb/vmpeg/0/framerate'):
f = open('/proc/stb/vmpeg/0/framerate', 'r')
try:
video_rate = int(f.read())
except:
pass
f.close()
fps = str((video_rate + 500) / 1000)
resolution = str(video_width) + 'x' + str(video_height) + video_pol + fps
aspect = self.getServiceInfoValue(iServiceInformation.sAspect)
if aspect in (1, 2, 5, 6, 9, 10, 13, 14):
aspect = '4:3'
else:
aspect = '16:9'
f = open('/proc/stb/video/videomode')
videomode = f.read()[:-1].replace('\n', '')
f.close()
Labels = ((_('Name'), name, TYPE_TEXT),
(_('Provider'), self.getServiceInfoValue(iServiceInformation.sProvider), TYPE_TEXT),
(_('Videoformat'), aspect, TYPE_TEXT),
(_('Videomode'), videomode, TYPE_TEXT),
(_('Videosize'), resolution, TYPE_TEXT),
(_('Videocodec'), videocodec, TYPE_TEXT),
(_('Namespace'),
self.getServiceInfoValue(iServiceInformation.sNamespace),
TYPE_VALUE_HEX,
8),
(_('Service reference'), refstr, TYPE_TEXT))
self.fillList(Labels)
elif self.transponder_info:
tp_info = ConvertToHumanReadable(self.transponder_info)
conv = {'tuner_type': _('Transponder type'),
'system': _('System'),
'modulation': _('Modulation'),
'orbital_position': _('Orbital position'),
'frequency': _('Frequency'),
'symbol_rate': _('Symbol rate'),
'bandwidth': _('Bandwidth'),
'polarization': _('Polarization'),
'inversion': _('Inversion'),
'pilot': _('Pilot'),
'rolloff': _('Roll-off'),
'fec_inner': _('FEC'),
'code_rate_lp': _('Coderate LP'),
'code_rate_hp': _('Coderate HP'),
'constellation': _('Constellation'),
'transmission_mode': _('Transmission mode'),
'guard_interval': _('Guard interval'),
'hierarchy_information': _('Hierarchy information')}
Labels = [ (conv[i], tp_info[i], i == 'orbital_position' and TYPE_VALUE_ORBIT_DEC or TYPE_VALUE_DEC) for i in tp_info.keys() if i in conv ]
self.fillList(Labels)
示例6: information
# 需要导入模块: from Tools.Transponder import ConvertToHumanReadable [as 别名]
# 或者: from Tools.Transponder.ConvertToHumanReadable import keys [as 别名]
def information(self):
if self.type == TYPE_SERVICE_INFO:
if self.session.nav.getCurrentlyPlayingServiceOrGroup():
name = ServiceReference(self.session.nav.getCurrentlyPlayingServiceReference()).getServiceName()
refstr = self.session.nav.getCurrentlyPlayingServiceReference().toString()
else:
name = _("N/A")
refstr = _("N/A")
aspect = "-"
videocodec = "-"
videomode = "-"
resolution = "-"
if self.info:
from Components.Converter.PliExtraInfo import codec_data
videocodec = codec_data.get(self.info.getInfo(iServiceInformation.sVideoType), "N/A")
width = self.info.getInfo(iServiceInformation.sVideoWidth)
height = self.info.getInfo(iServiceInformation.sVideoHeight)
if width > 0 and height > 0:
resolution = "%dx%d" % (width,height)
resolution += ("i", "p", "-")[self.info.getInfo(iServiceInformation.sProgressive)]
resolution += str((self.info.getInfo(iServiceInformation.sFrameRate) + 500) / 1000)
aspect = self.getServiceInfoValue(iServiceInformation.sAspect)
aspect = aspect in ( 1, 2, 5, 6, 9, 0xA, 0xD, 0xE ) and "4:3" or "16:9"
resolution += " - ["+aspect+"]"
gammas = ("SDR", "HDR", "HDR10", "HLG", "")
if self.info.getInfo(iServiceInformation.sGamma) < len(gammas):
gamma = gammas[self.info.getInfo(iServiceInformation.sGamma)]
if gamma:
resolution += " - " + gamma
f = open("/proc/stb/video/videomode")
videomode = f.read()[:-1].replace('\n','')
f.close()
Labels = ( (_("Name"), name, TYPE_TEXT),
(_("Provider"), self.getServiceInfoValue(iServiceInformation.sProvider), TYPE_TEXT),
(_("Videoformat"), aspect, TYPE_TEXT),
(_("Videomode"), videomode, TYPE_TEXT),
(_("Videosize"), resolution, TYPE_TEXT),
(_("Videocodec"), videocodec, TYPE_TEXT),
(_("Namespace"), self.getServiceInfoValue(iServiceInformation.sNamespace), TYPE_VALUE_HEX, 8),
(_("Service reference"), refstr, TYPE_TEXT))
self.fillList(Labels)
else:
if self.transponder_info:
tp_info = ConvertToHumanReadable(self.transponder_info)
conv = { "tuner_type" : _("Transponder type"),
"system" : _("System"),
"modulation" : _("Modulation"),
"orbital_position" : _("Orbital position"),
"frequency" : _("Frequency"),
"symbol_rate" : _("Symbol rate"),
"bandwidth" : _("Bandwidth"),
"polarization" : _("Polarization"),
"inversion" : _("Inversion"),
"pilot" : _("Pilot"),
"rolloff" : _("Roll-off"),
"is_id" : _("Input Stream ID"),
"pls_mode" : _("PLS Mode"),
"pls_code" : _("PLS Code"),
"t2mi_plp_id" : _("T2MI PLP ID"),
"t2mi_pip" : _("T2MI PID"),
"fec_inner" : _("FEC"),
"code_rate_lp" : _("Coderate LP"),
"code_rate_hp" : _("Coderate HP"),
"constellation" : _("Constellation"),
"transmission_mode" : _("Transmission mode"),
"guard_interval" : _("Guard interval"),
"hierarchy_information" : _("Hierarchy information")}
Labels = [(conv[i], tp_info[i], i == "orbital_position" and TYPE_VALUE_ORBIT_DEC or TYPE_VALUE_DEC) for i in tp_info.keys() if i in conv]
self.fillList(Labels)