1 import os, xml.dom.minidom
2 from enigma import iServiceInformation
6 DUMPBIN = vbcfg.PLUGINROOT + "/dumpait"
7 class eAITSectionReader:
8 def __init__(self, demux, pmtid, sid):
9 self.mVuplusBox = False
13 self.mCommand = "%s --demux=%s --pmtid=%x --serviceid=%x"%(DUMPBIN, demux, pmtid, sid)
15 def __text(self, nodelist):
18 if node.nodeType == node.TEXT_NODE:
22 def __item(self, application, name):
23 for item in application.getElementsByTagName(name):
24 return self.__text(item.childNodes)
27 def __application(self, application):
31 item["name"] = str(application[1])
32 item["url"] = str(application[2])
33 item["control"] = int(application[0])
34 item["orgid"] = int(application[3])
35 item["appid"] = int(application[4])
36 item["profile"] = int(application[5])
38 item["name"] = str(self.__item(application, "name"))
39 item["url"] = str(self.__item(application, "url"))
40 item["control"] = int(self.__item(application, "control"))
41 item["orgid"] = int(self.__item(application, "orgid"))
42 item["appid"] = int(self.__item(application, "appid"))
43 item["profile"] = int(self.__item(application, "profile"))
46 def doParseApplications(self):
50 for application in self.mInfo.getInfoObject(iServiceInformation.sHBBTVUrl):
51 item = self.__application(application)
54 for application in self.mDocument.getElementsByTagName("application"):
55 item = self.__application(application)
59 def getApplicationList(self):
62 def doOpen(self, info, is_vuplusbox):
64 self.mVuplusBox = is_vuplusbox
69 try: document = os.popen(self.mCommand).read()
70 except Exception, ErrMsg:
73 if len(document) == 0:
75 document = document.decode("cp1252").encode("utf-8")
77 self.mDocument = xml.dom.minidom.parseString(document)
78 except Exception, ErrMsg:
79 vbcfg.ERR("XML parse: %s" % ErrMsg)
84 for x in self.getApplicationList():
85 print "Name :", x["name"]
86 print "URL :", x["url"]
87 print "OrgID :", x["orgid"]
88 print "AppID :", x["appid"]
89 print "Control Code :", x["control"]
90 print "Profile Code :", x["profile"]
93 def unit_test(demux, pmtid, sid):
94 reader = eAITSectionReader(demux, pmtid, sid)
96 reader.doParseApplications()
99 vbcfg.ERR("no data!!")
101 #unit_test('0', 0x17d4, 0x2b66)