X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/d9d89d9547e96de26d293fff1c901a25e889411e..88d7390f3d29293d4f87b9f70833215378305255:/lib/python/Screens/ScanSetup.py diff --git a/lib/python/Screens/ScanSetup.py b/lib/python/Screens/ScanSetup.py index 0b299f7a..e3f16081 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -83,6 +83,8 @@ def getInitialTransponderList(tlist, pos): #parm.inversion = 1 #eDVBFrontendParametersSatellite.Inversion.Off; parm.inversion = 2 #AUTO parm.orbital_position = pos + parm.system = x[5] #DVB-S or DVB-S2 + parm.modulation = x[6] tlist.append(parm) def getInitialCableTransponderList(tlist, cable): @@ -112,12 +114,13 @@ def getInitialTerrestrialTransponderList(tlist, region): # 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]]) + #if x[2] in [0, 1]: + # bandwidth = [1, 0][x[2]] + #else: + # bandwidth = 3 # auto + # + #parm = buildTerTransponder(x[1], bandwidth = [1, 0][x[2]]) + parm = buildTerTransponder(x[1], inversion = x[9], bandwidth = x[2]) tlist.append(parm) @@ -177,6 +180,7 @@ class ScanSetup(Screen): self.list.append(self.tunerEntry) self.typeOfScanEntry = None + self.systemEntry = None if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"]): self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), config.scan.type) self.list.append(self.typeOfScanEntry) @@ -191,21 +195,28 @@ class ScanSetup(Screen): if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"]): if currentConfigSelectionElement(config.scan.type) == "single_transponder": + self.systemEntry = getConfigListEntry(_('Transpondertype'), config.scan.sat.system) + self.list.append(self.systemEntry) self.list.append(getConfigListEntry(_('Satellite'), config.scan.satselection[config.scan.nims.value])) self.list.append(getConfigListEntry(_('Frequency'), config.scan.sat.frequency)) self.list.append(getConfigListEntry(_('Inversion'), config.scan.sat.inversion)) self.list.append(getConfigListEntry(_('Symbol Rate'), config.scan.sat.symbolrate)) self.list.append(getConfigListEntry(_("Polarity"), config.scan.sat.polarization)) - self.list.append(getConfigListEntry(_("FEC"), config.scan.sat.fec)) + if currentConfigSelectionElement(config.scan.sat.system) == "dvb-s": + self.list.append(getConfigListEntry(_("FEC"), config.scan.sat.fec)) + elif currentConfigSelectionElement(config.scan.sat.system) == "dvb-s2": + self.list.append(getConfigListEntry(_("FEC"), config.scan.sat.fec_s2)) + self.list.append(getConfigListEntry(_('Modulation'), config.scan.sat.modulation)) elif currentConfigSelectionElement(config.scan.type) == "single_satellite": self.updateSatList() print config.scan.satselection[config.scan.nims.value] self.list.append(getConfigListEntry(_("Satellite"), config.scan.satselection[config.scan.nims.value])) + self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices)) elif currentConfigSelectionElement(config.scan.type) == "multisat": # if (norotor) tlist = [] SatList = nimmanager.getSatListForNim(config.scan.nims.value) - + self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices)) for x in SatList: if self.Satexists(tlist, x[1]) == 0: tlist.append(x[1]) @@ -227,7 +238,7 @@ class ScanSetup(Screen): self.list.append(getConfigListEntry(_("FEC"), config.scan.cab.fec)) self.list.append(getConfigListEntry(_("Network scan"), config.scan.cab.networkScan)) elif currentConfigSelectionElement(config.scan.typecable) == "complete": - pass + self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices)) if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]): if currentConfigSelectionElement(config.scan.typeterrestrial) == "single_transponder": @@ -242,20 +253,20 @@ class ScanSetup(Screen): self.list.append(getConfigListEntry(_("Guard interval mode"), config.scan.ter.guard)) self.list.append(getConfigListEntry(_("Hierarchy mode"), config.scan.ter.hierarchy)) elif currentConfigSelectionElement(config.scan.typeterrestrial) == "complete": - pass - - if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"] and currentConfigSelectionElement(config.scan.type) == "single_transponder") or \ - (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"] and currentConfigSelectionElement(config.scan.typecable) == "single_transponder") or \ - (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"] and currentConfigSelectionElement(config.scan.typeterrestrial) == "single_transponder"): - self.configElementSNR = getConfigListEntry(_("SNR"), config.scan.snr) - self.list.append(self.configElementSNR) - self.configElementACG = getConfigListEntry(_("AGC"), config.scan.agc) - self.list.append(self.configElementACG) - self.configElementBER = getConfigListEntry(_("BER"), config.scan.ber) - self.list.append(self.configElementBER) - self.statusTimer.start(500, False) - else: - self.statusTimer.stop() + self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices)) + +# if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"] and currentConfigSelectionElement(config.scan.type) == "single_transponder") or \ +# (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"] and currentConfigSelectionElement(config.scan.typecable) == "single_transponder") or \ +# (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"] and currentConfigSelectionElement(config.scan.typeterrestrial) == "single_transponder"): +# self.configElementSNR = getConfigListEntry(_("SNR"), config.scan.snr) +# self.list.append(self.configElementSNR) +# self.configElementACG = getConfigListEntry(_("AGC"), config.scan.agc) +# self.list.append(self.configElementACG) +# self.configElementBER = getConfigListEntry(_("BER"), config.scan.ber) +# self.list.append(self.configElementBER) +# self.statusTimer.start(500, False) +# else: +# self.statusTimer.stop() self["config"].list = self.list self["config"].l.setList(self.list) @@ -270,7 +281,9 @@ class ScanSetup(Screen): print self["config"].getCurrent() if self["config"].getCurrent() == self.typeOfScanEntry: self.createSetup() - if self["config"].getCurrent() == self.tunerEntry: + elif self["config"].getCurrent() == self.tunerEntry: + self.createSetup() + elif self["config"].getCurrent() == self.systemEntry: self.createSetup() def createConfig(self): @@ -282,6 +295,7 @@ class ScanSetup(Screen): config.scan.type = configElement_nonSave("config.scan.type", configSelection, 0, (("single_transponder", _("Single transponder")), ("single_satellite", _("Single satellite")), ("multisat", _("Multisat")))) config.scan.typecable = configElement_nonSave("config.scan.typecable", configSelection, 0, (("single_transponder", _("Single transponder")), ("complete", _("Complete")))) config.scan.typeterrestrial = configElement_nonSave("config.scan.typeterrestrial", configSelection, 0, (("single_transponder", _("Single transponder")), ("complete", _("Complete")))) + config.scan.clearallservices = configElement_nonSave("config.scan.clearallservices", configSelection, 0, (("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (keep feeds)")))) nimList = [ ] for nim in nimmanager.nimList(): @@ -298,12 +312,15 @@ class ScanSetup(Screen): config.scan.ber.enabled = False # sat + config.scan.sat.system = configElement_nonSave("config.scan.sat.system", configSelection, 0, (("dvb-s", _("DVB-S")), ("dvb-s2", _("DVB-S2")))) config.scan.sat.frequency = configElement_nonSave("config.scan.sat.frequency", configSequence, [11836], configsequencearg.get("INTEGER", (1, 99999))) config.scan.sat.inversion = configElement_nonSave("config.scan.sat.inversion", configSelection, 2, (("off", _("off")), ("on", _("on")), _("Auto"))) config.scan.sat.symbolrate = configElement_nonSave("config.scan.sat.symbolrate", configSequence, [27500], configsequencearg.get("INTEGER", (1, 99999))) config.scan.sat.polarization = configElement_nonSave("config.scan.sat.polarization", configSelection, 0, (("horizontal", _("horizontal")), ("vertical", _("vertical")), ("circular_left", _("circular left")), ("circular_right", _("circular right")))) config.scan.sat.fec = configElement_nonSave("config.scan.sat.fec", configSelection, 7, (("auto", _("Auto")), ("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("none", _("None")))) - + config.scan.sat.fec_s2 = configElement_nonSave("config.scan.sat.fec_s2", configSelection, 8, (("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("3_5", "3/5"), ("4_5", "4/5"), ("5_6", "5/6"), ("7_8", "7/8"), ("8_9", "8/9"), ("9_10", "9/10"))) + config.scan.sat.modulation = configElement_nonSave("config.scan.sat.modulation", configSelection, 0, (("qpsk", "QPSK"), ("8psk", "8PSK"))) + # cable config.scan.cab.frequency = configElement_nonSave("config.scan.cab.frequency", configSequence, [466], configsequencearg.get("INTEGER", (50, 999))) config.scan.cab.inversion = configElement_nonSave("config.scan.cab.inversion", configSelection, 2, (("off", _("off")), ("on", _("on")), ("auto", _("Auto")))) @@ -355,14 +372,32 @@ class ScanSetup(Screen): if (self["config"].getCurrent()[1].parent.enabled == True): self["config"].handleKey(config.key[str(number)]) - def addSatTransponder(self, tlist, frequency, symbol_rate, polarisation, fec, inversion, orbital_position): + fecmap = { "auto": 0, + "1_2": 1, + "2_3": 2, + "3_4": 3, + "5_6": 4, + "7_8": 5, + "8_9": 6, + "3_5": 7, + "4_5": 8, + "9_10": 9, + "none": 15 + } + + def addSatTransponder(self, tlist, frequency, symbol_rate, polarisation, fec, inversion, orbital_position, system, modulation): print "Add Sat: frequ: " + str(frequency) + " symbol: " + str(symbol_rate) + " pol: " + str(polarisation) + " fec: " + str(fec) + " inversion: " + str(inversion) print "orbpos: " + str(orbital_position) parm = eDVBFrontendParametersSatellite() + if modulation == 1: + parm.modulation = 2 # eDVBFrontendParametersSatellite.Modulation.8PSK + else: + parm.modulation = 1 # eDVBFrontendParametersSatellite.Modulation.QPSK + parm.system = system parm.frequency = frequency * 1000 parm.symbol_rate = symbol_rate * 1000 - parm.polarisation = polarisation # eDVBFrontendParametersSatellite.Polarisation.Verti - parm.fec = fec # eDVBFrontendParametersSatellite.FEC.f3_4; + parm.polarisation = polarisation # eDVBFrontendParametersSatellite.Polarisation.Verti + parm.fec = self.fecmap[fec] # eDVBFrontendParametersSatellite.FEC.f3_4; #parm.fec = 6 # AUTO parm.inversion = inversion #eDVBFrontendParametersSatellite.Inversion.Off; #parm.inversion = 2 #AUTO @@ -375,7 +410,7 @@ class ScanSetup(Screen): parm = eDVBFrontendParametersCable() parm.frequency = frequency * 1000 parm.symbol_rate = symbol_rate * 1000 - parm.modulation = modulation # modulation # eDVBFrontendParametersSatellite.Polarisation.Verti + parm.modulation = modulation # modulation # eDVBFrontendParametersSatellite.Polarisation.Verti parm.fec = fec # eDVBFrontendParametersSatellite.FEC.f3_4; #parm.fec = 6 # AUTO parm.inversion = inversion #eDVBFrontendParametersSatellite.Inversion.Off; @@ -390,25 +425,50 @@ class ScanSetup(Screen): 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] + if currentConfigSelectionElement(config.scan.sat.system) == "dvb-s": + fec = currentConfigSelectionElement(config.scan.sat.fec) + else: + fec = currentConfigSelectionElement(config.scan.sat.fec_s2) + self.addSatTransponder(tlist, config.scan.sat.frequency.value[0], + config.scan.sat.symbolrate.value[0], + config.scan.sat.polarization.value, + fec, + config.scan.sat.inversion.value, + orbpos, + config.scan.sat.system.value, + config.scan.sat.modulation) 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])) + sat = self.satList[config.scan.nims.value][config.scan.satselection[config.scan.nims.value].value] + getInitialTransponderList(tlist, int(sat[1])) flags |= eComponentScan.scanNetworkSearch - + tmp = currentConfigSelectionElement(config.scan.clearallservices) + if tmp == "yes": + flags |= eComponentScan.scanRemoveServices + elif tmp == "yes_hold_feeds": + flags |= eComponentScan.scanRemoveServices + flags |= eComponentScan.scanDontRemoveFeeds 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) getInitialTransponderList(tlist, x[1].parent.configPath) flags |= eComponentScan.scanNetworkSearch + tmp = currentConfigSelectionElement(config.scan.clearallservices) + if tmp == "yes": + flags |= eComponentScan.scanRemoveServices + elif tmp == "yes_hold_feeds": + flags |= eComponentScan.scanRemoveServices + flags |= eComponentScan.scanDontRemoveFeeds elif (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"]): if currentConfigSelectionElement(config.scan.typecable) == "single_transponder": @@ -417,15 +477,21 @@ class ScanSetup(Screen): 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)) flags |= eComponentScan.scanNetworkSearch + tmp = currentConfigSelectionElement(config.scan.clearallservices) + if tmp == "yes": + flags |= eComponentScan.scanRemoveServices + elif tmp == "yes_hold_feeds": + flags |= eComponentScan.scanRemoveServices + flags |= eComponentScan.scanDontRemoveFeeds elif (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]): if currentConfigSelectionElement(config.scan.typeterrestrial) == "single_transponder": - self.addTerTransponder(tlist, + self.addTerTransponder(tlist, config.scan.ter.frequency.value[0] * 1000000, inversion = config.scan.ter.inversion.value, bandwidth = config.scan.ter.bandwidth.value, @@ -440,15 +506,23 @@ class ScanSetup(Screen): elif currentConfigSelectionElement(config.scan.typeterrestrial) == "complete": getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(config.scan.nims.value)) flags |= eComponentScan.scanNetworkSearch + tmp = currentConfigSelectionElement(config.scan.clearallservices) + if tmp == "yes": + flags |= eComponentScan.scanRemoveServices + elif tmp == "yes_hold_feeds": + flags |= eComponentScan.scanRemoveServices + flags |= eComponentScan.scanDontRemoveFeeds 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 @@ -495,13 +569,20 @@ class ScanSimple(Screen): print sat getInitialTransponderList(tlist, sat[1]) elif nimmanager.getNimType(x[1].parent.configPath) == nimmanager.nimType["DVB-C"]: - ScanPossible = True + scanPossible = True getInitialCableTransponderList(tlist, nimmanager.getCableDescription(slotid)) elif nimmanager.getNimType(x[1].parent.configPath) == nimmanager.nimType["DVB-T"]: - ScanPossible = True + scanPossible = True getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(slotid)) if scanPossible: - scanList.append({"transponders": tlist, "feid": slotid, "flags": eComponentScan.scanNetworkSearch}) + flags=eComponentScan.scanNetworkSearch + tmp = currentConfigSelectionElement(config.scan.clearallservices) + if tmp == "yes": + flags |= eComponentScan.scanRemoveServices + elif tmp == "yes_hold_feeds": + flags |= eComponentScan.scanRemoveServices + flags |= eComponentScan.scanDontRemoveFeeds + scanList.append({"transponders": tlist, "feid": slotid, "flags": flags}) if len(scanList): self.session.openWithCallback(self.doNothing, ServiceScan, scanList = scanList) else: @@ -509,7 +590,7 @@ class ScanSimple(Screen): def doNothing(self): pass - + def keyCancel(self): self.close() @@ -534,9 +615,13 @@ class ScanSimple(Screen): sec = eDVBSatelliteEquipmentControl.getInstance() if sec is not None: exclusive_satellites = sec.get_exclusive_satellites(0,1) - if len(exclusive_satellites) == 0: + if len(exclusive_satellites) == 2: return False - return True + idx = exclusive_satellites[0]+1 + exclusive_nim_sats = exclusive_satellites[idx+1:idx+1+exclusive_satellites[idx]] + if len(exclusive_nim_sats): + return True + return False # two -C or two -T tuners def __init__(self, session): Screen.__init__(self, session) @@ -554,8 +639,15 @@ class ScanSimple(Screen): nimcount = nimmanager.getNimSocketCount() if nimcount > 0: - nim = configElement_nonSave(0, configSelection, 0,(("yes", _("yes")),("no", _("no")))) - self.list.append(getConfigListEntry(_("Scan NIM") + " 0 (" + nimmanager.getNimTypeName(0) + ")", nim)) + scan_possible=True + config.scan = ConfigSubsection() + config.scan.clearallservices = configElement_nonSave("config.scan.clearallservices", configSelection, 0, (("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (keep feeds)")))) + self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices)) + nim = configElement_nonSave(0, configSelection, 0, (("yes", _("yes")), ("no", _("no")))) + if nimmanager.getNimType(0) == nimmanager.nimType["DVB-S"] and not len(nimmanager.getSatListForNim(0)): + scan_possible=False + if scan_possible: + self.list.append(getConfigListEntry(_("Scan NIM") + " 0 (" + nimmanager.getNimTypeName(0) + ")", nim)) if nimcount > 1 and self.ScanNimTwoNeeded(): nim = configElement_nonSave(1, configSelection, 0, (("yes", _("yes")), ("no", _("no")))) self.list.append(getConfigListEntry(_("Scan NIM") + " 1 (" + nimmanager.getNimTypeName(1) + ")", nim))