don't crash if time is *really* invalid
[enigma2.git] / lib / python / Components / NimManager.py
index 1ad4c229366c2f97cfb3f331a7569866881dd5f7..824f9f71df253ee1581db16ffe9c4ef9a2c333d2 100644 (file)
@@ -2,7 +2,6 @@ from config import config       #global config instance
 
 from config import configElement
 from config import ConfigSubsection
-from config import ConfigSlider
 from config import configSelection
 from config import currentConfigSelectionElement
 from config import getConfigSelectionElement
@@ -392,7 +391,7 @@ class NimManager:
                def startElement(self, name, attrs):
                        if (name == "terrestrial"):
                                #print "found sat " + attrs.get('name',"") + " " + str(attrs.get('position',""))
-                               tname = attrs.get('name',"")
+                               tname = attrs.get('name',"").encode("UTF-8")
                                tflags = attrs.get('flags',"")
                                self.terrestrialsList.append((tname, tflags))
                                self.parsedTer = str(tname)
@@ -423,9 +422,18 @@ class NimManager:
        def getTranspondersCable(self, cable):
                return self.transponderscable[cable]
 
+       def getTranspondersTerrestrial(self, region):
+               return self.transpondersterrestrial[region]
+       
        def getCableDescription(self, nim):
                return self.cablesList[config.Nims[nim].cable.value]
 
+       def getTerrestrialDescription(self, nim):
+               return self.terrestrialsList[config.Nims[nim].terrestrial.value][0]
+
+       def getTerrestrialFlags(self, nim):
+               return self.terrestrialsList[config.Nims[nim].terrestrial.value][1]
+
        def getConfiguredSats(self):
                return self.sec.getSatList()
 
@@ -478,6 +486,7 @@ class NimManager:
                                self.nimSocketCount += 1
                        elif line.strip().startswith("Type:"):
                                self.nimTypes[lastsocket] = str(line.strip()[6:])
+                               #self.nimTypes[lastsocket] = str("DVB-T")
                        elif line.strip().startswith("Name:"):
                                self.nimNames[lastsocket] = str(line.strip()[6:])
                        elif line.strip().startswith("empty"):
@@ -558,7 +567,13 @@ class NimManager:
                                nimText += ("DVB-S", "DVB-C", "DVB-T")[slot.nimType] + ")"
                        list.append((nimText, slot))
                return list
+
+       def getNimConfigMode(self, slotid):
+               return currentConfigSelectionElement(config.Nims[slotid].configMode)
        
+       def getSatList(self):
+               return self.satList
+
        def getSatListForNim(self, slotid):
                list = []
                if (self.getNimType(slotid) == self.nimType["DVB-S"]):
@@ -584,6 +599,28 @@ class NimManager:
                                                list.append(x)
                return list
 
+       def getRotorSatListForNim(self, slotid):
+               list = []
+               if (self.getNimType(slotid) == self.nimType["DVB-S"]):
+                       #print "slotid:", slotid
+
+                       #print "self.satellites:", self.satList[config.Nims[slotid].diseqcA.value]
+                       #print "diseqcA:", config.Nims[slotid].diseqcA.value
+                       configMode = currentConfigSelectionElement(config.Nims[slotid].configMode)
+                       if configMode == "simple":
+                               if (config.Nims[slotid].diseqcMode.value == 4):
+                                       for x in self.satList:
+                                               list.append(x)
+                       elif configMode == "advanced":
+                               for x in self.satList:
+                                       nim = config.Nims[slotid]
+                                       lnbnum = nim.advanced.sat[x[1]].lnb.value
+                                       if lnbnum != 0:
+                                               lnb = nim.advanced.lnb[lnbnum]
+                                               if lnb.diseqcMode.value == 3: # diseqc 1.2
+                                                       list.append(x)
+               return list
+
        def nimDiseqcModeChanged(self, slotid, mode):
                #print "nimDiseqcModeChanged set to " + str(mode)
                pass
@@ -726,7 +763,10 @@ def InitNimManager(nimmgr):
                elif slot.nimType == nimmgr.nimType["DVB-C"]:
                        nim.cable = configElement(cname + "cable", configSelection, 0, nimmgr.cablesList, False);
                elif slot.nimType == nimmgr.nimType["DVB-T"]:
-                       nim.cable = configElement(cname + "terrestrial", configSelection, 0, nimmgr.terrestrialsList, False);
+                       list = []
+                       for x in nimmgr.terrestrialsList:
+                               list.append(x[0])
+                       nim.terrestrial = configElement(cname + "terrestrial", configSelection, 0, list, False);
                else:
                        print "pls add support for this frontend type!"