from Components.ConfigList import ConfigList
from Components.NimManager import nimmanager
from Components.Label import Label
-from enigma import eDVBFrontendParametersSatellite, eComponentScan, eDVBSatelliteEquipmentControl
+from Screens.MessageBox import MessageBox
+from enigma import eDVBFrontendParametersSatellite, eComponentScan, eDVBSatelliteEquipmentControl, eDVBFrontendParametersTerrestrial
+
+def buildTerTransponder(frequency,
+ inversion=2, bandwidth = 3, fechigh = 6, feclow = 6,
+ modulation = 2, transmission = 2, guard = 4,
+ hierarchy = 4):
+ # WARNING: normally, enums are working directly.
+ # Don't copy this (very bad)!! Instead either fix swig (good) or
+ # move this into a central place.
+ Bw8MHz = 0
+ Bw7MHz = 1
+ Bw6MHz = 2
+ Bw5MHz = 3
+ BwAuto = 4
+
+ f1_2 = 0
+ f2_3 = 1
+ f3_4 = 2
+ f5_6 = 3
+ f7_8 = 4
+ fAuto = 5
+
+ TM2k = 0
+ TM8k = 1
+ TM4k = 2
+ TMAuto = 3
+
+ GI_1_32 = 0
+ GI_1_16 = 1
+ GI_1_8 = 2
+ GI_1_4 = 3
+ GI_Auto = 4
+
+ HNone = 0
+ H1 = 1
+ H2 = 2
+ H4 = 3
+ HAuto = 4
+
+ QPSK = 0
+ QAM16 = 1
+ QAM64 = 2
+ Auto = 3
+
+ Off = 0
+ On = 1
+ Unknown = 2
+
+ parm = eDVBFrontendParametersTerrestrial()
+
+ parm.frequency = frequency
+
+ parm.inversion = [Off, On, Unknown][inversion]
+ parm.bandwidth = [Bw8MHz, Bw7MHz, Bw6MHz, BwAuto][bandwidth] # Bw5MHz unsupported
+ parm.code_rate_HP = [fAuto, f1_2, f2_3, f3_4, f5_6, f7_8, fAuto][fechigh]
+ parm.code_rate_LP = [fAuto, f1_2, f2_3, f3_4, f5_6, f7_8, fAuto][feclow]
+ parm.modulation = [QPSK, QAM16, Auto][modulation] # QAM64 unsupported
+ parm.transmission_mode = [TM2k, TM8k, TMAuto][transmission] # TM4k unsupported
+ parm.guard_interval = [GI_1_32, GI_1_16, GI_1_8, GI_1_4, GI_Auto][guard]
+ parm.hierarchy = [HNone, H1, H2, H4, HAuto][hierarchy]
+
+ return parm
def getInitialTransponderList(tlist, pos):
list = nimmanager.getTransponders(pos)
parm.inversion = 2 # AUTO
tlist.append(parm)
+def getInitialTerrestrialTransponderList(tlist, region):
+ list = nimmanager.getTranspondersTerrestrial(region)
+
+
+# inversion=2, bandwidth = 3, fechigh = 6, feclow = 6,
+# modulation = 2, transmission = 2, guard = 4,
+# hierarchy = 4):
+
+ for x in list:
+#self.transponders[self.parsedTer].append((2, freq, bw, const, crh, crl, guard, transm, hierarchy, inv))
+ if x[0] == 2: #TERRESTRIAL
+ # FIXME: we need to convert the other parameters...
+
+ # convert terrestrial.xml bandwidth to our enum
+ if x[2] in [0, 1]:
+ bandwidth = [1, 0][x[2]]
+ else:
+ bandwidth = 3 # auto
+
+ parm = buildTerTransponder(x[1], bandwidth = [1, 0][x[2]])
+ tlist.append(parm)
+
+
class ScanSetup(Screen):
def __init__(self, session):
Screen.__init__(self, session)
if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]):
if currentConfigSelectionElement(config.scan.typeterrestrial) == "single_transponder":
self.list.append(getConfigListEntry(_("Frequency"), config.scan.ter.frequency))
- self.list.append(getConfigListEntry(_("Network scan"), config.scan.cab.networkScan))
+ self.list.append(getConfigListEntry(_("Network scan"), config.scan.ter.networkScan))
self.list.append(getConfigListEntry(_("Inversion"), config.scan.ter.inversion))
self.list.append(getConfigListEntry(_("Bandwidth"), config.scan.ter.bandwidth))
self.list.append(getConfigListEntry(_("Code rate high"), config.scan.ter.fechigh))
# terrestial
config.scan.ter.frequency = configElement_nonSave("config.scan.ter.frequency", configSequence, [466], configsequencearg.get("INTEGER", (100, 900)))
config.scan.ter.inversion = configElement_nonSave("config.scan.ter.inversion", configSelection, 2, (("off", _("off")), ("on", _("on")), ("auto", _("Auto"))))
- config.scan.ter.bandwidth = configElement_nonSave("config.scan.ter.bandwidth", configSelection, 3, (("8MHz", "8MHz"), ("7MHz", "7MHz"), ("6MHz", "6MHz"), ("auto", _("Auto"))))
+ # WORKAROUND: we can't use BW-auto
+ config.scan.ter.bandwidth = configElement_nonSave("config.scan.ter.bandwidth", configSelection, 0, (("8MHz", "8MHz"), ("7MHz", "7MHz"), ("6MHz", "6MHz")))
+ #, ("auto", _("Auto"))))
config.scan.ter.fechigh = configElement_nonSave("config.scan.ter.fechigh", configSelection, 6, (("none", _("None")), "1/2", "2/3", "3/4", "5/6", "7/8", _("Auto")))
config.scan.ter.feclow = configElement_nonSave("config.scan.ter.feclow", configSelection, 6, (_("None"), ("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("auto", _("Auto"))))
config.scan.ter.modulation = configElement_nonSave("config.scan.ter.modulation", configSelection, 2, (("qpsk", "QPSK"), ("qam16", "QAM16"), ("auto", _("Auto"))))
#parm.inversion = 2 #AUTO
tlist.append(parm)
- def addTerTransponder(self, tlist, frequency,
- inversion=2, bandwidth = 3, fechigh = 6, feclow = 6,
- modulation = 2, transmission = 2, guard = 4,
- hierarchy = 4):
- # WARNING: normally, enums are working directly.
- # Don't copy this (very bad)!! Instead either fix swig (good) or
- # move this into a central place.
- Bw8MHz = 0
- Bw7MHz = 1
- Bw6MHz = 2
- Bw5MHz = 3
- BwAuto = 4
-
- f1_2 = 0
- f2_3 = 1
- f3_4 = 2
- f5_6 = 3
- f7_8 = 4
- fAuto = 5
-
- TM2k = 0
- TM8k = 1
- TM4k = 2
- TMAuto = 3
-
- GI_1_32 = 0
- GI_1_16 = 1
- GI_1_8 = 2
- GI_1_4 = 3
- GI_Auto = 4
-
- HNone = 0
- H1 = 1
- H2 = 2
- H4 = 3
- HAuto = 4
-
- QPSK = 0
- QAM16 = 1
- QAM64 = 2
- Auto = 3
-
- Off = 0
- On = 1
- Unknown = 2
-
- parm = eDVBFrontendParametersTerrestrial()
-
- parm.frequency = frequency * 1000000
-
- parm.inversion = [Off, On, Unknown][inversion]
- parm.bandwidth = [Bw8MHz, Bw7MHz, Bw6MHz, BwAuto][bandwidth] # Bw5MHz unsupported
- parm.code_rate_HP = [fAuto, f1_2, f2_3, f3_4, f5_6, f7_8, fAuto][fechigh]
- parm.code_rate_LP = [fAuto, f1_2, f2_3, f3_4, f5_6, f7_8, fAuto][feclow]
- parm.modulation = [QPSK, QAM16, Auto][modulation] # QAM64 unsupported
- parm.transmission_mode = [TM2k, TM8k, TMAuto][transmission] # TM4k unsupported
- parm.guard_interval = [GI_1_32, GI_1_16, GI_1_8, GI_1_4, GI_Auto][guard]
- parm.hierarchy = [HNone, H1, H2, H4, HAuto][hierarchy]
- tlist.append(parm)
+ def addTerTransponder(self, tlist, *args, **kwargs):
+ tlist.append(buildTerTransponder(*args, **kwargs))
def keyGo(self):
tlist = []
flags = 0
if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"]):
if currentConfigSelectionElement(config.scan.type) == "single_transponder":
-
- self.addSatTransponder(tlist, config.scan.sat.frequency.value[0],
- config.scan.sat.symbolrate.value[0],
- config.scan.sat.polarization.value,
- config.scan.sat.fec.value,
- config.scan.sat.inversion.value,
- self.satList[config.scan.nims.value][config.scan.satselection[config.scan.nims.value].value][1])
+ l = len(self.satList)
+ if l and l > config.scan.nims.value:
+ nimsats=self.satList[config.scan.nims.value]
+ l = len(config.scan.satselection)
+ if l and l > config.scan.nims.value:
+ selsatidx=config.scan.satselection[config.scan.nims.value].value
+ l = len(nimsats)
+ if l and l > selsatidx:
+ orbpos=nimsats[selsatidx][1]
+ self.addSatTransponder(tlist, config.scan.sat.frequency.value[0],
+ config.scan.sat.symbolrate.value[0],
+ config.scan.sat.polarization.value,
+ config.scan.sat.fec.value,
+ config.scan.sat.inversion.value,
+ orbpos)
elif currentConfigSelectionElement(config.scan.type) == "single_satellite":
getInitialTransponderList(tlist, int(self.satList[config.scan.nims.value][config.scan.satselection[config.scan.nims.value].value][1]))
flags |= eComponentScan.scanNetworkSearch
-
elif currentConfigSelectionElement(config.scan.type) == "multisat":
SatList = nimmanager.getSatListForNim(config.scan.nims.value)
-
for x in self.multiscanlist:
if x[1].parent.value == 0:
print " " + str(x[1].parent.configPath)
config.scan.cab.modulation.value,
config.scan.cab.fec.value,
config.scan.cab.inversion.value)
- if currentConfigSelectionElement(config.scan.cab.networkScan) == "yes":
+ if currentConfigSelectionElement(config.scan.cab.networkScan) == "yes":
flags |= eComponentScan.scanNetworkSearch
elif currentConfigSelectionElement(config.scan.typecable) == "complete":
getInitialCableTransponderList(tlist, nimmanager.getCableDescription(config.scan.nims.value))
elif (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]):
if currentConfigSelectionElement(config.scan.typeterrestrial) == "single_transponder":
self.addTerTransponder(tlist,
- config.scan.ter.frequency.value[0],
+ config.scan.ter.frequency.value[0] * 1000000,
inversion = config.scan.ter.inversion.value,
bandwidth = config.scan.ter.bandwidth.value,
fechigh = config.scan.ter.fechigh.value,
hierarchy = config.scan.ter.hierarchy.value)
if currentConfigSelectionElement(config.scan.ter.networkScan) == "yes":
flags |= eComponentScan.scanNetworkSearch
- if currentConfigSelectionElement(config.scan.typeterrestrial) == "complete":
- pass
+ elif currentConfigSelectionElement(config.scan.typeterrestrial) == "complete":
+ getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(config.scan.nims.value))
+ flags |= eComponentScan.scanNetworkSearch
for x in self["config"].list:
x[1].save()
- feid = config.scan.nims.value
- # flags |= eComponentScan.scanSearchBAT
- self.session.openWithCallback(self.doNothing, ServiceScan, [{"transponders": tlist, "feid": feid, "flags": flags}])
+ if len(tlist):
+ feid = config.scan.nims.value
+ # flags |= eComponentScan.scanSearchBAT
+ self.session.openWithCallback(self.doNothing, ServiceScan, [{"transponders": tlist, "feid": feid, "flags": flags}])
+ else:
+ self.session.open(MessageBox, _("Nothing to scan!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
- #self.close()
def doNothing(self):
pass
exclusive_satellites = sec.get_exclusive_satellites(0,1)
else:
exclusive_satellites = [0,0]
+ print "exclusive satellites", exclusive_satellites
+ two_sat_tuners = True
else:
- exclusive_satellites = [0,0]
- print "exclusive satellites", exclusive_satellites
+ two_sat_tuners = False
+
for x in self.list:
slotid = x[1].parent.configPath
print "Scan Tuner", slotid, "-", currentConfigSelectionElement(x[1].parent)
if currentConfigSelectionElement(x[1].parent) == "yes":
+ scanPossible = False
tlist = [ ]
if nimmanager.getNimType(x[1].parent.configPath) == nimmanager.nimType["DVB-S"]:
- if slotid > 0:
- idx = exclusive_satellites[0]+1
- else:
- idx = 0
- exclusive_nim_sats = exclusive_satellites[idx+1:idx+1+exclusive_satellites[idx]]
- print "exclusive_nim_sats", exclusive_nim_sats
+ if two_sat_tuners:
+ if slotid > 0:
+ idx = exclusive_satellites[0]+1
+ else:
+ idx = 0
+ exclusive_nim_sats = exclusive_satellites[idx+1:idx+1+exclusive_satellites[idx]]
+ print "exclusive_nim_sats", exclusive_nim_sats
SatList = nimmanager.getSatListForNim(slotid)
for sat in SatList:
- if sat[1] in exclusive_nim_sats or slotid == 0:
+ if not two_sat_tuners or (sat[1] in exclusive_nim_sats or slotid == 0):
+ scanPossible = True
print sat
getInitialTransponderList(tlist, sat[1])
elif nimmanager.getNimType(x[1].parent.configPath) == nimmanager.nimType["DVB-C"]:
+ ScanPossible = True
getInitialCableTransponderList(tlist, nimmanager.getCableDescription(slotid))
- scanList.append({"transponders": tlist, "feid": slotid, "flags": eComponentScan.scanNetworkSearch})
- self.session.openWithCallback(self.doNothing, ServiceScan, scanList = scanList)
+ elif nimmanager.getNimType(x[1].parent.configPath) == nimmanager.nimType["DVB-T"]:
+ ScanPossible = True
+ getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(slotid))
+ if scanPossible:
+ scanList.append({"transponders": tlist, "feid": slotid, "flags": eComponentScan.scanNetworkSearch})
+ if len(scanList):
+ self.session.openWithCallback(self.doNothing, ServiceScan, scanList = scanList)
+ else:
+ self.session.open(MessageBox, _("Nothing to scan!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
def doNothing(self):
pass