[hbbtv] upgraded.
[vuplus_dvbapp] / lib / python / Plugins / Extensions / HbbTV / aitreader.py
old mode 100755 (executable)
new mode 100644 (file)
index afbcd9a..757b0f3
@@ -1,10 +1,12 @@
 import os, xml.dom.minidom
 from enigma import iServiceInformation
 
-DUMPBIN = "/usr/lib/enigma2/python/Plugins/Extensions/HbbTV/dumpait"
+import vbcfg
+
+DUMPBIN = vbcfg.PLUGINROOT + "/dumpait"
 class eAITSectionReader:
        def __init__(self, demux, pmtid, sid):
-               self.mVuplusBox = None
+               self.mVuplusBox = False
                self.mInfo = None
                self.mAppList  = []
                self.mDocument = None
@@ -25,7 +27,7 @@ class eAITSectionReader:
        def __application(self, application):
                item = {}
 
-               if self.mVuplusBox is not None:
+               if self.mVuplusBox:
                        item["name"]    = str(application[1])
                        item["url"]     = str(application[2])
                        item["control"] = int(application[0])
@@ -39,13 +41,12 @@ class eAITSectionReader:
                        item["orgid"]   = int(self.__item(application, "orgid"))
                        item["appid"]   = int(self.__item(application, "appid"))
                        item["profile"] = int(self.__item(application, "profile"))
-               #print item
                return item
 
        def doParseApplications(self):
                l = []
 
-               if self.mVuplusBox is not None:
+               if self.mVuplusBox:
                        for application in self.mInfo.getInfoObject(iServiceInformation.sHBBTVUrl):
                                item = self.__application(application)
                                l.append(item)
@@ -59,7 +60,7 @@ class eAITSectionReader:
                return self.mAppList
 
        def doOpen(self, info, is_vuplusbox):
-               if is_vuplusbox is not None:
+               if is_vuplusbox:
                        self.mVuplusBox = is_vuplusbox
                        self.mInfo = info
                        return True
@@ -67,13 +68,16 @@ class eAITSectionReader:
                document = ""
                try:    document = os.popen(self.mCommand).read()
                except Exception, ErrMsg:
-                       print ErrMsg
+                       vbcfg.ERR(ErrMsg)
                        return False
                if len(document) == 0:
                        return False
                document = document.decode("cp1252").encode("utf-8")
-               #print document
-               self.mDocument = xml.dom.minidom.parseString(document)
+               try:
+                       self.mDocument = xml.dom.minidom.parseString(document)
+               except Exception, ErrMsg:
+                       vbcfg.ERR("XML parse: %s" % ErrMsg)
+                       return False
                return True
 
        def doDump(self):
@@ -91,7 +95,8 @@ def unit_test(demux, pmtid, sid):
        if reader.doOpen():
                reader.doParseApplications()
                reader.doDump()
-       else:   print "no data!!"
+       else:
+               vbcfg.ERR("no data!!")
 
 #unit_test('0', 0x17d4, 0x2b66)