added diseqc-options
[enigma2.git] / lib / python / Components / NimManager.py
index 62b1fd8..6af1e76 100644 (file)
@@ -4,6 +4,12 @@ from config import configElement
 from config import ConfigSubsection
 from config import ConfigSlider
 from config import configSelection
+from config import configSatlist
+
+import xml.dom.minidom
+from xml.dom import EMPTY_NAMESPACE
+from skin import elementsWithTag
+from Tools import XMLTools
 
 class nimSlot:
        def __init__(self, slotid, nimtype, name):
@@ -12,6 +18,22 @@ class nimSlot:
                self.name = name
 
 class NimManager:
+       def readSatsfromFile(self):
+               self.satellites = { }
+               #FIXME: path ok???
+               satfile = file('/etc/tuxbox/satellites.xml', 'r')
+               satdom = xml.dom.minidom.parseString(satfile.read())
+               satfile.close()
+
+               for entries in elementsWithTag(satdom.childNodes, "satellites"):
+                       for x in elementsWithTag(entries.childNodes, "sat"):
+                               #print "found sat " + x.getAttribute('name') + " " + str(x.getAttribute('position'))
+                               tpos = x.getAttribute('position')
+                               tname = x.getAttribute('name')
+                               #tname.encode('utf8')
+                               self.satellites[tpos] = tname
+                               self.satList.append( (tname, tpos) )
+
        def getNimType(self, slotID):
                #FIXME get it from /proc
                if slotID == 0:
@@ -36,6 +58,9 @@ class NimManager:
                                                                                                "DVB-S": 0,
                                                                                                "DVB-C": 1,
                                                                                                "DVB-T": 2}
+               self.satList = [ ]                                                                              
+                                                                                               
+               self.readSatsfromFile()                                                                         
                                                                                                
                self.nimCount = self.getNimSocketCount()
 
@@ -71,13 +96,11 @@ def InitNimManager(nimmgr):
                
                if slot.nimType == nimmgr.nimType["DVB-S"]:
                        config.Nims[x].configMode = configElement(cname + "configMode",configSelection, 0, ("Simple", "Advanced"));
-                       config.Nims[x].diseqcMode = configElement(cname + "diseqcMode",configSelection, 0, ("Single", "Toneburst A/B", "DiSEqC A/B"));
-                       config.Nims[x].diseqcMode = configElement(cname + "toneburstA",configSelection, 0, ("Astra", "Hotbird"));
-                       config.Nims[x].diseqcMode = configElement(cname + "toneburstB",configSelection, 0, ("Astra", "Hotbird"));
-                       config.Nims[x].diseqcMode = configElement(cname + "diseqcA",configSelection, 0, ("Astra", "Hotbird"));
-                       config.Nims[x].diseqcMode = configElement(cname + "diseqcB",configSelection, 0, ("Astra", "Hotbird"));
-                       config.Nims[x].diseqcMode = configElement(cname + "diseqcC",configSelection, 0, ("Astra", "Hotbird"));
-                       config.Nims[x].diseqcMode = configElement(cname + "diseqcD",configSelection, 0, ("Astra", "Hotbird"));
+                       config.Nims[x].diseqcMode = configElement(cname + "diseqcMode",configSelection, 2, ("Single", "Toneburst A/B", "DiSEqC A/B", "DiSEqC A/B/C/D"));
+                       config.Nims[x].diseqcA = configElement(cname + "diseqcA",configSatlist, 192, nimmgr.satList);
+                       config.Nims[x].diseqcB = configElement(cname + "diseqcB",configSatlist, 130, nimmgr.satList);
+                       config.Nims[x].diseqcC = configElement(cname + "diseqcC",configSatlist, 0, nimmgr.satList);
+                       config.Nims[x].diseqcD = configElement(cname + "diseqcD",configSatlist, 0, nimmgr.satList);
                else:
                        print "pls add support for this frontend type!"