1 from Screen import Screen
2 from ServiceScan import *
3 from Components.config import *
4 from Components.ActionMap import NumberActionMap
5 from Components.ConfigList import ConfigList
6 from Components.NimManager import nimmanager
7 from Components.Label import Label
8 from Screens.MessageBox import MessageBox
9 from enigma import eDVBFrontendParametersSatellite, eComponentScan, eDVBSatelliteEquipmentControl, eDVBFrontendParametersTerrestrial
11 def buildTerTransponder(frequency,
12 inversion=2, bandwidth = 3, fechigh = 6, feclow = 6,
13 modulation = 2, transmission = 2, guard = 4,
15 # WARNING: normally, enums are working directly.
16 # Don't copy this (very bad)!! Instead either fix swig (good) or
17 # move this into a central place.
57 parm = eDVBFrontendParametersTerrestrial()
59 parm.frequency = frequency
61 parm.inversion = [Off, On, Unknown][inversion]
62 parm.bandwidth = [Bw8MHz, Bw7MHz, Bw6MHz, BwAuto][bandwidth] # Bw5MHz unsupported
63 parm.code_rate_HP = [fAuto, f1_2, f2_3, f3_4, f5_6, f7_8, fAuto][fechigh]
64 parm.code_rate_LP = [fAuto, f1_2, f2_3, f3_4, f5_6, f7_8, fAuto][feclow]
65 parm.modulation = [QPSK, QAM16, Auto][modulation] # QAM64 unsupported
66 parm.transmission_mode = [TM2k, TM8k, TMAuto][transmission] # TM4k unsupported
67 parm.guard_interval = [GI_1_32, GI_1_16, GI_1_8, GI_1_4, GI_Auto][guard]
68 parm.hierarchy = [HNone, H1, H2, H4, HAuto][hierarchy]
72 def getInitialTransponderList(tlist, pos):
73 list = nimmanager.getTransponders(pos)
77 parm = eDVBFrontendParametersSatellite()
79 parm.symbol_rate = x[2]
80 parm.polarisation = x[3]#lookup_sat_polarisation[x[3]] # eDVBFrontendParametersSatellite.Polarisation.Vertical
81 parm.fec = x[4] # eDVBFrontendParametersSatellite.FEC.f3_4;
83 #parm.inversion = 1 #eDVBFrontendParametersSatellite.Inversion.Off;
84 parm.inversion = 2 #AUTO
85 parm.orbital_position = pos
86 parm.system = x[5] #DVB-S or DVB-S2
87 parm.modulation = x[6]
90 def getInitialCableTransponderList(tlist, cable):
91 list = nimmanager.getTranspondersCable(cable)
95 parm = eDVBFrontendParametersCable()
97 parm.symbol_rate = x[2]
98 parm.modulation = x[3] # AUTO
99 parm.fec_inner = x[4] # AUTO
100 parm.inversion = 2 # AUTO
103 def getInitialTerrestrialTransponderList(tlist, region):
104 list = nimmanager.getTranspondersTerrestrial(region)
107 # inversion=2, bandwidth = 3, fechigh = 6, feclow = 6,
108 # modulation = 2, transmission = 2, guard = 4,
112 #self.transponders[self.parsedTer].append((2, freq, bw, const, crh, crl, guard, transm, hierarchy, inv))
113 if x[0] == 2: #TERRESTRIAL
114 # FIXME: we need to convert the other parameters...
116 # convert terrestrial.xml bandwidth to our enum
118 # bandwidth = [1, 0][x[2]]
120 # bandwidth = 3 # auto
122 #parm = buildTerTransponder(x[1], bandwidth = [1, 0][x[2]])
123 parm = buildTerTransponder(x[1], inversion = x[9], bandwidth = x[2])
127 class ScanSetup(Screen):
128 def __init__(self, session):
129 Screen.__init__(self, session)
135 self["actions"] = NumberActionMap(["SetupActions"],
138 "cancel": self.keyCancel,
139 "left": self.keyLeft,
140 "right": self.keyRight,
141 "1": self.keyNumberGlobal,
142 "2": self.keyNumberGlobal,
143 "3": self.keyNumberGlobal,
144 "4": self.keyNumberGlobal,
145 "5": self.keyNumberGlobal,
146 "6": self.keyNumberGlobal,
147 "7": self.keyNumberGlobal,
148 "8": self.keyNumberGlobal,
149 "9": self.keyNumberGlobal,
150 "0": self.keyNumberGlobal
153 self.statusTimer = eTimer()
154 self.statusTimer.timeout.get().append(self.updateStatus)
155 #self.statusTimer.start(5000, True)
158 self["config"] = ConfigList(self.list)
161 self["introduction"] = Label(_("Press OK to start the scan"))
166 def updateSatList(self):
168 for slot in nimmanager.nimslots:
169 if (nimmanager.getNimType(slot.slotid) == nimmanager.nimType["DVB-S"]):
170 self.satList.append(nimmanager.getSatListForNim(slot.slotid))
172 self.satList.append(None)
174 def createSetup(self):
176 self.multiscanlist = []
177 print "ID: " + str(config.scan.nims.value)
179 self.tunerEntry = getConfigListEntry(_("Tuner"), config.scan.nims)
180 self.list.append(self.tunerEntry)
182 self.typeOfScanEntry = None
183 self.systemEntry = None
184 if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"]):
185 self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), config.scan.type)
186 self.list.append(self.typeOfScanEntry)
187 elif (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"]):
188 self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), config.scan.typecable)
189 self.list.append(self.typeOfScanEntry)
190 elif (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]):
191 self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), config.scan.typeterrestrial)
192 self.list.append(self.typeOfScanEntry)
195 if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"]):
197 if currentConfigSelectionElement(config.scan.type) == "single_transponder":
198 self.systemEntry = getConfigListEntry(_('Transpondertype'), config.scan.sat.system)
199 self.list.append(self.systemEntry)
200 self.list.append(getConfigListEntry(_('Satellite'), config.scan.satselection[config.scan.nims.value]))
201 self.list.append(getConfigListEntry(_('Frequency'), config.scan.sat.frequency))
202 self.list.append(getConfigListEntry(_('Inversion'), config.scan.sat.inversion))
203 self.list.append(getConfigListEntry(_('Symbol Rate'), config.scan.sat.symbolrate))
204 self.list.append(getConfigListEntry(_("Polarity"), config.scan.sat.polarization))
205 if currentConfigSelectionElement(config.scan.sat.system) == "dvb-s":
206 self.list.append(getConfigListEntry(_("FEC"), config.scan.sat.fec))
207 elif currentConfigSelectionElement(config.scan.sat.system) == "dvb-s2":
208 self.list.append(getConfigListEntry(_("FEC"), config.scan.sat.fec_s2))
209 self.list.append(getConfigListEntry(_('Modulation'), config.scan.sat.modulation))
210 elif currentConfigSelectionElement(config.scan.type) == "single_satellite":
212 print config.scan.satselection[config.scan.nims.value]
213 self.list.append(getConfigListEntry(_("Satellite"), config.scan.satselection[config.scan.nims.value]))
214 self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices))
215 elif currentConfigSelectionElement(config.scan.type) == "multisat":
218 SatList = nimmanager.getSatListForNim(config.scan.nims.value)
219 self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices))
221 if self.Satexists(tlist, x[1]) == 0:
223 sat = configElement_nonSave(x[1], configSelection, 0, (("enable", _("Enable")), ("disable", _("Disable"))))
224 configEntry = getConfigListEntry(nimmanager.getSatDescription(x[1]), sat)
225 self.list.append(configEntry)
226 self.multiscanlist.append(configEntry)
228 # for sat in nimmanager.satList:
229 # self.list.append(getConfigListEntry(sat[0], config.scan.scansat[sat[1]]))
232 if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"]):
233 if currentConfigSelectionElement(config.scan.typecable) == "single_transponder":
234 self.list.append(getConfigListEntry(_("Frequency"), config.scan.cab.frequency))
235 self.list.append(getConfigListEntry(_("Inversion"), config.scan.cab.inversion))
236 self.list.append(getConfigListEntry(_("Symbol Rate"), config.scan.cab.symbolrate))
237 self.list.append(getConfigListEntry(_("Modulation"), config.scan.cab.modulation))
238 self.list.append(getConfigListEntry(_("FEC"), config.scan.cab.fec))
239 self.list.append(getConfigListEntry(_("Network scan"), config.scan.cab.networkScan))
240 elif currentConfigSelectionElement(config.scan.typecable) == "complete":
241 self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices))
243 if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]):
244 if currentConfigSelectionElement(config.scan.typeterrestrial) == "single_transponder":
245 self.list.append(getConfigListEntry(_("Frequency"), config.scan.ter.frequency))
246 self.list.append(getConfigListEntry(_("Network scan"), config.scan.ter.networkScan))
247 self.list.append(getConfigListEntry(_("Inversion"), config.scan.ter.inversion))
248 self.list.append(getConfigListEntry(_("Bandwidth"), config.scan.ter.bandwidth))
249 self.list.append(getConfigListEntry(_("Code rate high"), config.scan.ter.fechigh))
250 self.list.append(getConfigListEntry(_("Code rate low"), config.scan.ter.feclow))
251 self.list.append(getConfigListEntry(_("Modulation"), config.scan.ter.modulation))
252 self.list.append(getConfigListEntry(_("Transmission mode"), config.scan.ter.transmission))
253 self.list.append(getConfigListEntry(_("Guard interval mode"), config.scan.ter.guard))
254 self.list.append(getConfigListEntry(_("Hierarchy mode"), config.scan.ter.hierarchy))
255 elif currentConfigSelectionElement(config.scan.typeterrestrial) == "complete":
256 self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices))
258 # if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"] and currentConfigSelectionElement(config.scan.type) == "single_transponder") or \
259 # (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"] and currentConfigSelectionElement(config.scan.typecable) == "single_transponder") or \
260 # (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"] and currentConfigSelectionElement(config.scan.typeterrestrial) == "single_transponder"):
261 # self.configElementSNR = getConfigListEntry(_("SNR"), config.scan.snr)
262 # self.list.append(self.configElementSNR)
263 # self.configElementACG = getConfigListEntry(_("AGC"), config.scan.agc)
264 # self.list.append(self.configElementACG)
265 # self.configElementBER = getConfigListEntry(_("BER"), config.scan.ber)
266 # self.list.append(self.configElementBER)
267 # self.statusTimer.start(500, False)
269 # self.statusTimer.stop()
271 self["config"].list = self.list
272 self["config"].l.setList(self.list)
274 def Satexists(self, tlist, pos):
281 print self["config"].getCurrent()
282 if self["config"].getCurrent() == self.typeOfScanEntry:
284 elif self["config"].getCurrent() == self.tunerEntry:
286 elif self["config"].getCurrent() == self.systemEntry:
289 def createConfig(self):
290 config.scan = ConfigSubsection()
291 config.scan.sat = ConfigSubsection()
292 config.scan.cab = ConfigSubsection()
293 config.scan.ter = ConfigSubsection()
295 config.scan.type = configElement_nonSave("config.scan.type", configSelection, 0, (("single_transponder", _("Single transponder")), ("single_satellite", _("Single satellite")), ("multisat", _("Multisat"))))
296 config.scan.typecable = configElement_nonSave("config.scan.typecable", configSelection, 0, (("single_transponder", _("Single transponder")), ("complete", _("Complete"))))
297 config.scan.typeterrestrial = configElement_nonSave("config.scan.typeterrestrial", configSelection, 0, (("single_transponder", _("Single transponder")), ("complete", _("Complete"))))
298 config.scan.clearallservices = configElement_nonSave("config.scan.clearallservices", configSelection, 0, (("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (hold feeds)"))))
301 for nim in nimmanager.nimList():
302 nimList.append(nim[0])
303 #nimList.append("all")
304 config.scan.nims = configElement_nonSave("config.scan.nims", configSelection, 0, nimList)
307 config.scan.snr = configElement_nonSave("config.scan.snr", configSlider, 0, (1, 100))
308 config.scan.snr.enabled = False
309 config.scan.agc = configElement_nonSave("config.scan.agc", configSlider, 0, (1, 100))
310 config.scan.agc.enabled = False
311 config.scan.ber = configElement_nonSave("config.scan.ber", configSlider, 0, (1, 100))
312 config.scan.ber.enabled = False
315 config.scan.sat.system = configElement_nonSave("config.scan.sat.system", configSelection, 0, (("dvb-s", _("DVB-S")), ("dvb-s2", _("DVB-S2"))))
316 config.scan.sat.frequency = configElement_nonSave("config.scan.sat.frequency", configSequence, [11836], configsequencearg.get("INTEGER", (1, 99999)))
317 config.scan.sat.inversion = configElement_nonSave("config.scan.sat.inversion", configSelection, 2, (("off", _("off")), ("on", _("on")), _("Auto")))
318 config.scan.sat.symbolrate = configElement_nonSave("config.scan.sat.symbolrate", configSequence, [27500], configsequencearg.get("INTEGER", (1, 99999)))
319 config.scan.sat.polarization = configElement_nonSave("config.scan.sat.polarization", configSelection, 0, (("horizontal", _("horizontal")), ("vertical", _("vertical")), ("circular_left", _("circular left")), ("circular_right", _("circular right"))))
320 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"))))
321 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")))
322 config.scan.sat.modulation = configElement_nonSave("config.scan.sat.modulation", configSelection, 0, (("qpsk", "QPSK"), ("8psk", "8PSK")))
325 config.scan.cab.frequency = configElement_nonSave("config.scan.cab.frequency", configSequence, [466], configsequencearg.get("INTEGER", (50, 999)))
326 config.scan.cab.inversion = configElement_nonSave("config.scan.cab.inversion", configSelection, 2, (("off", _("off")), ("on", _("on")), ("auto", _("Auto"))))
327 config.scan.cab.modulation = configElement_nonSave("config.scan.cab.modulation", configSelection, 0, (("auto", _("Auto")), ("16qam", "16-QAM"), ("32qam", "32-QAM"), ("64qam", "64-QAM"), ("128qam", "128-QAM"), ("256qam", "256-QAM")))
328 config.scan.cab.fec = configElement_nonSave("config.scan.cab.fec", configSelection, 0, (("auto", _("Auto")), ("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("8_9", "8/9"), ("none", _("None"))))
329 config.scan.cab.symbolrate = configElement_nonSave("config.scan.cab.symbolrate", configSequence, [6900], configsequencearg.get("INTEGER", (1, 9999)))
330 config.scan.cab.networkScan = configElement_nonSave("config.scan.cab.networkScan", configSelection, 0, (("no", _("no")), ("yes", _("yes"))))
333 config.scan.ter.frequency = configElement_nonSave("config.scan.ter.frequency", configSequence, [466], configsequencearg.get("INTEGER", (100, 900)))
334 config.scan.ter.inversion = configElement_nonSave("config.scan.ter.inversion", configSelection, 2, (("off", _("off")), ("on", _("on")), ("auto", _("Auto"))))
335 # WORKAROUND: we can't use BW-auto
336 config.scan.ter.bandwidth = configElement_nonSave("config.scan.ter.bandwidth", configSelection, 0, (("8MHz", "8MHz"), ("7MHz", "7MHz"), ("6MHz", "6MHz")))
337 #, ("auto", _("Auto"))))
338 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")))
339 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"))))
340 config.scan.ter.modulation = configElement_nonSave("config.scan.ter.modulation", configSelection, 2, (("qpsk", "QPSK"), ("qam16", "QAM16"), ("auto", _("Auto"))))
341 config.scan.ter.transmission = configElement_nonSave("config.scan.ter.transmission", configSelection, 2, (("2k", "2K"), ("8k", "8K"), ("auto", _("Auto"))))
342 config.scan.ter.guard = configElement_nonSave("config.scan.ter.guard", configSelection, 4, (("1_32", "1/32"), ("1_16", "1/16"), ("1_8", "1/8"), ("1_4", "1/4"), ("auto", _("Auto"))))
343 config.scan.ter.hierarchy = configElement_nonSave("config.scan.ter.hierarchy", configSelection, 4, (("none", _("None")), ("1", "1"), ("2", "2"), ("4", "4"), ("auto", _("Auto"))))
344 config.scan.ter.networkScan = configElement_nonSave("config.scan.cab.networkScan", configSelection, 0, (("no", _("no")), ("yes", _("yes"))))
346 config.scan.scansat = {}
347 for sat in nimmanager.satList:
349 config.scan.scansat[sat[1]] = configElement_nonSave("config.scan.scansat[" + str(sat[1]) + "]", configSelection, 0, (("yes", _("yes")), ("no", _("no"))))
351 config.scan.satselection = []
353 for slot in nimmanager.nimslots:
354 if (nimmanager.getNimType(slot.slotid) == nimmanager.nimType["DVB-S"]):
355 print str(slot.slotid) + " : " + str(self.satList)
356 config.scan.satselection.append(configElement_nonSave("config.scan.satselection[" + str(slot.slotid) + "]", configSatlist, 0, self.satList[slot.slotid]))
358 config.scan.satselection.append(None)
360 self["config"].handleKey(config.key["prevElement"])
364 self["config"].handleKey(config.key["nextElement"])
367 def updateStatus(self):
370 def keyNumberGlobal(self, number):
371 print "You pressed number " + str(number)
372 if (self["config"].getCurrent()[1].parent.enabled == True):
373 self["config"].handleKey(config.key[str(number)])
375 fecmap = { "auto": 0,
388 def addSatTransponder(self, tlist, frequency, symbol_rate, polarisation, fec, inversion, orbital_position, system, modulation):
389 print "Add Sat: frequ: " + str(frequency) + " symbol: " + str(symbol_rate) + " pol: " + str(polarisation) + " fec: " + str(fec) + " inversion: " + str(inversion)
390 print "orbpos: " + str(orbital_position)
391 parm = eDVBFrontendParametersSatellite()
393 parm.modulation = 2 # eDVBFrontendParametersSatellite.Modulation.8PSK
395 parm.modulation = 1 # eDVBFrontendParametersSatellite.Modulation.QPSK
397 parm.frequency = frequency * 1000
398 parm.symbol_rate = symbol_rate * 1000
399 parm.polarisation = polarisation # eDVBFrontendParametersSatellite.Polarisation.Verti
400 parm.fec = self.fecmap[fec] # eDVBFrontendParametersSatellite.FEC.f3_4;
402 parm.inversion = inversion #eDVBFrontendParametersSatellite.Inversion.Off;
403 #parm.inversion = 2 #AUTO
404 parm.orbital_position = int(orbital_position)
407 # FIXME use correct parameters
408 def addCabTransponder(self, tlist, frequency, symbol_rate, modulation, fec, inversion):
409 print "Add Cab: frequ: " + str(frequency) + " symbol: " + str(symbol_rate) + " pol: " + str(modulation) + " fec: " + str(fec) + " inversion: " + str(inversion)
410 parm = eDVBFrontendParametersCable()
411 parm.frequency = frequency * 1000
412 parm.symbol_rate = symbol_rate * 1000
413 parm.modulation = modulation # modulation # eDVBFrontendParametersSatellite.Polarisation.Verti
414 parm.fec = fec # eDVBFrontendParametersSatellite.FEC.f3_4;
416 parm.inversion = inversion #eDVBFrontendParametersSatellite.Inversion.Off;
417 #parm.inversion = 2 #AUTO
420 def addTerTransponder(self, tlist, *args, **kwargs):
421 tlist.append(buildTerTransponder(*args, **kwargs))
426 if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"]):
427 if currentConfigSelectionElement(config.scan.type) == "single_transponder":
428 l = len(self.satList)
429 if l and l > config.scan.nims.value:
430 nimsats=self.satList[config.scan.nims.value]
431 l = len(config.scan.satselection)
432 if l and l > config.scan.nims.value:
433 selsatidx=config.scan.satselection[config.scan.nims.value].value
435 if l and l > selsatidx:
436 orbpos=nimsats[selsatidx][1]
437 if currentConfigSelectionElement(config.scan.sat.system) == "dvb-s":
438 fec = currentConfigSelectionElement(config.scan.sat.fec)
440 fec = currentConfigSelectionElement(config.scan.sat.fec_s2)
441 self.addSatTransponder(tlist, config.scan.sat.frequency.value[0],
442 config.scan.sat.symbolrate.value[0],
443 config.scan.sat.polarization.value,
445 config.scan.sat.inversion.value,
447 config.scan.sat.system.value,
448 config.scan.sat.modulation)
449 elif currentConfigSelectionElement(config.scan.type) == "single_satellite":
450 sat = self.satList[config.scan.nims.value][config.scan.satselection[config.scan.nims.value].value]
451 getInitialTransponderList(tlist, int(sat[1]))
452 flags |= eComponentScan.scanNetworkSearch
453 tmp = currentConfigSelectionElement(config.scan.clearallservices)
455 flags |= eComponentScan.scanRemoveServices
456 elif tmp == "yes_hold_feeds":
457 flags |= eComponentScan.scanRemoveServices
458 flags |= eComponentScan.scanDontRemoveFeeds
459 elif currentConfigSelectionElement(config.scan.type) == "multisat":
460 SatList = nimmanager.getSatListForNim(config.scan.nims.value)
461 for x in self.multiscanlist:
462 if x[1].parent.value == 0:
463 print " " + str(x[1].parent.configPath)
464 getInitialTransponderList(tlist, x[1].parent.configPath)
465 flags |= eComponentScan.scanNetworkSearch
466 tmp = currentConfigSelectionElement(config.scan.clearallservices)
468 flags |= eComponentScan.scanRemoveServices
469 elif tmp == "yes_hold_feeds":
470 flags |= eComponentScan.scanRemoveServices
471 flags |= eComponentScan.scanDontRemoveFeeds
473 elif (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"]):
474 if currentConfigSelectionElement(config.scan.typecable) == "single_transponder":
475 self.addCabTransponder(tlist, config.scan.cab.frequency.value[0],
476 config.scan.cab.symbolrate.value[0],
477 config.scan.cab.modulation.value,
478 config.scan.cab.fec.value,
479 config.scan.cab.inversion.value)
480 if currentConfigSelectionElement(config.scan.cab.networkScan) == "yes":
481 flags |= eComponentScan.scanNetworkSearch
482 elif currentConfigSelectionElement(config.scan.typecable) == "complete":
483 getInitialCableTransponderList(tlist, nimmanager.getCableDescription(config.scan.nims.value))
484 flags |= eComponentScan.scanNetworkSearch
485 tmp = currentConfigSelectionElement(config.scan.clearallservices)
487 flags |= eComponentScan.scanRemoveServices
488 elif tmp == "yes_hold_feeds":
489 flags |= eComponentScan.scanRemoveServices
490 flags |= eComponentScan.scanDontRemoveFeeds
492 elif (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]):
493 if currentConfigSelectionElement(config.scan.typeterrestrial) == "single_transponder":
494 self.addTerTransponder(tlist,
495 config.scan.ter.frequency.value[0] * 1000000,
496 inversion = config.scan.ter.inversion.value,
497 bandwidth = config.scan.ter.bandwidth.value,
498 fechigh = config.scan.ter.fechigh.value,
499 feclow = config.scan.ter.feclow.value,
500 modulation = config.scan.ter.modulation.value,
501 transmission = config.scan.ter.transmission.value,
502 guard = config.scan.ter.guard.value,
503 hierarchy = config.scan.ter.hierarchy.value)
504 if currentConfigSelectionElement(config.scan.ter.networkScan) == "yes":
505 flags |= eComponentScan.scanNetworkSearch
506 elif currentConfigSelectionElement(config.scan.typeterrestrial) == "complete":
507 getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(config.scan.nims.value))
508 flags |= eComponentScan.scanNetworkSearch
509 tmp = currentConfigSelectionElement(config.scan.clearallservices)
511 flags |= eComponentScan.scanRemoveServices
512 elif tmp == "yes_hold_feeds":
513 flags |= eComponentScan.scanRemoveServices
514 flags |= eComponentScan.scanDontRemoveFeeds
516 for x in self["config"].list:
520 feid = config.scan.nims.value
521 # flags |= eComponentScan.scanSearchBAT
522 self.session.openWithCallback(self.doNothing, ServiceScan, [{"transponders": tlist, "feid": feid, "flags": flags}])
524 self.session.open(MessageBox, _("Nothing to scan!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
530 for x in self["config"].list:
534 class ScanSimple(Screen):
540 if nimmanager.getNimType(0) == nimmanager.nimType["DVB-S"] and nimmanager.getNimType(0) == nimmanager.getNimType(1):
541 sec = eDVBSatelliteEquipmentControl.getInstance()
543 exclusive_satellites = sec.get_exclusive_satellites(0,1)
545 exclusive_satellites = [0,0]
546 print "exclusive satellites", exclusive_satellites
547 two_sat_tuners = True
549 two_sat_tuners = False
552 slotid = x[1].parent.configPath
553 print "Scan Tuner", slotid, "-", currentConfigSelectionElement(x[1].parent)
554 if currentConfigSelectionElement(x[1].parent) == "yes":
557 if nimmanager.getNimType(x[1].parent.configPath) == nimmanager.nimType["DVB-S"]:
560 idx = exclusive_satellites[0]+1
563 exclusive_nim_sats = exclusive_satellites[idx+1:idx+1+exclusive_satellites[idx]]
564 print "exclusive_nim_sats", exclusive_nim_sats
565 SatList = nimmanager.getSatListForNim(slotid)
567 if not two_sat_tuners or (sat[1] in exclusive_nim_sats or slotid == 0):
570 getInitialTransponderList(tlist, sat[1])
571 elif nimmanager.getNimType(x[1].parent.configPath) == nimmanager.nimType["DVB-C"]:
573 getInitialCableTransponderList(tlist, nimmanager.getCableDescription(slotid))
574 elif nimmanager.getNimType(x[1].parent.configPath) == nimmanager.nimType["DVB-T"]:
576 getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(slotid))
578 flags=eComponentScan.scanNetworkSearch
579 tmp = currentConfigSelectionElement(config.scan.clearallservices)
581 flags |= eComponentScan.scanRemoveServices
582 elif tmp == "yes_hold_feeds":
583 flags |= eComponentScan.scanRemoveServices
584 flags |= eComponentScan.scanDontRemoveFeeds
585 scanList.append({"transponders": tlist, "feid": slotid, "flags": flags})
587 self.session.openWithCallback(self.doNothing, ServiceScan, scanList = scanList)
589 self.session.open(MessageBox, _("Nothing to scan!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
598 self["config"].handleKey(config.key["prevElement"])
601 self["config"].handleKey(config.key["nextElement"])
603 def Satexists(self, tlist, pos):
609 def ScanNimTwoNeeded(self):
610 if nimmanager.getNimType(0) != nimmanager.getNimType(1):
612 if nimmanager.getNimType(0) == nimmanager.nimType["DVB-S"]: #two dvb-s nims
613 if nimmanager.getNimConfigMode(1) in ["loopthrough", "satposdepends", "equal", "nothing"]:
615 sec = eDVBSatelliteEquipmentControl.getInstance()
617 exclusive_satellites = sec.get_exclusive_satellites(0,1)
618 if len(exclusive_satellites) == 2:
620 idx = exclusive_satellites[0]+1
621 exclusive_nim_sats = exclusive_satellites[idx+1:idx+1+exclusive_satellites[idx]]
622 if len(exclusive_nim_sats):
624 return False # two -C or two -T tuners
626 def __init__(self, session):
627 Screen.__init__(self, session)
629 self["actions"] = ActionMap(["SetupActions"],
632 "cancel": self.keyCancel,
633 "left": self.keyLeft,
634 "right": self.keyRight,
640 nimcount = nimmanager.getNimSocketCount()
643 config.scan = ConfigSubsection()
644 config.scan.clearallservices = configElement_nonSave("config.scan.clearallservices", configSelection, 0, (("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (hold feeds)"))))
645 self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices))
646 nim = configElement_nonSave(0, configSelection, 0, (("yes", _("yes")), ("no", _("no"))))
647 if nimmanager.getNimType(0) == nimmanager.nimType["DVB-S"] and not len(nimmanager.getSatListForNim(0)):
650 self.list.append(getConfigListEntry(_("Scan NIM") + " 0 (" + nimmanager.getNimTypeName(0) + ")", nim))
651 if nimcount > 1 and self.ScanNimTwoNeeded():
652 nim = configElement_nonSave(1, configSelection, 0, (("yes", _("yes")), ("no", _("no"))))
653 self.list.append(getConfigListEntry(_("Scan NIM") + " 1 (" + nimmanager.getNimTypeName(1) + ")", nim))
655 self["config"] = ConfigList(self.list)
656 self["header"] = Label(_("Automatic Scan"))
657 self["footer"] = Label(_("Press OK to scan"))