def getTunerDescription(self, nim):
		description = ""
		try:
			description = nimmanager.getTerrestrialDescription(nim)
		except:
			print "[ChannelNumber] nimmanager.getTerrestrialDescription(nim) failed, nim:", nim
		return description
示例#2
0
	def retuneTerr(self):
		if not self.initcomplete:
			return
		if self.scan_input_as.value == "channel":
			frequency = channel2frequency(self.scan_ter.channel.value, self.ter_tnumber)
		else:
			frequency = self.scan_ter.frequency.floatint * 1000
		if self.tuning_type.value == "single_transponder":
			transponder = [
				2, #TERRESTRIAL
				frequency,
				self.scan_ter.bandwidth.value,
				self.scan_ter.modulation.value,
				self.scan_ter.fechigh.value,
				self.scan_ter.feclow.value,
				self.scan_ter.guard.value,
				self.scan_ter.transmission.value,
				self.scan_ter.hierarchy.value,
				self.scan_ter.inversion.value,
				self.scan_ter.system.value,
				self.scan_ter.plp_id.value]
			self.tuner.tuneTerr(transponder[1], transponder[9], transponder[2], transponder[4], transponder[5], transponder[3], transponder[7], transponder[6], transponder[8], transponder[10], transponder[11])
			self.transponder = transponder
		elif self.tuning_type.value == "predefined_transponder":
			region = nimmanager.getTerrestrialDescription(int(self.satfinder_scan_nims.value))
			tps = nimmanager.getTranspondersTerrestrial(region)
			if len(tps) > self.TerrestrialTransponders.index :
				transponder = tps[self.TerrestrialTransponders.index]
				# frequency 1, inversion 9, bandwidth 2, fechigh 4, feclow 5, modulation 3, transmission 7, guard 6, hierarchy 8, system 10, plp_id 11
				self.tuner.tuneTerr(transponder[1], transponder[9], transponder[2], transponder[4], transponder[5], transponder[3], transponder[7], transponder[6], transponder[8], transponder[10], transponder[11])
				self.transponder = transponder
示例#3
0
def getTunerDescription(nim):
    try:
        return nimmanager.getTerrestrialDescription(nim)
    except:
        print '[ChannelNumber] nimmanager.getTerrestrialDescription(nim) failed, nim:', nim

    return ''
示例#4
0
	def retuneTerr(self, configElement):
		if not nimmanager.nim_slots[int(self.satfinder_scan_nims.value)].isCompatible("DVB-T"):
			return self.retuneCab(configElement)
		if self.initcomplete:
			if self.scan_input_as.value == "channel":
				frequency = channel2frequency(self.scan_ter.channel.value, self.ter_tnumber)
			else:
				frequency = self.scan_ter.frequency.value * 1000
			if self.tuning_type.value == "single_transponder":
				transponder = [
					2, #TERRESTRIAL
					frequency,
					self.scan_ter.bandwidth.value,
					self.scan_ter.modulation.value,
					self.scan_ter.fechigh.value,
					self.scan_ter.feclow.value,
					self.scan_ter.guard.value,
					self.scan_ter.transmission.value,
					self.scan_ter.hierarchy.value,
					self.scan_ter.inversion.value,
					self.scan_ter.system.value,
					self.scan_ter.plp_id.value]
				if self.initcomplete:
					self.tuner.tuneTerr(transponder[1], transponder[9], transponder[2], transponder[4], transponder[5], transponder[3], transponder[7], transponder[6], transponder[8], transponder[10], transponder[11])
				self.transponder = transponder
			elif self.tuning_type.value == "predefined_transponder":
				region = nimmanager.getTerrestrialDescription(int(self.satfinder_scan_nims.value))
				tps = nimmanager.getTranspondersTerrestrial(region)
				if len(tps) > self.TerrestrialTransponders.index :
					transponder = tps[self.TerrestrialTransponders.index]
					# frequency 1, inversion 9, bandwidth 2, fechigh 4, feclow 5, modulation 3, transmission 7, guard 6, hierarchy 8, system 10, plp_id 11
					if self.initcomplete:
						self.tuner.tuneTerr(transponder[1], transponder[9], transponder[2], transponder[4], transponder[5], transponder[3], transponder[7], transponder[6], transponder[8], transponder[10], transponder[11])
					self.transponder = transponder
 def getTunerDescription(self, nim):
     description = ""
     try:
         description = nimmanager.getTerrestrialDescription(nim)
     except:
         print "[ChannelNumber] nimmanager.getTerrestrialDescription(nim) failed, nim:", nim
     return description
示例#6
0
文件: plugin.py 项目: openhdf/enigma2
	def retuneTerr(self):
		if self.initcomplete:
			if self.scan_input_as.value == "channel":
				frequency = channel2frequency(self.scan_ter.channel.value, self.ter_tnumber)
			else:
				frequency = self.scan_ter.frequency.floatint * 1000
			if self.scan_typeterrestrial.value == "single_transponder":
				transponder = [
					2, #TERRESTRIAL
					frequency,
					self.scan_ter.bandwidth.value,
					self.scan_ter.modulation.value,
					self.scan_ter.fechigh.value,
					self.scan_ter.feclow.value,
					self.scan_ter.guard.value,
					self.scan_ter.transmission.value,
					self.scan_ter.hierarchy.value,
					self.scan_ter.inversion.value,
					self.scan_ter.system.value,
					self.scan_ter.plp_id.value]
				self.tuner.tuneTerr(transponder[1], transponder[9], transponder[2], transponder[4], transponder[5], transponder[3], transponder[7], transponder[6], transponder[8], transponder[10], transponder[11])
				self.transponder = transponder
			elif self.scan_typeterrestrial.value == "predefined_transponder":
				if self.TerrestrialTransponders is not None:
					region = nimmanager.getTerrestrialDescription(int(self.scan_nims.value))
					tps = nimmanager.getTranspondersTerrestrial(region)
					if len(tps) > self.TerrestrialTransponders.index :
						transponder = tps[self.TerrestrialTransponders.index]
						# frequency 1, inversion 9, bandwidth 2, fechigh 4, feclow 5, modulation 3, transmission 7, guard 6, hierarchy 8, system 10, plp_id 11
						self.tuner.tuneTerr(transponder[1], transponder[9], transponder[2], transponder[4], transponder[5], transponder[3], transponder[7], transponder[6], transponder[8], transponder[10], transponder[11])
						self.transponder = transponder
示例#7
0
def getTunerDescription(nim):
    try:
        return nimmanager.getTerrestrialDescription(nim)
    except:
        print '[ChannelNumber] nimmanager.getTerrestrialDescription(nim) failed, nim:', nim

    return ''
示例#8
0
	def buildTransponderList(self): # this method is called multiple times because of asynchronous stuff
		APPEND_NOW = 0
		SEARCH_CABLE_TRANSPONDERS = 1
		action = APPEND_NOW

		n = self.nim_iter < len(self.nim_enable) and self.nim_enable[self.nim_iter] or None
		self.nim_iter += 1
		if n:
			if n.value: # check if nim is enabled
				flags = 0
				nim = nimmanager.nim_slots[n.nim_index]
				networks = set(self.getNetworksForNim(nim))

				# don't scan anything twice
				networks.discard(self.known_networks)

				tlist = [ ]
				if nim.isCompatible("DVB-S"):
					# get initial transponders for each satellite to be scanned
					for sat in networks:
						getInitialTransponderList(tlist, sat[0])
				elif nim.isCompatible("DVB-C"):
					if config.Nims[nim.slot].cable.scan_type.value == "provider":
						getInitialCableTransponderList(tlist, nim.slot)
					else:
						action = SEARCH_CABLE_TRANSPONDERS
				elif nim.isCompatible("DVB-T"):
					getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(nim.slot))
				else:
					assert False
				#	ikseong - autoscan - nit option
				#flags |= eComponentScan.scanNetworkSearch #FIXMEEE.. use flags from cables / satellites / terrestrial.xml
				#tmp = self.scan_networksearch.value
				#if tmp == "yes":
				#	flags |= eComponentScan.scanNetworkSearch

				flags |= eComponentScan.scanNetworkSearch #FIXMEEE.. use flags from cables / satellites / terrestrial.xml
				tmp = self.scan_clearallservices.value
				if tmp == "yes":
					flags |= eComponentScan.scanRemoveServices
				elif tmp == "yes_hold_feeds":
					flags |= eComponentScan.scanRemoveServices
					flags |= eComponentScan.scanDontRemoveFeeds

				if action == APPEND_NOW:
					self.scanList.append({"transponders": tlist, "feid": nim.slot, "flags": flags})
				elif action == SEARCH_CABLE_TRANSPONDERS:
					self.flags = flags
					self.feid = nim.slot
					self.startCableTransponderSearch(nim.slot)
					return
				else:
					assert False

			self.buildTransponderList() # recursive call of this function !!!
			return
		# when we are here, then the recursion is finished and all enabled nims are checked
		# so we now start the real transponder scan
		self.startScan(self.scanList)
def getTunerDescription(nim):
    try:
        return nimmanager.getTerrestrialDescription(nim)
    except:
        print(
            "[Transponder] nimmanager.getTerrestrialDescription(nim) failed, nim:",
            nim)
    return ""
示例#10
0
	def buildTransponderList(self): # this method is called multiple times because of asynchronous stuff
		APPEND_NOW = 0
		SEARCH_CABLE_TRANSPONDERS = 1
		action = APPEND_NOW

		n = self.nim_iter < len(self.nim_enable) and self.nim_enable[self.nim_iter] or None
		self.nim_iter += 1
		if n:
			if n.getValue(): # check if nim is enabled
				flags = 0
				nim = nimmanager.nim_slots[n.nim_index]
				networks = set(self.getNetworksForNim(nim))
				networkid = 0

				# don't scan anything twice
				networks.discard(self.known_networks)

				tlist = [ ]
				if nim.isCompatible("DVB-S"):
					# get initial transponders for each satellite to be scanned
					for sat in networks:
						getInitialTransponderList(tlist, sat[0])
				elif nim.isCompatible("DVB-C"):
					if config.Nims[nim.slot].cable.scan_type.getValue() == "provider":
						getInitialCableTransponderList(tlist, nim.slot)
					else:
						action = SEARCH_CABLE_TRANSPONDERS
						networkid = config.Nims[nim.slot].cable.scan_networkid.getValue()
				elif nim.isCompatible("DVB-T"):
					getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(nim.slot))
				else:
					assert False

				flags |= eComponentScan.scanNetworkSearch #FIXMEEE.. use flags from cables / satellites / terrestrial.xml
				tmp = self.scan_clearallservices.getValue()
				if tmp == "yes":
					flags |= eComponentScan.scanRemoveServices
				elif tmp == "yes_hold_feeds":
					flags |= eComponentScan.scanRemoveServices
					flags |= eComponentScan.scanDontRemoveFeeds

				if action == APPEND_NOW:
					self.scanList.append({"transponders": tlist, "feid": nim.slot, "flags": flags})
				elif action == SEARCH_CABLE_TRANSPONDERS:
					self.flags = flags
					self.feid = nim.slot
					self.networkid = networkid
					self.startCableTransponderSearch(nim.slot)
					return
				else:
					assert False

			self.buildTransponderList() # recursive call of this function !!!
			return
		# when we are here, then the recursion is finished and all enabled nims are checked
		# so we now start the real transponder scan
		self.startScan(self.scanList)
示例#11
0
def getTunerDescription(nim):
    try:
        return nimmanager.getTerrestrialDescription(nim)
    except:
        print "[Transponder] nimmanager.getTerrestrialDescription(nim) failed, nim:", nim
        try:
            print "[Transponder] trying use fallback", config.usage.remote_fallback_dvbt_region.value
            return config.usage.remote_fallback_dvbt_region.value
        except:
            print "[Transponder] no description"
    return ""
示例#12
0
 def getSatelliteName(self, ref):
     if isinstance(ref, eServiceReference):
         orbpos = ref.getUnsignedData(4) >> 16
         if orbpos == 0xFFFF:  #Cable
             return _("Cable")
         elif orbpos == 0xEEEE:  #Terrestrial
             #				return _("Terrestrial")
             try:
                 nimfile = open('/proc/bus/nim_sockets')
             except IOError:
                 return
             current_slot = None
             for line in nimfile:
                 if not line:
                     break
                 line = line.strip()
                 if line.startswith('NIM Socket'):
                     parts = line.split(' ')
                     current_slot = int(parts[2][:-1])
             try:
                 from Components.NimManager import nimmanager
                 return str(
                     nimmanager.getTerrestrialDescription(current_slot))
             except:
                 return _("Terrestrial")
         else:  #Satellite
             orbpos = ref.getData(4) >> 16
             if orbpos < 0: orbpos += 3600
             try:
                 from Components.NimManager import nimmanager
                 return str(nimmanager.getSatDescription(orbpos))
             except:
                 dir = ref.flags & (eServiceReference.isDirectory
                                    | eServiceReference.isMarker)
                 if not dir:
                     refString = ref.toString().lower()
                     if refString.startswith('-1'):
                         return ''
                     elif refString.startswith('1:134:'):
                         return _("Alternative")
                     elif refString.startswith('4097:'):
                         return _("Internet")
                     else:
                         return orbpos > 1800 and "%d.%d°W" % (
                             (3600 - orbpos) / 10, (3600 - orbpos) %
                             10) or "%d.%d°E" % (orbpos / 10, orbpos % 10)
     return ""
	def getSatelliteName(self, ref):
		if isinstance(ref, eServiceReference):
			orbpos = ref.getUnsignedData(4) >> 16
			if orbpos == 0xFFFF: #Cable
				return _("Cable")
			elif orbpos == 0xEEEE: #Terrestrial
#				return _("Terrestrial")
				try:
					nimfile = open('/proc/bus/nim_sockets')
				except IOError:
					return
				current_slot = None
				for line in nimfile:
					if not line:
						break
					line = line.strip()
					if line.startswith('NIM Socket'):
						parts = line.split(' ')
						current_slot = int(parts[2][:-1])
				try:
					from Components.NimManager import nimmanager
					return str(nimmanager.getTerrestrialDescription(current_slot))
				except:
					return _("Terrestrial")
			else: #Satellite
				orbpos = ref.getData(4) >> 16
				if orbpos < 0: orbpos += 3600
				try:
					from Components.NimManager import nimmanager
					return str(nimmanager.getSatDescription(orbpos))
				except:
					dir = ref.flags & (eServiceReference.isDirectory|eServiceReference.isMarker)
					if not dir:
						refString = ref.toString().lower()
						if refString.startswith('-1'):
							return ''
						elif refString.startswith('1:134:'):
							return _("Alternative")
						elif refString.startswith('4097:'):
							return _("Internet")
						else:
							return orbpos > 1800 and "%d.%d°W"%((3600-orbpos)/10, (3600-orbpos)%10) or "%d.%d°E"%(orbpos/10, orbpos%10)
		return ""
示例#14
0
 def retuneTerr(self):
     if self.initcomplete:
         if self.scan_input_as.value == 'channel':
             frequency = channel2frequency(self.scan_ter.channel.value,
                                           self.ter_tnumber)
         else:
             frequency = self.scan_ter.frequency.value * 1000
         if self.scan_typeterrestrial.value == 'single_transponder':
             transponder = [
                 2, frequency, self.scan_ter.bandwidth.value,
                 self.scan_ter.modulation.value,
                 self.scan_ter.fechigh.value, self.scan_ter.feclow.value,
                 self.scan_ter.guard.value,
                 self.scan_ter.transmission.value,
                 self.scan_ter.hierarchy.value,
                 self.scan_ter.inversion.value, self.scan_ter.system.value,
                 self.scan_ter.plp_id.value
             ]
             self.tuner.tuneTerr(transponder[1], transponder[9],
                                 transponder[2], transponder[4],
                                 transponder[5], transponder[3],
                                 transponder[7], transponder[6],
                                 transponder[8], transponder[10],
                                 transponder[11])
             self.transponder = transponder
         elif self.scan_typeterrestrial.value == 'predefined_transponder':
             if self.TerrestrialTransponders is not None:
                 region = nimmanager.getTerrestrialDescription(
                     int(self.scan_nims.value))
                 tps = nimmanager.getTranspondersTerrestrial(region)
                 if len(tps) > self.TerrestrialTransponders.index:
                     transponder = tps[self.TerrestrialTransponders.index]
                     self.tuner.tuneTerr(transponder[1], transponder[9],
                                         transponder[2], transponder[4],
                                         transponder[5], transponder[3],
                                         transponder[7], transponder[6],
                                         transponder[8], transponder[10],
                                         transponder[11])
                     self.transponder = transponder
     return
示例#15
0
	def go(self):
		self.saveTunerSetting()

		APPEND_NOW = 0
		SEARCH_CABLE_TRANSPONDERS = 1
		action = APPEND_NOW

		self.scanList = []
		self.known_networks = set()
		self.nim_iter = 0

		flags = 0
		for nim in nimmanager.nim_slots:
			if nim.isCompatible("DVB-T"):
				break
		networks = set(self.getNetworksForNim(nim))
		networkid = 0

		# don't scan anything twice
		networks.discard(self.known_networks)

		tlist = []
		getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(nim.slot))

		flags |= eComponentScan.scanNetworkSearch  # FIXMEEE.. use flags from cables / satellites / terrestrial.xml
		# tmp = self.scan_clearallservices.getValue()
		tmp = "no"
		if tmp == "yes":
			flags |= eComponentScan.scanRemoveServices
		elif tmp == "yes_hold_feeds":
			flags |= eComponentScan.scanRemoveServices
			flags |= eComponentScan.scanDontRemoveFeeds

		if action == APPEND_NOW:
			self.scanList.append({"transponders": tlist, "feid": nim.slot, "flags": flags})

		self.startScan(self.scanList)
示例#16
0
	def keyGo(self):
		if self.scan_nims.value == "":
			return
		tlist = []
		flags = None
		startScan = True
		removeAll = True
		index_to_scan = int(self.scan_nims.value)
		
		if self.scan_nims == [ ]:
			self.session.open(MessageBox, _("No tuner is enabled!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
			return

		nim = nimmanager.nim_slots[index_to_scan]
		print "nim", nim.slot
		if nim.isCompatible("DVB-S"):
			print "is compatible with DVB-S"
			if self.scan_type.value == "single_transponder":
				# these lists are generated for each tuner, so this has work.
				assert len(self.satList) > index_to_scan
				assert len(self.scan_satselection) > index_to_scan
				
				nimsats = self.satList[index_to_scan]
				selsatidx = self.scan_satselection[index_to_scan].index

				# however, the satList itself could be empty. in that case, "index" is 0 (for "None").
				if len(nimsats):
					orbpos = nimsats[selsatidx][0]
					if self.scan_sat.system.value == eDVBFrontendParametersSatellite.System_DVB_S:
						fec = self.scan_sat.fec.value
					else:
						fec = self.scan_sat.fec_s2.value
					print "add sat transponder"
					self.addSatTransponder(tlist, self.scan_sat.frequency.value,
								self.scan_sat.symbolrate.value,
								self.scan_sat.polarization.value,
								fec,
								self.scan_sat.inversion.value,
								orbpos,
								self.scan_sat.system.value,
								self.scan_sat.modulation.value,
								self.scan_sat.rolloff.value,
								self.scan_sat.pilot.value)
				removeAll = False
			elif self.scan_type.value == "single_satellite":
				sat = self.satList[index_to_scan][self.scan_satselection[index_to_scan].index]
				getInitialTransponderList(tlist, sat[0])
			elif self.scan_type.value.find("multisat") != -1:
				SatList = nimmanager.getSatListForNim(index_to_scan)
				for x in self.multiscanlist:
					if x[1].value:
						print "   " + str(x[0])
						getInitialTransponderList(tlist, x[0])

		elif nim.isCompatible("DVB-C"):
			if self.scan_typecable.value == "single_transponder":
				self.addCabTransponder(tlist, self.scan_cab.frequency.value,
											  self.scan_cab.symbolrate.value,
											  self.scan_cab.modulation.value,
											  self.scan_cab.fec.value,
											  self.scan_cab.inversion.value)
				removeAll = False
			elif self.scan_typecable.value == "complete":
				if config.Nims[index_to_scan].cable.scan_type.value == "provider":
					getInitialCableTransponderList(tlist, index_to_scan)
				else:
					startScan = False

		elif nim.isCompatible("DVB-T"):
			if self.scan_typeterrestrial.value == "single_transponder":
				self.addTerTransponder(tlist,
						self.scan_ter.frequency.value * 1000,
						inversion = self.scan_ter.inversion.value,
						bandwidth = self.scan_ter.bandwidth.value,
						fechigh = self.scan_ter.fechigh.value,
						feclow = self.scan_ter.feclow.value,
						modulation = self.scan_ter.modulation.value,
						transmission = self.scan_ter.transmission.value,
						guard = self.scan_ter.guard.value,
						hierarchy = self.scan_ter.hierarchy.value)
				removeAll = False
			elif self.scan_typeterrestrial.value == "complete":
				getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(index_to_scan))

		flags = self.scan_networkScan.value and eComponentScan.scanNetworkSearch or 0

		tmp = self.scan_clearallservices.value
		if tmp == "yes":
			flags |= eComponentScan.scanRemoveServices
		elif tmp == "yes_hold_feeds":
			flags |= eComponentScan.scanRemoveServices
			flags |= eComponentScan.scanDontRemoveFeeds

		if tmp != "no" and not removeAll:
			flags |= eComponentScan.scanDontRemoveUnscanned

		if self.scan_onlyfree.value:
			flags |= eComponentScan.scanOnlyFree

		for x in self["config"].list:
			x[1].save()

		if startScan:
			self.startScan(tlist, flags, index_to_scan, self.networkid)
		else:
			self.flags = flags
			self.feid = index_to_scan
			self.tlist = []
			self.startCableTransponderSearch(self.feid)
示例#17
0
class Satfinder(ScanSetup, ServiceScan):
    def __init__(self, session):
        self.initcomplete = False
        service = session and session.nav.getCurrentService()
        feinfo = service and service.frontendInfo()
        self.frontendData = feinfo and feinfo.getAll(True)
        del feinfo
        del service

        self.preDefTransponders = None
        self.TerrestrialTransponders = None
        self.CableTransponders = None
        self.typeOfTuningEntry = None
        self.systemEntry = None
        self.systemEntryATSC = None
        self.satfinderTunerEntry = None
        self.satEntry = None
        self.typeOfInputEntry = None
        self.frequencyEntry = None
        self.polarizationEntry = None
        self.symbolrateEntry = None
        self.inversionEntry = None
        self.rolloffEntry = None
        self.pilotEntry = None
        self.modulationEntry = None
        self.fecEntry = None
        self.transponder = None
        self.DVB_TypeEntry = None
        self.systemEntryTerr = None

        ScanSetup.__init__(self, session)
        self.setTitle(_("Signal Finder"))
        self["introduction"].setText(_("Press OK to scan"))
        self["Frontend"] = FrontendStatus(
            frontend_source=lambda: self.frontend, update_interval=100)

        self["actions"] = ActionMap(
            ["SetupActions", "ColorActions"], {
                "save": self.keyGoScan,
                "ok": self.keyGoScan,
                "cancel": self.keyCancel,
            }, -3)

        self.initcomplete = True
        self.session.postScanService = self.session.nav.getCurrentlyPlayingServiceOrGroup(
        )
        self.onClose.append(self.__onClose)
        self.onShow.append(self.prepareFrontend)

    def openFrontend(self):
        res_mgr = eDVBResourceManager.getInstance()
        if res_mgr:
            self.raw_channel = res_mgr.allocateRawChannel(self.feid)
            if self.raw_channel:
                self.frontend = self.raw_channel.getFrontend()
                if self.frontend:
                    return True
        return False

    def prepareFrontend(self):
        self.frontend = None
        if not self.openFrontend():
            self.session.nav.stopService()
            if not self.openFrontend():
                if self.session.pipshown:
                    from Screens.InfoBar import InfoBar
                    InfoBar.instance and hasattr(
                        InfoBar.instance,
                        "showPiP") and InfoBar.instance.showPiP()
                    if not self.openFrontend():
                        self.frontend = None  # in normal case this should not happen
        self.tuner = Tuner(self.frontend)
        if nimmanager.nim_slots[int(
                self.satfinder_scan_nims.value)].isCompatible("DVB-S"):
            self.updatePreDefTransponders()
        self.createSetup()
        self.retune(None)

    def __onClose(self):
        self.session.nav.playService(self.session.postScanService)

    def newConfig(self):
        cur = self["config"].getCurrent()
        if cur in (self.typeOfTuningEntry, self.systemEntry,
                   self.typeOfInputEntry, self.systemEntryATSC,
                   self.DVB_TypeEntry, self.systemEntryTerr):
            self.createSetup()
        elif cur == self.satfinderTunerEntry:
            self.preDefTransponders = None
            self.TerrestrialTransponders = None
            self.CableTransponders = None
            self.feid = int(self.satfinder_scan_nims.value)
            self.createSetup()
            self.prepareFrontend()
            if self.frontend is None:
                msg = _("Tuner not available.")
                if self.session.nav.RecordTimer.isRecording():
                    msg += _("\nRecording in progress.")
                self.session.open(MessageBox, msg, MessageBox.TYPE_ERROR)
        else:
            if cur == self.satEntry:
                self.preDefTransponders = None
            self.createSetup()
        if cur not in (self.systemEntry, self.satfinderTunerEntry,
                       self.frequencyEntry, self.polarizationEntry,
                       self.symbolrateEntry, self.inversionEntry,
                       self.rolloffEntry, self.fecEntry, self.pilotEntry,
                       self.modulationEntry, self.systemEntryATSC):
            self.retune(None)

    def createSetup(self):
        self.list = []
        self.satfinderTunerEntry = getConfigListEntry(_("Tuner"),
                                                      self.satfinder_scan_nims)
        self.list.append(self.satfinderTunerEntry)
        if nimmanager.nim_slots[int(
                self.satfinder_scan_nims.value)].isCompatible("DVB-S"):
            self.tuning_sat = self.scan_satselection[self.getSelectedSatIndex(
                self.feid)]
            if self.tuning_sat.value:
                self.satEntry = getConfigListEntry(_('Satellite'),
                                                   self.tuning_sat)
                self.list.append(self.satEntry)
                self.typeOfTuningEntry = getConfigListEntry(
                    _('Tune'), self.tuning_type)
                if len(
                        nimmanager.getTransponders(int(self.tuning_sat.value))
                ) < 1:  # Only offer 'predefined transponder' if some transponders exist
                    self.tuning_type.value = "single_transponder"
                else:
                    self.list.append(self.typeOfTuningEntry)

                nim = nimmanager.nim_slots[self.feid]

                if self.tuning_type.value == "single_transponder":
                    if nim.isCompatible("DVB-S2"):
                        self.systemEntry = getConfigListEntry(
                            _('System'), self.scan_sat.system)
                        self.list.append(self.systemEntry)
                    else:
                        # downgrade to dvb-s, in case a -s2 config was active
                        self.scan_sat.system.value = eDVBFrontendParametersSatellite.System_DVB_S
                    self.frequencyEntry = getConfigListEntry(
                        _('Frequency'), self.scan_sat.frequency)
                    self.list.append(self.frequencyEntry)
                    self.polarizationEntry = getConfigListEntry(
                        _('Polarization'), self.scan_sat.polarization)
                    self.list.append(self.polarizationEntry)
                    self.symbolrateEntry = (getConfigListEntry(
                        _('Symbol rate'), self.scan_sat.symbolrate))
                    self.list.append(self.symbolrateEntry)
                    self.inversionEntry = getConfigListEntry(
                        _('Inversion'), self.scan_sat.inversion)
                    self.list.append(self.inversionEntry)

                    if self.scan_sat.system.value == eDVBFrontendParametersSatellite.System_DVB_S:
                        self.fecEntry = getConfigListEntry(
                            _("FEC"), self.scan_sat.fec)
                        self.list.append(self.fecEntry)
                    elif self.scan_sat.system.value == eDVBFrontendParametersSatellite.System_DVB_S2:
                        self.fecEntry = getConfigListEntry(
                            _("FEC"), self.scan_sat.fec_s2)
                        self.list.append(self.fecEntry)
                        self.modulationEntry = getConfigListEntry(
                            _('Modulation'), self.scan_sat.modulation)
                        self.list.append(self.modulationEntry)
                        self.rolloffEntry = getConfigListEntry(
                            _('Roll-off'), self.scan_sat.rolloff)
                        self.list.append(self.rolloffEntry)
                        self.pilotEntry = getConfigListEntry(
                            _('Pilot'), self.scan_sat.pilot)
                        self.list.append(self.pilotEntry)
                        if nim.isMultistream():
                            self.list.append(
                                getConfigListEntry(_('Input Stream ID'),
                                                   self.scan_sat.is_id))
                            self.list.append(
                                getConfigListEntry(_('PLS Mode'),
                                                   self.scan_sat.pls_mode))
                            self.list.append(
                                getConfigListEntry(_('PLS Code'),
                                                   self.scan_sat.pls_code))
                elif self.tuning_type.value == "predefined_transponder":
                    if self.preDefTransponders is None:
                        self.updatePreDefTransponders()
                    self.list.append(
                        getConfigListEntry(_("Transponder"),
                                           self.preDefTransponders))
        elif nimmanager.nim_slots[int(
                self.satfinder_scan_nims.value)].isCompatible("DVB-C"):
            self.typeOfTuningEntry = getConfigListEntry(
                _('Tune'), self.tuning_type)
            if config.Nims[self.feid].cable.scan_type.value != "provider" or len(
                    nimmanager.getTranspondersCable(
                        int(self.satfinder_scan_nims.value))
            ) < 1:  # only show 'predefined transponder' if in provider mode and transponders exist
                self.tuning_type.value = "single_transponder"
            else:
                self.list.append(self.typeOfTuningEntry)
            if self.tuning_type.value == "single_transponder":
                self.list.append(
                    getConfigListEntry(_("Frequency"),
                                       self.scan_cab.frequency))
                self.list.append(
                    getConfigListEntry(_("Inversion"),
                                       self.scan_cab.inversion))
                self.list.append(
                    getConfigListEntry(_("Symbol rate"),
                                       self.scan_cab.symbolrate))
                self.list.append(
                    getConfigListEntry(_("Modulation"),
                                       self.scan_cab.modulation))
                self.list.append(
                    getConfigListEntry(_("FEC"), self.scan_cab.fec))
            elif self.tuning_type.value == "predefined_transponder":
                self.scan_nims.value = self.satfinder_scan_nims.value
                if self.CableTransponders is None:
                    self.predefinedCabTranspondersList()
                self.list.append(
                    getConfigListEntry(_('Transponder'),
                                       self.CableTransponders))
        elif nimmanager.nim_slots[int(
                self.satfinder_scan_nims.value)].isCompatible("DVB-T"):
            self.typeOfTuningEntry = getConfigListEntry(
                _('Tune'), self.tuning_type)
            region = nimmanager.getTerrestrialDescription(
                int(self.satfinder_scan_nims.value))
            if len(
                    nimmanager.getTranspondersTerrestrial(region)
            ) < 1:  # Only offer 'predefined transponder' if some transponders exist
                self.tuning_type.value = "single_transponder"
            else:
                self.list.append(self.typeOfTuningEntry)
            if self.tuning_type.value == "single_transponder":
                if nimmanager.nim_slots[int(
                        self.satfinder_scan_nims.value)].isCompatible(
                            "DVB-T2"):
                    self.systemEntryTerr = getConfigListEntry(
                        _('System'), self.scan_ter.system)
                    self.list.append(self.systemEntryTerr)
                else:
                    self.scan_ter.system.value = eDVBFrontendParametersTerrestrial.System_DVB_T
                self.typeOfInputEntry = getConfigListEntry(
                    _("Use frequency or channel"), self.scan_input_as)
                if self.ter_channel_input:
                    self.list.append(self.typeOfInputEntry)
                else:
                    self.scan_input_as.value = self.scan_input_as.choices[0]
                if self.ter_channel_input and self.scan_input_as.value == "channel":
                    channel = getChannelNumber(
                        self.scan_ter.frequency.floatint * 1000,
                        self.ter_tnumber)
                    if channel:
                        self.scan_ter.channel.removeNotifier(
                            self.retuneTriggeredByConfigElement)
                        self.scan_ter.channel.value = int(
                            channel.replace("+", "").replace("-", ""))
                    self.list.append(
                        getConfigListEntry(_("Channel"),
                                           self.scan_ter.channel))
                else:
                    prev_val = self.scan_ter.frequency.floatint
                    self.scan_ter.frequency.floatint = channel2frequency(
                        self.scan_ter.channel.value, self.ter_tnumber) / 1000
                    if self.scan_ter.frequency.floatint == 474000:
                        self.scan_ter.frequency.floatint = prev_val
                    self.list.append(
                        getConfigListEntry(_("Frequency"),
                                           self.scan_ter.frequency))
                self.list.append(
                    getConfigListEntry(_("Inversion"),
                                       self.scan_ter.inversion))
                self.list.append(
                    getConfigListEntry(_("Bandwidth"),
                                       self.scan_ter.bandwidth))
                self.list.append(
                    getConfigListEntry(_("Code rate HP"),
                                       self.scan_ter.fechigh))
                self.list.append(
                    getConfigListEntry(_("Code rate LP"),
                                       self.scan_ter.feclow))
                self.list.append(
                    getConfigListEntry(_("Modulation"),
                                       self.scan_ter.modulation))
                self.list.append(
                    getConfigListEntry(_("Transmission mode"),
                                       self.scan_ter.transmission))
                self.list.append(
                    getConfigListEntry(_("Guard interval"),
                                       self.scan_ter.guard))
                self.list.append(
                    getConfigListEntry(_("Hierarchy info"),
                                       self.scan_ter.hierarchy))
                if self.scan_ter.system.value == eDVBFrontendParametersTerrestrial.System_DVB_T2:
                    self.list.append(
                        getConfigListEntry(_('PLP ID'), self.scan_ter.plp_id))
            elif self.tuning_type.value == "predefined_transponder":
                self.scan_nims.value = self.satfinder_scan_nims.value
                if self.TerrestrialTransponders is None:
                    self.predefinedTerrTranspondersList()
                self.list.append(
                    getConfigListEntry(_('Transponder'),
                                       self.TerrestrialTransponders))
        elif nimmanager.nim_slots[int(
                self.satfinder_scan_nims.value)].isCompatible("ATSC"):
            self.typeOfTuningEntry = getConfigListEntry(
                _('Tune'), self.tuning_type)
            if len(
                    nimmanager.getTranspondersATSC(
                        int(self.satfinder_scan_nims.value))
            ) < 1:  # only show 'predefined transponder' if transponders exist
                self.tuning_type.value = "single_transponder"
            else:
                self.list.append(self.typeOfTuningEntry)
            if self.tuning_type.value == "single_transponder":
                self.systemEntryATSC = getConfigListEntry(
                    _("System"), self.scan_ats.system)
                self.list.append(self.systemEntryATSC)
                self.list.append(
                    getConfigListEntry(_("Frequency"),
                                       self.scan_ats.frequency))
                self.list.append(
                    getConfigListEntry(_("Inversion"),
                                       self.scan_ats.inversion))
                self.list.append(
                    getConfigListEntry(_("Modulation"),
                                       self.scan_ats.modulation))
            elif self.tuning_type.value == "predefined_transponder":
                #FIXME add region
                self.scan_nims.value = self.satfinder_scan_nims.value
                self.predefinedATSCTranspondersList()
                self.list.append(
                    getConfigListEntry(_('Transponder'),
                                       self.ATSCTransponders))
        self["config"].list = self.list
        self["config"].l.setList(self.list)

    def createConfig(self, foo):
        self.tuning_type = ConfigSelection(
            default="predefined_transponder",
            choices=[("single_transponder", _("User defined transponder")),
                     ("predefined_transponder", _("Predefined transponder"))])
        self.orbital_position = 192
        if self.frontendData and 'orbital_position' in self.frontendData:
            self.orbital_position = self.frontendData['orbital_position']
        ScanSetup.createConfig(self, self.frontendData)

        for x in (self.scan_sat.frequency, self.scan_sat.inversion,
                  self.scan_sat.symbolrate, self.scan_sat.polarization,
                  self.scan_sat.fec, self.scan_sat.pilot, self.scan_sat.fec_s2,
                  self.scan_sat.fec, self.scan_sat.modulation,
                  self.scan_sat.rolloff, self.scan_sat.system,
                  self.scan_sat.is_id, self.scan_sat.pls_mode,
                  self.scan_sat.pls_code, self.scan_ter.channel,
                  self.scan_ter.frequency, self.scan_ter.inversion,
                  self.scan_ter.bandwidth, self.scan_ter.fechigh,
                  self.scan_ter.feclow, self.scan_ter.modulation,
                  self.scan_ter.transmission, self.scan_ter.guard,
                  self.scan_ter.hierarchy, self.scan_ter.plp_id,
                  self.scan_cab.frequency, self.scan_cab.inversion,
                  self.scan_cab.symbolrate, self.scan_cab.modulation,
                  self.scan_cab.fec, self.scan_ats.frequency,
                  self.scan_ats.modulation, self.scan_ats.inversion,
                  self.scan_ats.system):
            x.addNotifier(self.retune, initial_call=False)

        satfinder_nim_list = []
        for n in nimmanager.nim_slots:
            if not any(
                [n.isCompatible(x)
                 for x in "DVB-S", "DVB-T", "DVB-C", "ATSC"]):
                continue
            if n.config_mode in ("loopthrough_internal",
                                 "loopthrough_external", "satposdepends",
                                 "nothing"):
                continue
            if n.isCompatible("DVB-S") and n.config_mode == "advanced" and len(
                    nimmanager.getSatListForNim(n.slot)) < 1:
                continue
            satfinder_nim_list.append(
                (str(n.slot), n.friendly_full_description))
        self.satfinder_scan_nims = ConfigSelection(choices=satfinder_nim_list)
        if self.frontendData is not None and len(
                satfinder_nim_list
        ) > 0:  # open the plugin with the currently active NIM as default
            self.satfinder_scan_nims.setValue(
                str(
                    self.frontendData.get("tuner_number",
                                          satfinder_nim_list[0][0])))

        self.feid = int(self.satfinder_scan_nims.value)

        self.satList = []
        self.scan_satselection = []
        for slot in nimmanager.nim_slots:
            if slot.isCompatible("DVB-S"):
                self.satList.append(nimmanager.getSatListForNim(slot.slot))
                self.scan_satselection.append(
                    getConfigSatlist(self.orbital_position,
                                     self.satList[slot.slot]))
            else:
                self.satList.append(None)

        if self.frontendData:
            ttype = self.frontendData.get("tuner_type", "UNKNOWN")
            if ttype == "DVB-S" and self.predefinedTranspondersList(
                    self.getSelectedSatIndex(self.feid)) is None and len(
                        nimmanager.getTransponders(
                            self.getSelectedSatIndex(self.feid))) > 0:
                self.tuning_type.value = "single_transponder"
            elif ttype == "DVB-T" and self.predefinedTerrTranspondersList(
            ) is None and len(
                    nimmanager.getTranspondersTerrestrial(
                        nimmanager.getTerrestrialDescription(self.feid))) > 0:
                self.tuning_type.value = "single_transponder"
            elif ttype == "DVB-C" and self.predefinedCabTranspondersList(
            ) is None and len(nimmanager.getTranspondersCable(self.feid)) > 0:
                self.tuning_type.value = "single_transponder"
            elif ttype == "ATSC" and self.predefinedATSCTranspondersList(
            ) is None and len(nimmanager.getTranspondersATSC(self.feid)) > 0:
                self.tuning_type.value = "single_transponder"
示例#18
0
    def createSetup(self):
        self.list = []
        self.satfinderTunerEntry = getConfigListEntry(_("Tuner"),
                                                      self.satfinder_scan_nims)
        self.list.append(self.satfinderTunerEntry)
        if nimmanager.nim_slots[int(
                self.satfinder_scan_nims.value)].isCompatible("DVB-S"):
            self.tuning_sat = self.scan_satselection[self.getSelectedSatIndex(
                self.feid)]
            if self.tuning_sat.value:
                self.satEntry = getConfigListEntry(_('Satellite'),
                                                   self.tuning_sat)
                self.list.append(self.satEntry)
                self.typeOfTuningEntry = getConfigListEntry(
                    _('Tune'), self.tuning_type)
                if len(
                        nimmanager.getTransponders(int(self.tuning_sat.value))
                ) < 1:  # Only offer 'predefined transponder' if some transponders exist
                    self.tuning_type.value = "single_transponder"
                else:
                    self.list.append(self.typeOfTuningEntry)

                nim = nimmanager.nim_slots[self.feid]

                if self.tuning_type.value == "single_transponder":
                    if nim.isCompatible("DVB-S2"):
                        self.systemEntry = getConfigListEntry(
                            _('System'), self.scan_sat.system)
                        self.list.append(self.systemEntry)
                    else:
                        # downgrade to dvb-s, in case a -s2 config was active
                        self.scan_sat.system.value = eDVBFrontendParametersSatellite.System_DVB_S
                    self.frequencyEntry = getConfigListEntry(
                        _('Frequency'), self.scan_sat.frequency)
                    self.list.append(self.frequencyEntry)
                    self.polarizationEntry = getConfigListEntry(
                        _('Polarization'), self.scan_sat.polarization)
                    self.list.append(self.polarizationEntry)
                    self.symbolrateEntry = (getConfigListEntry(
                        _('Symbol rate'), self.scan_sat.symbolrate))
                    self.list.append(self.symbolrateEntry)
                    self.inversionEntry = getConfigListEntry(
                        _('Inversion'), self.scan_sat.inversion)
                    self.list.append(self.inversionEntry)

                    if self.scan_sat.system.value == eDVBFrontendParametersSatellite.System_DVB_S:
                        self.fecEntry = getConfigListEntry(
                            _("FEC"), self.scan_sat.fec)
                        self.list.append(self.fecEntry)
                    elif self.scan_sat.system.value == eDVBFrontendParametersSatellite.System_DVB_S2:
                        self.fecEntry = getConfigListEntry(
                            _("FEC"), self.scan_sat.fec_s2)
                        self.list.append(self.fecEntry)
                        self.modulationEntry = getConfigListEntry(
                            _('Modulation'), self.scan_sat.modulation)
                        self.list.append(self.modulationEntry)
                        self.rolloffEntry = getConfigListEntry(
                            _('Roll-off'), self.scan_sat.rolloff)
                        self.list.append(self.rolloffEntry)
                        self.pilotEntry = getConfigListEntry(
                            _('Pilot'), self.scan_sat.pilot)
                        self.list.append(self.pilotEntry)
                        if nim.isMultistream():
                            self.list.append(
                                getConfigListEntry(_('Input Stream ID'),
                                                   self.scan_sat.is_id))
                            self.list.append(
                                getConfigListEntry(_('PLS Mode'),
                                                   self.scan_sat.pls_mode))
                            self.list.append(
                                getConfigListEntry(_('PLS Code'),
                                                   self.scan_sat.pls_code))
                elif self.tuning_type.value == "predefined_transponder":
                    if self.preDefTransponders is None:
                        self.updatePreDefTransponders()
                    self.list.append(
                        getConfigListEntry(_("Transponder"),
                                           self.preDefTransponders))
        elif nimmanager.nim_slots[int(
                self.satfinder_scan_nims.value)].isCompatible("DVB-C"):
            self.typeOfTuningEntry = getConfigListEntry(
                _('Tune'), self.tuning_type)
            if config.Nims[self.feid].cable.scan_type.value != "provider" or len(
                    nimmanager.getTranspondersCable(
                        int(self.satfinder_scan_nims.value))
            ) < 1:  # only show 'predefined transponder' if in provider mode and transponders exist
                self.tuning_type.value = "single_transponder"
            else:
                self.list.append(self.typeOfTuningEntry)
            if self.tuning_type.value == "single_transponder":
                self.list.append(
                    getConfigListEntry(_("Frequency"),
                                       self.scan_cab.frequency))
                self.list.append(
                    getConfigListEntry(_("Inversion"),
                                       self.scan_cab.inversion))
                self.list.append(
                    getConfigListEntry(_("Symbol rate"),
                                       self.scan_cab.symbolrate))
                self.list.append(
                    getConfigListEntry(_("Modulation"),
                                       self.scan_cab.modulation))
                self.list.append(
                    getConfigListEntry(_("FEC"), self.scan_cab.fec))
            elif self.tuning_type.value == "predefined_transponder":
                self.scan_nims.value = self.satfinder_scan_nims.value
                if self.CableTransponders is None:
                    self.predefinedCabTranspondersList()
                self.list.append(
                    getConfigListEntry(_('Transponder'),
                                       self.CableTransponders))
        elif nimmanager.nim_slots[int(
                self.satfinder_scan_nims.value)].isCompatible("DVB-T"):
            self.typeOfTuningEntry = getConfigListEntry(
                _('Tune'), self.tuning_type)
            region = nimmanager.getTerrestrialDescription(
                int(self.satfinder_scan_nims.value))
            if len(
                    nimmanager.getTranspondersTerrestrial(region)
            ) < 1:  # Only offer 'predefined transponder' if some transponders exist
                self.tuning_type.value = "single_transponder"
            else:
                self.list.append(self.typeOfTuningEntry)
            if self.tuning_type.value == "single_transponder":
                if nimmanager.nim_slots[int(
                        self.satfinder_scan_nims.value)].isCompatible(
                            "DVB-T2"):
                    self.systemEntryTerr = getConfigListEntry(
                        _('System'), self.scan_ter.system)
                    self.list.append(self.systemEntryTerr)
                else:
                    self.scan_ter.system.value = eDVBFrontendParametersTerrestrial.System_DVB_T
                self.typeOfInputEntry = getConfigListEntry(
                    _("Use frequency or channel"), self.scan_input_as)
                if self.ter_channel_input:
                    self.list.append(self.typeOfInputEntry)
                else:
                    self.scan_input_as.value = self.scan_input_as.choices[0]
                if self.ter_channel_input and self.scan_input_as.value == "channel":
                    channel = getChannelNumber(
                        self.scan_ter.frequency.floatint * 1000,
                        self.ter_tnumber)
                    if channel:
                        self.scan_ter.channel.removeNotifier(
                            self.retuneTriggeredByConfigElement)
                        self.scan_ter.channel.value = int(
                            channel.replace("+", "").replace("-", ""))
                    self.list.append(
                        getConfigListEntry(_("Channel"),
                                           self.scan_ter.channel))
                else:
                    prev_val = self.scan_ter.frequency.floatint
                    self.scan_ter.frequency.floatint = channel2frequency(
                        self.scan_ter.channel.value, self.ter_tnumber) / 1000
                    if self.scan_ter.frequency.floatint == 474000:
                        self.scan_ter.frequency.floatint = prev_val
                    self.list.append(
                        getConfigListEntry(_("Frequency"),
                                           self.scan_ter.frequency))
                self.list.append(
                    getConfigListEntry(_("Inversion"),
                                       self.scan_ter.inversion))
                self.list.append(
                    getConfigListEntry(_("Bandwidth"),
                                       self.scan_ter.bandwidth))
                self.list.append(
                    getConfigListEntry(_("Code rate HP"),
                                       self.scan_ter.fechigh))
                self.list.append(
                    getConfigListEntry(_("Code rate LP"),
                                       self.scan_ter.feclow))
                self.list.append(
                    getConfigListEntry(_("Modulation"),
                                       self.scan_ter.modulation))
                self.list.append(
                    getConfigListEntry(_("Transmission mode"),
                                       self.scan_ter.transmission))
                self.list.append(
                    getConfigListEntry(_("Guard interval"),
                                       self.scan_ter.guard))
                self.list.append(
                    getConfigListEntry(_("Hierarchy info"),
                                       self.scan_ter.hierarchy))
                if self.scan_ter.system.value == eDVBFrontendParametersTerrestrial.System_DVB_T2:
                    self.list.append(
                        getConfigListEntry(_('PLP ID'), self.scan_ter.plp_id))
            elif self.tuning_type.value == "predefined_transponder":
                self.scan_nims.value = self.satfinder_scan_nims.value
                if self.TerrestrialTransponders is None:
                    self.predefinedTerrTranspondersList()
                self.list.append(
                    getConfigListEntry(_('Transponder'),
                                       self.TerrestrialTransponders))
        elif nimmanager.nim_slots[int(
                self.satfinder_scan_nims.value)].isCompatible("ATSC"):
            self.typeOfTuningEntry = getConfigListEntry(
                _('Tune'), self.tuning_type)
            if len(
                    nimmanager.getTranspondersATSC(
                        int(self.satfinder_scan_nims.value))
            ) < 1:  # only show 'predefined transponder' if transponders exist
                self.tuning_type.value = "single_transponder"
            else:
                self.list.append(self.typeOfTuningEntry)
            if self.tuning_type.value == "single_transponder":
                self.systemEntryATSC = getConfigListEntry(
                    _("System"), self.scan_ats.system)
                self.list.append(self.systemEntryATSC)
                self.list.append(
                    getConfigListEntry(_("Frequency"),
                                       self.scan_ats.frequency))
                self.list.append(
                    getConfigListEntry(_("Inversion"),
                                       self.scan_ats.inversion))
                self.list.append(
                    getConfigListEntry(_("Modulation"),
                                       self.scan_ats.modulation))
            elif self.tuning_type.value == "predefined_transponder":
                #FIXME add region
                self.scan_nims.value = self.satfinder_scan_nims.value
                self.predefinedATSCTranspondersList()
                self.list.append(
                    getConfigListEntry(_('Transponder'),
                                       self.ATSCTransponders))
        self["config"].list = self.list
        self["config"].l.setList(self.list)
示例#19
0
	def keyGoCheckTimeshiftCallback(self, answer):
		if not answer or self.scan_nims.value == "":
			return
		tlist = []
		flags = None
		startScan = True
		removeAll = True
		index_to_scan = int(self.scan_nims.getValue())

		if self.scan_nims == [ ]:
			self.session.open(MessageBox, _("No tuner is enabled!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
			return

		nim = nimmanager.nim_slots[index_to_scan]
		print "nim", nim.slot
		if nim.isCompatible("DVB-S"):
			print "is compatible with DVB-S"
			if self.scan_type.getValue() == "single_transponder":
				# these lists are generated for each tuner, so this has work.
				assert len(self.satList) > index_to_scan
				assert len(self.scan_satselection) > index_to_scan

				nimsats = self.satList[index_to_scan]
				selsatidx = self.scan_satselection[index_to_scan].index

				# however, the satList itself could be empty. in that case, "index" is 0 (for "None").
				if len(nimsats):
					orbpos = nimsats[selsatidx][0]
					if self.scan_sat.system.getValue() == eDVBFrontendParametersSatellite.System_DVB_S:
						fec = self.scan_sat.fec.getValue()
					else:
						fec = self.scan_sat.fec_s2.getValue()
					print "add sat transponder"
					self.addSatTransponder(tlist, self.scan_sat.frequency.getValue(),
								self.scan_sat.symbolrate.getValue(),
								self.scan_sat.polarization.getValue(),
								fec,
								self.scan_sat.inversion.getValue(),
								orbpos,
								self.scan_sat.system.getValue(),
								self.scan_sat.modulation.getValue(),
								self.scan_sat.rolloff.getValue(),
								self.scan_sat.pilot.getValue())
				removeAll = False
			elif self.scan_type.getValue() == "single_satellite":
				sat = self.satList[index_to_scan][self.scan_satselection[index_to_scan].index]
				getInitialTransponderList(tlist, sat[0])
			elif self.scan_type.getValue().find("multisat") != -1:
				SatList = nimmanager.getSatListForNim(index_to_scan)
				for x in self.multiscanlist:
					if x[1].getValue():
						print "   " + str(x[0])
						getInitialTransponderList(tlist, x[0])

		elif nim.isCompatible("DVB-C"):
			if self.scan_typecable.getValue() == "single_transponder":
				self.addCabTransponder(tlist, self.scan_cab.frequency.getValue(),
											  self.scan_cab.symbolrate.getValue(),
											  self.scan_cab.modulation.getValue(),
											  self.scan_cab.fec.getValue(),
											  self.scan_cab.inversion.getValue())
				removeAll = False
			elif self.scan_typecable.getValue() == "complete":
				if config.Nims[index_to_scan].cable.scan_type.getValue() == "provider":
					getInitialCableTransponderList(tlist, index_to_scan)
				else:
					startScan = False

		elif nim.isCompatible("DVB-T"):
			if self.scan_typeterrestrial.getValue() == "single_transponder":
				self.addTerTransponder(tlist,
						self.scan_ter.frequency.getValue() * 1000,
						inversion = self.scan_ter.inversion.getValue(),
						bandwidth = self.scan_ter.bandwidth.getValue(),
						fechigh = self.scan_ter.fechigh.getValue(),
						feclow = self.scan_ter.feclow.getValue(),
						modulation = self.scan_ter.modulation.getValue(),
						transmission = self.scan_ter.transmission.getValue(),
						guard = self.scan_ter.guard.getValue(),
						hierarchy = self.scan_ter.hierarchy.getValue())
				removeAll = False
			elif self.scan_typeterrestrial.getValue() == "complete":
				getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(index_to_scan))

		flags = self.scan_networkScan.getValue() and eComponentScan.scanNetworkSearch or 0

		tmp = self.scan_clearallservices.getValue()
		if tmp == "yes":
			flags |= eComponentScan.scanRemoveServices
		elif tmp == "yes_hold_feeds":
			flags |= eComponentScan.scanRemoveServices
			flags |= eComponentScan.scanDontRemoveFeeds

		if tmp != "no" and not removeAll:
			flags |= eComponentScan.scanDontRemoveUnscanned

		if self.scan_onlyfree.getValue():
			flags |= eComponentScan.scanOnlyFree

		for x in self["config"].list:
			x[1].save()

		if startScan:
			self.startScan(tlist, flags, index_to_scan, self.networkid)
		else:
			self.flags = flags
			self.feid = index_to_scan
			self.tlist = []
			self.startCableTransponderSearch(self.feid)
示例#20
0
	def createSetup(self):
		self.list = []
		self.satfinderTunerEntry = getConfigListEntry(_("Tuner"), self.satfinder_scan_nims)
		self.list.append(self.satfinderTunerEntry)
		if nimmanager.nim_slots[int(self.satfinder_scan_nims.value)].isCompatible("DVB-S"):
			self.tuning_sat = self.scan_satselection[self.getSelectedSatIndex(self.feid)]
			self.satEntry = getConfigListEntry(_('Satellite'), self.tuning_sat)
			self.list.append(self.satEntry)
			self.typeOfTuningEntry = getConfigListEntry(_('Tune'), self.tuning_type)
			if len(nimmanager.getTransponders(int(self.tuning_sat.value))) < 1: # Only offer 'predefined transponder' if some transponders exist
				self.tuning_type.value = "single_transponder"
			else:
				self.list.append(self.typeOfTuningEntry)

			nim = nimmanager.nim_slots[self.feid]

			if self.tuning_type.value == "single_transponder":
				if nim.isCompatible("DVB-S2"):
					self.systemEntry = getConfigListEntry(_('System'), self.scan_sat.system)
					self.list.append(self.systemEntry)
				else:
					# downgrade to dvb-s, in case a -s2 config was active
					self.scan_sat.system.value = eDVBFrontendParametersSatellite.System_DVB_S
				self.list.append(getConfigListEntry(_('Frequency'), self.scan_sat.frequency))
				self.list.append(getConfigListEntry(_('Polarization'), self.scan_sat.polarization))
				self.list.append(getConfigListEntry(_('Symbol rate'), self.scan_sat.symbolrate))
				self.list.append(getConfigListEntry(_('Inversion'), self.scan_sat.inversion))
				if self.scan_sat.system.value == eDVBFrontendParametersSatellite.System_DVB_S:
					self.list.append(getConfigListEntry(_("FEC"), self.scan_sat.fec))
				elif self.scan_sat.system.value == eDVBFrontendParametersSatellite.System_DVB_S2:
					self.list.append(getConfigListEntry(_("FEC"), self.scan_sat.fec_s2))
					self.modulationEntry = getConfigListEntry(_('Modulation'), self.scan_sat.modulation)
					self.list.append(self.modulationEntry)
					self.list.append(getConfigListEntry(_('Roll-off'), self.scan_sat.rolloff))
					self.list.append(getConfigListEntry(_('Pilot'), self.scan_sat.pilot))
					self.list.append(getConfigListEntry(_('Input Stream ID'), self.scan_sat.is_id))
					self.list.append(getConfigListEntry(_("PLS Mode"), self.scan_sat.pls_mode))
					self.list.append(getConfigListEntry(_('PLS Code'), self.scan_sat.pls_code))
			elif self.tuning_type.value == "predefined_transponder":
				self.updatePreDefTransponders()
				self.list.append(getConfigListEntry(_("Transponder"), self.preDefTransponders))
		elif nimmanager.nim_slots[int(self.satfinder_scan_nims.value)].isCompatible("DVB-C"):
			self.typeOfTuningEntry = getConfigListEntry(_('Tune'), self.tuning_type)
			if config.Nims[self.feid].cable.scan_type.value != "provider" or len(nimmanager.getTranspondersCable(int(self.satfinder_scan_nims.value))) < 1: # only show 'predefined transponder' if in provider mode and transponders exist
				self.tuning_type.value = "single_transponder"
			else:
				self.list.append(self.typeOfTuningEntry)
			if self.tuning_type.value == "single_transponder":
				self.list.append(getConfigListEntry(_("Frequency"), self.scan_cab.frequency))
				self.list.append(getConfigListEntry(_("Inversion"), self.scan_cab.inversion))
				self.list.append(getConfigListEntry(_("Symbol rate"), self.scan_cab.symbolrate))
				self.list.append(getConfigListEntry(_("Modulation"), self.scan_cab.modulation))
				self.list.append(getConfigListEntry(_("FEC"), self.scan_cab.fec))
			elif self.tuning_type.value == "predefined_transponder":
				self.scan_nims.value = self.satfinder_scan_nims.value
				self.predefinedCabTranspondersList()
				self.list.append(getConfigListEntry(_('Transponder'), self.CableTransponders))
		elif nimmanager.nim_slots[int(self.satfinder_scan_nims.value)].isCompatible("DVB-T"):
			self.typeOfTuningEntry = getConfigListEntry(_('Tune'), self.tuning_type)
			region = nimmanager.getTerrestrialDescription(int(self.satfinder_scan_nims.value))
			if len(nimmanager.getTranspondersTerrestrial(region)) < 1: # Only offer 'predefined transponder' if some transponders exist
				self.tuning_type.value = "single_transponder"
			else:
				self.list.append(self.typeOfTuningEntry)
			if self.tuning_type.value == "single_transponder":
				if nimmanager.nim_slots[int(self.satfinder_scan_nims.value)].isCompatible("DVB-T2"):
					self.systemEntryTerr = getConfigListEntry(_('System'), self.scan_ter.system)
					self.list.append(self.systemEntryTerr)
				else:
					self.scan_ter.system.value = eDVBFrontendParametersTerrestrial.System_DVB_T
				self.typeOfInputEntry = getConfigListEntry(_("Use frequency or channel"), self.scan_input_as)
				if self.ter_channel_input:
					self.list.append(self.typeOfInputEntry)
				else:
					self.scan_input_as.value = self.scan_input_as.choices[0]
				if self.ter_channel_input and self.scan_input_as.value == "channel":
					channel = getChannelNumber(self.scan_ter.frequency.value*1000, self.ter_tnumber)
					if channel:
						self.scan_ter.channel.value = int(channel.replace("+","").replace("-",""))
					self.list.append(getConfigListEntry(_("Channel"), self.scan_ter.channel))
				else:
					prev_val = self.scan_ter.frequency.value
					self.scan_ter.frequency.value = channel2frequency(self.scan_ter.channel.value, self.ter_tnumber)/1000
					if self.scan_ter.frequency.value == 474000:
						self.scan_ter.frequency.value = prev_val
					self.list.append(getConfigListEntry(_("Frequency"), self.scan_ter.frequency))
				self.list.append(getConfigListEntry(_("Inversion"), self.scan_ter.inversion))
				self.list.append(getConfigListEntry(_("Bandwidth"), self.scan_ter.bandwidth))
				self.list.append(getConfigListEntry(_("Code rate HP"), self.scan_ter.fechigh))
				self.list.append(getConfigListEntry(_("Code rate LP"), self.scan_ter.feclow))
				self.list.append(getConfigListEntry(_("Modulation"), self.scan_ter.modulation))
				self.list.append(getConfigListEntry(_("Transmission mode"), self.scan_ter.transmission))
				self.list.append(getConfigListEntry(_("Guard interval"), self.scan_ter.guard))
				self.list.append(getConfigListEntry(_("Hierarchy info"), self.scan_ter.hierarchy))
				if self.scan_ter.system.value == eDVBFrontendParametersTerrestrial.System_DVB_T2:
					self.list.append(getConfigListEntry(_('PLP ID'), self.scan_ter.plp_id))
			elif self.tuning_type.value == "predefined_transponder":
				self.scan_nims.value = self.satfinder_scan_nims.value
				self.predefinedTerrTranspondersList()
				self.list.append(getConfigListEntry(_('Transponder'), self.TerrestrialTransponders))
		self.retune(None)
		self["config"].list = self.list
		self["config"].l.setList(self.list)
示例#21
0
	def getTunerDescription(self, region):
		return nimmanager.getTerrestrialDescription(region)
示例#22
0
	def createConfig(self, foo):
		self.tuning_type = ConfigSelection(default = "predefined_transponder", choices = [("single_transponder", _("User defined transponder")), ("predefined_transponder", _("Predefined transponder"))])
		self.orbital_position = 192
		if self.frontendData and self.frontendData.has_key('orbital_position'):
			self.orbital_position = self.frontendData['orbital_position']
		ScanSetup.createConfig(self, self.frontendData)

		for x in (self.scan_sat.frequency,
			self.scan_sat.inversion, self.scan_sat.symbolrate,
			self.scan_sat.polarization, self.scan_sat.fec, self.scan_sat.pilot,
			self.scan_sat.fec_s2, self.scan_sat.fec, self.scan_sat.modulation,
			self.scan_sat.rolloff, self.scan_sat.system, self.scan_sat.is_id, self.scan_sat.pls_mode, self.scan_sat.pls_code,
			self.scan_ter.channel, self.scan_ter.frequency, self.scan_ter.inversion,
			self.scan_ter.bandwidth, self.scan_ter.fechigh, self.scan_ter.feclow,
			self.scan_ter.modulation, self.scan_ter.transmission,
			self.scan_ter.guard, self.scan_ter.hierarchy, self.scan_ter.plp_id,
			self.scan_cab.frequency, self.scan_cab.inversion, self.scan_cab.symbolrate,
			self.scan_cab.modulation, self.scan_cab.fec):
			x.addNotifier(self.retune, initial_call = False)

		satfinder_nim_list = []
		for n in nimmanager.nim_slots:
			if not (n.isCompatible("DVB-S") or n.isCompatible("DVB-T") or n.isCompatible("DVB-C")):
				continue
			if n.config_mode  in ("loopthrough", "satposdepends", "nothing"):
				continue
			if n.isCompatible("DVB-S") and n.config_mode == "advanced" and len(nimmanager.getSatListForNim(n.slot)) < 1:
				continue
			satfinder_nim_list.append((str(n.slot), n.friendly_full_description))
		self.satfinder_scan_nims = ConfigSelection(choices = satfinder_nim_list)
		if self.frontendData is not None and len(satfinder_nim_list) > 0: # open the plugin with the currently active NIM as default
			self.satfinder_scan_nims.setValue(str(self.frontendData.get("tuner_number", satfinder_nim_list[0][0])))

		self.feid = int(self.satfinder_scan_nims.value)

		self.satList = []
		self.scan_satselection = []
		for slot in nimmanager.nim_slots:
			if slot.isCompatible("DVB-S"):
				self.satList.append(nimmanager.getSatListForNim(slot.slot))
				self.scan_satselection.append(getConfigSatlist(self.orbital_position, self.satList[slot.slot]))
			else:
				self.satList.append(None)

		if self.frontendData:
			ttype = self.frontendData.get("tuner_type", "UNKNOWN")
			if ttype == "DVB-S" and self.predefinedTranspondersList(self.getSelectedSatIndex(self.feid)) is None and len(nimmanager.getTransponders(self.getSelectedSatIndex(self.feid))) > 0:
				self.tuning_type.value = "single_transponder"
			elif ttype == "DVB-T" and self.predefinedTerrTranspondersList() is None and len(nimmanager.getTranspondersTerrestrial(nimmanager.getTerrestrialDescription(self.feid))) > 0:
				self.tuning_type.value = "single_transponder"
			elif ttype == "DVB-C" and self.predefinedCabTranspondersList() is None and len(nimmanager.getTranspondersCable(self.feid)) > 0:
				self.tuning_type.value = "single_transponder"
示例#23
0
文件: plugin.py 项目: kingvuplus/b-p
	def createConfig(self, foo):
		self.tuning_type = ConfigSelection(default = "predefined_transponder", choices = [("single_transponder", _("User defined transponder")), ("predefined_transponder", _("Predefined transponder"))])
		self.orbital_position = 192
		if self.frontendData and self.frontendData.has_key('orbital_position'):
			self.orbital_position = self.frontendData['orbital_position']
		ScanSetup.createConfig(self, self.frontendData)

		for x in (self.scan_sat.frequency,
			self.scan_sat.inversion, self.scan_sat.symbolrate,
			self.scan_sat.polarization, self.scan_sat.fec, self.scan_sat.pilot,
			self.scan_sat.fec_s2, self.scan_sat.fec, self.scan_sat.modulation,
			self.scan_sat.rolloff, self.scan_sat.system,
			self.scan_ter.channel, self.scan_ter.frequency, self.scan_ter.inversion,
			self.scan_ter.bandwidth, self.scan_ter.fechigh, self.scan_ter.feclow,
			self.scan_ter.modulation, self.scan_ter.transmission,
			self.scan_ter.guard, self.scan_ter.hierarchy, self.scan_ter.plp_id,
			self.scan_cab.frequency, self.scan_cab.inversion, self.scan_cab.symbolrate,
			self.scan_cab.modulation, self.scan_cab.fec):
			x.addNotifier(self.retune, initial_call = False)

		satfinder_nim_list = []
		for n in nimmanager.nim_slots:
			if not (n.isCompatible("DVB-S") or n.isCompatible("DVB-T") or n.isCompatible("DVB-C")):
				continue
			if n.config_mode  in ("loopthrough", "satposdepends", "nothing"):
				continue
			if n.isCompatible("DVB-S") and n.config_mode == "advanced" and len(nimmanager.getSatListForNim(n.slot)) < 1:
				continue
			satfinder_nim_list.append((str(n.slot), n.friendly_full_description))
		self.satfinder_scan_nims = ConfigSelection(choices = satfinder_nim_list)
		if self.frontendData is not None and len(satfinder_nim_list) > 0: # open the plugin with the currently active NIM as default
			self.satfinder_scan_nims.setValue(str(self.frontendData.get("tuner_number", satfinder_nim_list[0][0])))

		self.feid = int(self.satfinder_scan_nims.value)

		self.satList = []
		self.scan_satselection = []
		for slot in nimmanager.nim_slots:
			if slot.isCompatible("DVB-S"):
				self.satList.append(nimmanager.getSatListForNim(slot.slot))
				self.scan_satselection.append(getConfigSatlist(self.orbital_position, self.satList[slot.slot]))
			else:
				self.satList.append(None)

		if self.frontendData:
			ttype = self.frontendData.get("tuner_type", "UNKNOWN")
			if ttype == "DVB-S" and self.predefinedTranspondersList(self.getSelectedSatIndex(self.feid)) is None and len(nimmanager.getTransponders(self.getSelectedSatIndex(self.feid))) > 0:
				self.tuning_type.value = "single_transponder"
			elif ttype == "DVB-T" and self.predefinedTerrTranspondersList() is None and len(nimmanager.getTranspondersTerrestrial(nimmanager.getTerrestrialDescription(self.feid))) > 0:
				self.tuning_type.value = "single_transponder"
			elif ttype == "DVB-C" and self.predefinedCabTranspondersList() is None and len(nimmanager.getTranspondersCable(self.feid)) > 0:
				self.tuning_type.value = "single_transponder"
示例#24
0
 def getTunerDescription(self, region):
     return nimmanager.getTerrestrialDescription(region)
示例#25
0
class Satfinder(ScanSetup, ServiceScan):
	"""Inherits StaticText [key_red] and [key_green] properties from ScanSetup"""

	def __init__(self, session):
		self.initcomplete = False
		service = session and session.nav.getCurrentService()
		feinfo = service and service.frontendInfo()
		self.frontendData = feinfo and feinfo.getAll(True)
		del feinfo
		del service

		self.typeOfTuningEntry = None
		self.systemEntry = None
		self.systemEntryATSC = None
		self.satfinderTunerEntry = None
		self.satEntry = None
		self.typeOfInputEntry = None
		self.DVB_TypeEntry = None
		self.systemEntryTerr = None
		self.preDefTransponderEntry = None
		self.preDefTransponderCableEntry = None
		self.preDefTransponderTerrEntry = None
		self.preDefTransponderAtscEntry = None
		self.frontend = None
		self.is_id_boolEntry = None
		self.t2mi_plp_id_boolEntry = None
		self.timer = eTimer()
		self.timer.callback.append(self.updateFrontendStatus)

		ScanSetup.__init__(self, session)
		self.setTitle(_("Signal finder"))
		self["Frontend"] = FrontendStatus(frontend_source = lambda : self.frontend, update_interval = 100)

		self["actions"] = ActionMap(["SetupActions", "ColorActions"],
		{
			"save": self.keyGoScan,
			"ok": self.keyGoScan,
			"cancel": self.keyCancel,
		}, -3)

		self.initcomplete = True
		self.session.postScanService = self.session.nav.getCurrentlyPlayingServiceOrGroup()
		self.session.nav.stopService()
		self.onClose.append(self.__onClose)
		self.onShow.append(self.prepareFrontend)

	def openFrontend(self):
		res_mgr = eDVBResourceManager.getInstance()
		if res_mgr:
			self.raw_channel = res_mgr.allocateRawChannel(self.feid)
			if self.raw_channel:
				self.frontend = self.raw_channel.getFrontend()
				if self.frontend:
					return True
		return False

	def prepareFrontend(self):
		self.frontend = None
		if not self.openFrontend():
			self.session.nav.stopService()
			if not self.openFrontend():
				if self.session.pipshown:
					from Screens.InfoBar import InfoBar
					InfoBar.instance and hasattr(InfoBar.instance, "showPiP") and InfoBar.instance.showPiP()
					if not self.openFrontend():
						self.frontend = None # in normal case this should not happen
		self.tuner = Tuner(self.frontend)
		self.retune()

	def updateFrontendStatus(self):
		if self.frontend:
			dict = {}
			self.frontend.getFrontendStatus(dict)
			if dict["tuner_state"] == "FAILED" or dict["tuner_state"] == "LOSTLOCK":
				self.retune()
			else:
				self.timer.start(500, True)

	def __onClose(self):
		self.session.nav.playService(self.session.postScanService)

	def newConfig(self):
		cur = self["config"].getCurrent()
		if cur in (
					self.typeOfTuningEntry,
					self.systemEntry,
					self.typeOfInputEntry,
					self.systemEntryATSC,
					self.DVB_TypeEntry,
					self.systemEntryTerr,
					self.satEntry
					):  # update screen and retune
			self.createSetup()
			self.retune()

		elif cur == self.satfinderTunerEntry: # switching tuners, update screen, get frontend, and retune (in prepareFrontend())
			self.feid = int(self.satfinder_scan_nims.value)
			self.createSetup()
			self.prepareFrontend()
			if self.frontend is None:
				msg = _("Tuner not available.")
				if self.session.nav.RecordTimer.isRecording():
					msg += _("\nRecording in progress.")
				self.session.open(MessageBox, msg, MessageBox.TYPE_ERROR)

		elif cur in (self.preDefTransponderEntry, self.preDefTransponderCableEntry, self.preDefTransponderTerrEntry, self.preDefTransponderAtscEntry): # retune only
			self.retune()
		elif cur == self.is_id_boolEntry:
			if self.is_id_boolEntry[1].value:
				self.scan_sat.is_id.value = 0 if self.is_id_memory < 0 else self.is_id_memory
				self.scan_sat.pls_mode.value = self.pls_mode_memory
				self.scan_sat.pls_code.value = self.pls_code_memory
			else:
				self.is_id_memory = self.scan_sat.is_id.value
				self.pls_mode_memory = self.scan_sat.pls_mode.value
				self.pls_code_memory = self.scan_sat.pls_code.value
				self.scan_sat.is_id.value = eDVBFrontendParametersSatellite.No_Stream_Id_Filter
				self.scan_sat.pls_mode.value = eDVBFrontendParametersSatellite.PLS_Gold
				self.scan_sat.pls_code.value = eDVBFrontendParametersSatellite.PLS_Default_Gold_Code
			self.createSetup()
			self.retune()
		elif cur == self.t2mi_plp_id_boolEntry:
			if self.t2mi_plp_id_boolEntry[1].value:
				self.scan_sat.t2mi_plp_id.value = 0 if self.t2mi_plp_id_memory < 0 else self.t2mi_plp_id_memory
				self.scan_sat.t2mi_pid.value = self.t2mi_pid_memory
			else:
				self.t2mi_plp_id_memory = self.scan_sat.t2mi_plp_id.value
				self.t2mi_pid_memory = self.scan_sat.t2mi_pid.value
				self.scan_sat.t2mi_plp_id.value = eDVBFrontendParametersSatellite.No_T2MI_PLP_Id
				self.scan_sat.t2mi_pid.value = eDVBFrontendParametersSatellite.T2MI_Default_Pid
			self.createSetup()
			self.retune()

	def createSetup(self):
		self.list = []
		indent = "- "
		self.satfinderTunerEntry = getConfigListEntry(_("Tuner"), self.satfinder_scan_nims)
		self.list.append(self.satfinderTunerEntry)
		self.DVB_type = self.nim_type_dict[int(self.satfinder_scan_nims.value)]["selection"]
		self.DVB_TypeEntry = getConfigListEntry(_("DVB type"), self.DVB_type) # multitype?
		if len(self.nim_type_dict[int(self.satfinder_scan_nims.value)]["modes"]) > 1:
			 self.list.append(self.DVB_TypeEntry)
		if self.DVB_type.value == "DVB-S":
			self.tuning_sat = self.scan_satselection[self.getSelectedSatIndex(self.feid)]
			self.satEntry = getConfigListEntry(_('Satellite'), self.tuning_sat)
			self.list.append(self.satEntry)
			self.typeOfTuningEntry = getConfigListEntry(_('Tune'), self.tuning_type)
			if len(nimmanager.getTransponders(int(self.tuning_sat.value), self.feid)) < 1: # Only offer 'predefined transponder' if some transponders exist
				self.tuning_type.value = "single_transponder"
			else:
				self.list.append(self.typeOfTuningEntry)

			nim = nimmanager.nim_slots[self.feid]

			if self.tuning_type.value == "single_transponder":
				if nim.canBeCompatible("DVB-S2"):
					self.systemEntry = getConfigListEntry(_('System'), self.scan_sat.system)
					self.list.append(self.systemEntry)
				else:
					# downgrade to dvb-s, in case a -s2 config was active
					self.scan_sat.system.value = eDVBFrontendParametersSatellite.System_DVB_S
				self.list.append(getConfigListEntry(_('Frequency'), self.scan_sat.frequency))
				self.list.append(getConfigListEntry(_('Polarization'), self.scan_sat.polarization))
				self.list.append(getConfigListEntry(_('Symbol rate'), self.scan_sat.symbolrate))
				self.list.append(getConfigListEntry(_('Inversion'), self.scan_sat.inversion))
				if self.scan_sat.system.value == eDVBFrontendParametersSatellite.System_DVB_S:
					self.list.append(getConfigListEntry(_("FEC"), self.scan_sat.fec))
				elif self.scan_sat.system.value == eDVBFrontendParametersSatellite.System_DVB_S2:
					self.list.append(getConfigListEntry(_("FEC"), self.scan_sat.fec_s2))
					self.modulationEntry = getConfigListEntry(_('Modulation'), self.scan_sat.modulation)
					self.list.append(self.modulationEntry)
					self.list.append(getConfigListEntry(_('Roll-off'), self.scan_sat.rolloff))
					self.list.append(getConfigListEntry(_('Pilot'), self.scan_sat.pilot))
					if nim.isMultistream():
						self.is_id_boolEntry = getConfigListEntry(_('Transport Stream Type'), self.scan_sat.is_id_bool)
						self.list.append(self.is_id_boolEntry)
						if self.scan_sat.is_id_bool.value:
							self.list.append(getConfigListEntry(indent + _('Input Stream ID'), self.scan_sat.is_id))
							self.list.append(getConfigListEntry(indent + _('PLS Mode'), self.scan_sat.pls_mode))
							self.list.append(getConfigListEntry(indent + _('PLS Code'), self.scan_sat.pls_code))
					else:
						self.scan_sat.is_id.value = eDVBFrontendParametersSatellite.No_Stream_Id_Filter
						self.scan_sat.pls_mode.value = eDVBFrontendParametersSatellite.PLS_Gold
						self.scan_sat.pls_code.value = eDVBFrontendParametersSatellite.PLS_Default_Gold_Code
					if nim.isT2MI():
						self.t2mi_plp_id_boolEntry = getConfigListEntry(_('T2MI PLP'), self.scan_sat.t2mi_plp_id_bool)
						self.list.append(self.t2mi_plp_id_boolEntry)
						if self.scan_sat.t2mi_plp_id_bool.value:
							self.list.append(getConfigListEntry(indent + _('T2MI PLP ID'), self.scan_sat.t2mi_plp_id))
							self.list.append(getConfigListEntry(indent + _('T2MI PID'), self.scan_sat.t2mi_pid))
					else:
						self.scan_sat.t2mi_plp_id.value = eDVBFrontendParametersSatellite.No_T2MI_PLP_Id
						self.scan_sat.t2mi_pid.value = eDVBFrontendParametersSatellite.T2MI_Default_Pid
			elif self.tuning_type.value == "predefined_transponder":
				self.scan_nims.value = self.satfinder_scan_nims.value
				self.updatePreDefTransponders()
				self.preDefTransponderEntry = getConfigListEntry(_("Transponder"), self.preDefTransponders)
				self.list.append(self.preDefTransponderEntry)
		elif self.DVB_type.value == "DVB-C":
			self.typeOfTuningEntry = getConfigListEntry(_('Tune'), self.tuning_type)
			if config.Nims[self.feid].cable.scan_type.value != "provider" or len(nimmanager.getTranspondersCable(int(self.satfinder_scan_nims.value))) < 1: # only show 'predefined transponder' if in provider mode and transponders exist
				self.tuning_type.value = "single_transponder"
			else:
				self.list.append(self.typeOfTuningEntry)
			if self.tuning_type.value == "single_transponder":
				self.list.append(getConfigListEntry(_("Frequency (kHz)"), self.scan_cab.frequency))
				self.list.append(getConfigListEntry(_("Inversion"), self.scan_cab.inversion))
				self.list.append(getConfigListEntry(_("Symbol rate"), self.scan_cab.symbolrate))
				self.list.append(getConfigListEntry(_("Modulation"), self.scan_cab.modulation))
				self.list.append(getConfigListEntry(_("FEC"), self.scan_cab.fec))
			elif self.tuning_type.value == "predefined_transponder":
				self.scan_nims.value = self.satfinder_scan_nims.value
				self.predefinedCabTranspondersList()
				self.preDefTransponderCableEntry = getConfigListEntry(_("Transponder"), self.CableTransponders)
				self.list.append(self.preDefTransponderCableEntry)
		elif self.DVB_type.value == "DVB-T":
			self.typeOfTuningEntry = getConfigListEntry(_('Tune'), self.tuning_type)
			region = nimmanager.getTerrestrialDescription(int(self.satfinder_scan_nims.value))
			if len(nimmanager.getTranspondersTerrestrial(region)) < 1: # Only offer 'predefined transponder' if some transponders exist
				self.tuning_type.value = "single_transponder"
			else:
				self.list.append(self.typeOfTuningEntry)
			if self.tuning_type.value == "single_transponder":
				if nimmanager.nim_slots[int(self.satfinder_scan_nims.value)].canBeCompatible("DVB-T2"):
					self.systemEntryTerr = getConfigListEntry(_('System'), self.scan_ter.system)
					self.list.append(self.systemEntryTerr)
				else:
					self.scan_ter.system.value = eDVBFrontendParametersTerrestrial.System_DVB_T
				self.typeOfInputEntry = getConfigListEntry(_("Use frequency or channel"), self.scan_input_as)
				if self.ter_channel_input:
					self.list.append(self.typeOfInputEntry)
				else:
					self.scan_input_as.value = self.scan_input_as.choices[0]
				if self.ter_channel_input and self.scan_input_as.value == "channel":
					channel = getChannelNumber(self.scan_ter.frequency.value*1000, self.ter_tnumber)
					if channel:
						self.scan_ter.channel.value = int(channel.replace("+","").replace("-",""))
					self.list.append(getConfigListEntry(_("Channel"), self.scan_ter.channel))
				else:
					prev_val = self.scan_ter.frequency.value
					self.scan_ter.frequency.value = channel2frequency(self.scan_ter.channel.value, self.ter_tnumber)/1000
					if self.scan_ter.frequency.value == 474000:
						self.scan_ter.frequency.value = prev_val
					self.list.append(getConfigListEntry(_("Frequency (kHz)"), self.scan_ter.frequency))
				self.list.append(getConfigListEntry(_("Inversion"), self.scan_ter.inversion))
				self.list.append(getConfigListEntry(_("Bandwidth"), self.scan_ter.bandwidth))
				self.list.append(getConfigListEntry(_("Code rate HP"), self.scan_ter.fechigh))
				self.list.append(getConfigListEntry(_("Code rate LP"), self.scan_ter.feclow))
				self.list.append(getConfigListEntry(_("Modulation"), self.scan_ter.modulation))
				self.list.append(getConfigListEntry(_("Transmission mode"), self.scan_ter.transmission))
				self.list.append(getConfigListEntry(_("Guard interval"), self.scan_ter.guard))
				self.list.append(getConfigListEntry(_("Hierarchy info"), self.scan_ter.hierarchy))
				if self.scan_ter.system.value == eDVBFrontendParametersTerrestrial.System_DVB_T2:
					self.list.append(getConfigListEntry(_('PLP ID'), self.scan_ter.plp_id))
			elif self.tuning_type.value == "predefined_transponder":
				self.scan_nims.value = self.satfinder_scan_nims.value
				self.predefinedTerrTranspondersList()
				self.preDefTransponderTerrEntry = getConfigListEntry(_('Transponder'), self.TerrestrialTransponders)
				self.list.append(self.preDefTransponderTerrEntry)
		elif self.DVB_type.value == "ATSC":
			self.typeOfTuningEntry = getConfigListEntry(_('Tune'), self.tuning_type)
			if len(nimmanager.getTranspondersATSC(int(self.satfinder_scan_nims.value))) < 1: # only show 'predefined transponder' if transponders exist
				self.tuning_type.value = "single_transponder"
			else:
				self.list.append(self.typeOfTuningEntry)
			if self.tuning_type.value == "single_transponder":
				self.systemEntryATSC = getConfigListEntry(_("System"), self.scan_ats.system)
				self.list.append(self.systemEntryATSC)
				self.list.append(getConfigListEntry(_("Frequency"), self.scan_ats.frequency))
				self.list.append(getConfigListEntry(_("Inversion"), self.scan_ats.inversion))
				self.list.append(getConfigListEntry(_("Modulation"), self.scan_ats.modulation))
			elif self.tuning_type.value == "predefined_transponder":
				#FIXME add region
				self.scan_nims.value = self.satfinder_scan_nims.value
				self.predefinedATSCTranspondersList()
				self.preDefTransponderAtscEntry = getConfigListEntry(_('Transponder'), self.ATSCTransponders)
				self.list.append(self.preDefTransponderAtscEntry)
		self["config"].list = self.list
		self["config"].l.setList(self.list)

	def createConfig(self, foo):
		self.tuning_type = ConfigSelection(default = "predefined_transponder", choices = [("single_transponder", _("User defined transponder")), ("predefined_transponder", _("Predefined transponder"))])
		self.orbital_position = 192
		if self.frontendData and 'orbital_position' in self.frontendData:
			self.orbital_position = self.frontendData['orbital_position']
		ScanSetup.createConfig(self, self.frontendData)

		# The following are updated in self.newConfig(). Do not add here.
		# self.scan_sat.system, self.tuning_type, self.scan_input_as, self.scan_ats.system, self.DVB_type, self.scan_ter.system, self.satfinder_scan_nims, self.tuning_sat
		for x in (self.scan_sat.frequency,
			self.scan_sat.inversion, self.scan_sat.symbolrate,
			self.scan_sat.polarization, self.scan_sat.fec, self.scan_sat.pilot,
			self.scan_sat.fec_s2, self.scan_sat.fec, self.scan_sat.modulation,
			self.scan_sat.rolloff,
			self.scan_sat.is_id, self.scan_sat.pls_mode, self.scan_sat.pls_code,
			self.scan_sat.t2mi_plp_id, self.scan_sat.t2mi_pid,
			self.scan_ter.channel, self.scan_ter.frequency, self.scan_ter.inversion,
			self.scan_ter.bandwidth, self.scan_ter.fechigh, self.scan_ter.feclow,
			self.scan_ter.modulation, self.scan_ter.transmission,
			self.scan_ter.guard, self.scan_ter.hierarchy, self.scan_ter.plp_id,
			self.scan_cab.frequency, self.scan_cab.inversion, self.scan_cab.symbolrate,
			self.scan_cab.modulation, self.scan_cab.fec,
			self.scan_ats.frequency, self.scan_ats.modulation, self.scan_ats.inversion):
			x.addNotifier(self.retune, initial_call = False)

		satfinder_nim_list = []
		for n in nimmanager.nim_slots:
			if not any([n.isCompatible(x) for x in "DVB-S", "DVB-T", "DVB-C", "ATSC"]):
				continue
			if n.config_mode  in ("loopthrough", "satposdepends", "nothing"):
				continue
			if n.isCompatible("DVB-S") and len(nimmanager.getSatListForNim(n.slot)) < 1:
				continue
			if n.isCompatible("DVB-S") and n.isFBCTuner() and not n.isFBCRoot():
				continue
			satfinder_nim_list.append((str(n.slot), n.friendly_full_description))
		self.satfinder_scan_nims = ConfigSelection(choices = satfinder_nim_list)
		if self.frontendData is not None and len(satfinder_nim_list) > 0: # open the plugin with the currently active NIM as default
			active_nim = self.frontendData.get("tuner_number", int(satfinder_nim_list[0][0]))
			if not nimmanager.nim_slots[active_nim].isFBCLink():
				self.satfinder_scan_nims.setValue(str(active_nim))

		self.feid = int(self.satfinder_scan_nims.value)

		self.satList = []
		self.scan_satselection = []
		for slot in nimmanager.nim_slots:
			if slot.isCompatible("DVB-S"):
				self.satList.append(nimmanager.getSatListForNim(slot.slot))
				self.scan_satselection.append(getConfigSatlist(self.orbital_position, self.satList[slot.slot]))
			else:
				self.satList.append(None)

		if self.frontendData:
			ttype = self.frontendData.get("tuner_type", "UNKNOWN")
			if ttype == "DVB-S" and self.predefinedTranspondersList(self.getSelectedSatIndex(self.feid)) is None and len(nimmanager.getTransponders(self.getSelectedSatIndex(self.feid), self.feid)) > 0:
				self.tuning_type.value = "single_transponder"
			elif ttype == "DVB-T" and self.predefinedTerrTranspondersList() is None and len(nimmanager.getTranspondersTerrestrial(nimmanager.getTerrestrialDescription(self.feid))) > 0:
				self.tuning_type.value = "single_transponder"
			elif ttype == "DVB-C" and self.predefinedCabTranspondersList() is None and len(nimmanager.getTranspondersCable(self.feid)) > 0:
				self.tuning_type.value = "single_transponder"
			elif ttype == "ATSC" and self.predefinedATSCTranspondersList() is None and len(nimmanager.getTranspondersATSC(self.feid)) > 0:
				self.tuning_type.value = "single_transponder"