def initOrbposConfigs(): choiceList = orbposChoicelist() maxEntries = len(choiceList) oldVal = config.plugins.epgsearch.getSavedValue().get('numorbpos') listShrank = oldVal is not None and int(oldVal) > maxEntries choices = [str(i) for i in range(maxEntries + 1)] config.plugins.epgsearch.numorbpos = ConfigSelection(choices, default="1") if listShrank: config.plugins.epgsearch.numorbpos.value = str(maxEntries) # If the list got smaller, try to preserve the values of as # many entries as possible in the new list. orbPosList = [] for name in (name for name in config.plugins.epgsearch.getSavedValue().keys() if isOrbposName(name)): setattr(config.plugins.epgsearch, name, ConfigSatlist(choiceList, default=orbposDisabled)) if listShrank: orbPosList.append((getattr(config.plugins.epgsearch, name), int(name[6:]))) if orbPosList: orbPosList.sort(key=lambda x: x[1]) orbPosList.sort(key=lambda x: int(x[0].value) == orbposDisabled) for i in range(min(maxEntries, len(orbPosList))): getattr(config.plugins.epgsearch, "orbpos" + str(i)).value = orbPosList[i][0].value
def updateOrbposConfig(save=False): choiceList = orbposChoicelist() updateNumOrbpos(choiceList, save) setChoiceList = None # Add any new items & update any existing ones for filt in range(int(config.plugins.epgsearch.numorbpos.value)): name = "orbpos" + str(filt) if hasattr(config.plugins.epgsearch, name): if setChoiceList is None: setChoiceList = [(str(orbpos), desc) for (orbpos, desc, flags) in choiceList] confItem = getattr(config.plugins.epgsearch, name) confItem.setChoices(setChoiceList, default=str(orbposDisabled)) else: setattr(config.plugins.epgsearch, name, ConfigSatlist(choiceList, default=orbposDisabled)) if save: doSave() return len(choiceList)
def createConfig(self, foo): global tuning if not tuning: tuning = ConfigSubsection() tuning.type = ConfigSelection( default = "manual_transponder", choices = { "manual_transponder" : _("Manual transponder"), "predefined_transponder" : _("Predefined transponder") } ) tuning.sat = ConfigSatlist(list=nimmanager.getRotorSatListForNim(self.feid)) tuning.sat.addNotifier(self.tuningSatChanged) self.updateTransponders() orb_pos = self.fe_data.get("orbital_position", None) if orb_pos is not None: for x in nimmanager.getRotorSatListForNim(self.feid): opos = str(orb_pos) if x[0] == orb_pos and tuning.sat.value != opos: tuning.sat.value = opos del self.fe_data["orbital_position"] ScanSetup.createConfig(self, self.fe_data)
def createConfig(self, frontendData): satlist = nimmanager.getRotorSatListForNim(self.feid) orb_pos = self.fe_data.get("orbital_position", None) orb_pos_str = str(orb_pos) self.tuning = ConfigSubsection() self.tuning.type = ConfigSelection( default = "manual_transponder", choices = { "manual_transponder" : _("Manual transponder"), "predefined_transponder" : _("Predefined transponder") } ) self.tuning.sat = ConfigSatlist(list = satlist) if orb_pos is not None: for sat in satlist: if sat[0] == orb_pos and self.tuning.sat.value != orb_pos_str: self.tuning.sat.value = orb_pos_str self.updateTransponders() defaultSat = { "orbpos": 192, "system": eDVBFrontendParametersSatellite.System_DVB_S, "frequency": 11836, "inversion": eDVBFrontendParametersSatellite.Inversion_Unknown, "symbolrate": 27500, "polarization": eDVBFrontendParametersSatellite.Polarisation_Horizontal, "fec": eDVBFrontendParametersSatellite.FEC_Auto, "fec_s2": eDVBFrontendParametersSatellite.FEC_9_10, "modulation": eDVBFrontendParametersSatellite.Modulation_QPSK } if frontendData is not None: ttype = frontendData.get("tuner_type", "UNKNOWN") defaultSat["system"] = frontendData.get("system", eDVBFrontendParametersSatellite.System_DVB_S) defaultSat["frequency"] = frontendData.get("frequency", 0) / 1000 defaultSat["inversion"] = frontendData.get("inversion", eDVBFrontendParametersSatellite.Inversion_Unknown) defaultSat["symbolrate"] = frontendData.get("symbol_rate", 0) / 1000 defaultSat["polarization"] = frontendData.get("polarization", eDVBFrontendParametersSatellite.Polarisation_Horizontal) if defaultSat["system"] == eDVBFrontendParametersSatellite.System_DVB_S2: defaultSat["fec_s2"] = frontendData.get("fec_inner", eDVBFrontendParametersSatellite.FEC_Auto) defaultSat["rolloff"] = frontendData.get("rolloff", eDVBFrontendParametersSatellite.RollOff_alpha_0_35) defaultSat["pilot"] = frontendData.get("pilot", eDVBFrontendParametersSatellite.Pilot_Unknown) else: defaultSat["fec"] = frontendData.get("fec_inner", eDVBFrontendParametersSatellite.FEC_Auto) defaultSat["modulation"] = frontendData.get("modulation", eDVBFrontendParametersSatellite.Modulation_QPSK) defaultSat["orbpos"] = frontendData.get("orbital_position", 0) self.scan_sat = ConfigSubsection() self.scan_sat.system = ConfigSelection(default = defaultSat["system"], choices = [ (eDVBFrontendParametersSatellite.System_DVB_S, _("DVB-S")), (eDVBFrontendParametersSatellite.System_DVB_S2, _("DVB-S2"))]) self.scan_sat.frequency = ConfigInteger(default = defaultSat["frequency"], limits = (1, 99999)) self.scan_sat.inversion = ConfigSelection(default = defaultSat["inversion"], choices = [ (eDVBFrontendParametersSatellite.Inversion_Off, _("Off")), (eDVBFrontendParametersSatellite.Inversion_On, _("On")), (eDVBFrontendParametersSatellite.Inversion_Unknown, _("Auto"))]) self.scan_sat.symbolrate = ConfigInteger(default = defaultSat["symbolrate"], limits = (1, 99999)) self.scan_sat.polarization = ConfigSelection(default = defaultSat["polarization"], choices = [ (eDVBFrontendParametersSatellite.Polarisation_Horizontal, _("horizontal")), (eDVBFrontendParametersSatellite.Polarisation_Vertical, _("vertical")), (eDVBFrontendParametersSatellite.Polarisation_CircularLeft, _("circular left")), (eDVBFrontendParametersSatellite.Polarisation_CircularRight, _("circular right"))]) self.scan_sat.fec = ConfigSelection(default = defaultSat["fec"], choices = [ (eDVBFrontendParametersSatellite.FEC_Auto, _("Auto")), (eDVBFrontendParametersSatellite.FEC_1_2, "1/2"), (eDVBFrontendParametersSatellite.FEC_2_3, "2/3"), (eDVBFrontendParametersSatellite.FEC_3_4, "3/4"), (eDVBFrontendParametersSatellite.FEC_5_6, "5/6"), (eDVBFrontendParametersSatellite.FEC_7_8, "7/8"), (eDVBFrontendParametersSatellite.FEC_None, _("None"))]) self.scan_sat.fec_s2 = ConfigSelection(default = defaultSat["fec_s2"], choices = [ (eDVBFrontendParametersSatellite.FEC_1_2, "1/2"), (eDVBFrontendParametersSatellite.FEC_2_3, "2/3"), (eDVBFrontendParametersSatellite.FEC_3_4, "3/4"), (eDVBFrontendParametersSatellite.FEC_3_5, "3/5"), (eDVBFrontendParametersSatellite.FEC_4_5, "4/5"), (eDVBFrontendParametersSatellite.FEC_5_6, "5/6"), (eDVBFrontendParametersSatellite.FEC_7_8, "7/8"), (eDVBFrontendParametersSatellite.FEC_8_9, "8/9"), (eDVBFrontendParametersSatellite.FEC_9_10, "9/10")]) self.scan_sat.modulation = ConfigSelection(default = defaultSat["modulation"], choices = [ (eDVBFrontendParametersSatellite.Modulation_QPSK, "QPSK"), (eDVBFrontendParametersSatellite.Modulation_8PSK, "8PSK")]) self.scan_sat.rolloff = ConfigSelection(default = defaultSat.get("rolloff", eDVBFrontendParametersSatellite.RollOff_alpha_0_35), choices = [ (eDVBFrontendParametersSatellite.RollOff_alpha_0_35, "0.35"), (eDVBFrontendParametersSatellite.RollOff_alpha_0_25, "0.25"), (eDVBFrontendParametersSatellite.RollOff_alpha_0_20, "0.20"), (eDVBFrontendParametersSatellite.RollOff_auto, _("Auto"))]) self.scan_sat.pilot = ConfigSelection(default = defaultSat.get("pilot", eDVBFrontendParametersSatellite.Pilot_Unknown), choices = [ (eDVBFrontendParametersSatellite.Pilot_Off, _("Off")), (eDVBFrontendParametersSatellite.Pilot_On, _("On")), (eDVBFrontendParametersSatellite.Pilot_Unknown, _("Auto"))])
def createConfig(self, frontendData): satlist = nimmanager.getRotorSatListForNim(self.feid) orb_pos = self.fe_data.get("orbital_position", None) self.tuning = ConfigSubsection() self.tuning.type = ConfigSelection(default="manual_transponder", choices={ "manual_transponder": _("Manual transponder"), "predefined_transponder": _("Predefined transponder") }) self.tuning.sat = ConfigSatlist(list=satlist) if orb_pos is not None: for x in satlist: opos = str(orb_pos) if x[0] == orb_pos and self.tuning.sat.value != opos: self.tuning.sat.value = opos del self.fe_data["orbital_position"] self.updateTransponders() defaultSat = { "orbpos": 192, "system": eDVBFrontendParametersSatellite.System_DVB_S, "frequency": 11836, "inversion": eDVBFrontendParametersSatellite.Inversion_Unknown, "symbolrate": 27500, "polarization": eDVBFrontendParametersSatellite.Polarisation_Horizontal, "fec": eDVBFrontendParametersSatellite.FEC_Auto, "fec_s2": eDVBFrontendParametersSatellite.FEC_9_10, "fec_s2x_qpsk": eDVBFrontendParametersSatellite.FEC_13_45, "fec_s2x_8psk": eDVBFrontendParametersSatellite.FEC_23_36, "fec_s2x_8apsk": eDVBFrontendParametersSatellite.FEC_5_9_L, "fec_s2x_16apsk": eDVBFrontendParametersSatellite.FEC_1_2_L, "fec_s2x_32apsk": eDVBFrontendParametersSatellite.FEC_2_3_L, "modulation": eDVBFrontendParametersSatellite.Modulation_QPSK, "modulation_s2x": eDVBFrontendParametersSatellite.Modulation_QPSK, "is_id": -1, "pls_mode": eDVBFrontendParametersSatellite.PLS_Unknown, "pls_code": 0 } if frontendData is not None: ttype = frontendData.get("tuner_type", "UNKNOWN") defaultSat["system"] = frontendData.get( "system", eDVBFrontendParametersSatellite.System_DVB_S) defaultSat["frequency"] = frontendData.get("frequency", 0) / 1000 defaultSat["inversion"] = frontendData.get( "inversion", eDVBFrontendParametersSatellite.Inversion_Unknown) defaultSat["symbolrate"] = frontendData.get("symbol_rate", 0) / 1000 defaultSat["polarization"] = frontendData.get( "polarization", eDVBFrontendParametersSatellite.Polarisation_Horizontal) defaultSat["orbpos"] = frontendData.get("orbital_position", 0) defaultSat["modulation"] = frontendData.get( "modulation", eDVBFrontendParametersSatellite.Modulation_QPSK) defaultSat["modulation_s2x"] = frontendData.get( "modulation", eDVBFrontendParametersSatellite.Modulation_QPSK) if defaultSat[ "modulation"] > eDVBFrontendParametersSatellite.Modulation_8PSK: defaultSat[ "modulation"] = eDVBFrontendParametersSatellite.Modulation_8PSK if defaultSat[ "system"] == eDVBFrontendParametersSatellite.System_DVB_S2: defaultSat["fec_s2"] = frontendData.get( "fec_inner", eDVBFrontendParametersSatellite.FEC_Auto) elif defaultSat[ "system"] == eDVBFrontendParametersSatellite.System_DVB_S2X: if defaultSat[ "modulation_s2x"] == eDVBFrontendParametersSatellite.Modulation_QPSK: defaultSat["fec_s2x_qpsk"] = frontendData.get( "fec_inner", eDVBFrontendParametersSatellite.FEC_13_45) elif defaultSat[ "modulation_s2x"] == eDVBFrontendParametersSatellite.Modulation_8PSK: defaultSat["fec_s2x_8psk"] = frontendData.get( "fec_inner", eDVBFrontendParametersSatellite.FEC_23_36) elif defaultSat[ "modulation_s2x"] == eDVBFrontendParametersSatellite.Modulation_8APSK: defaultSat["fec_s2x_8apsk"] = frontendData.get( "fec_inner", eDVBFrontendParametersSatellite.FEC_5_9_L) elif defaultSat[ "modulation_s2x"] == eDVBFrontendParametersSatellite.Modulation_16APSK: defaultSat["fec_s2x_16apsk"] = frontendData.get( "fec_inner", eDVBFrontendParametersSatellite.FEC_1_2_L) elif defaultSat[ "modulation_s2x"] == eDVBFrontendParametersSatellite.Modulation_32APSK: defaultSat["fec_s2x_32apsk"] = frontendData.get( "fec_inner", eDVBFrontendParametersSatellite.FEC_2_3_L) else: defaultSat["fec"] = frontendData.get( "fec_inner", eDVBFrontendParametersSatellite.FEC_Auto) if defaultSat["system"] in ( eDVBFrontendParametersSatellite.System_DVB_S2, eDVBFrontendParametersSatellite.System_DVB_S2X): defaultSat["rolloff"] = frontendData.get( "rolloff", eDVBFrontendParametersSatellite.RollOff_alpha_0_35) defaultSat["pilot"] = frontendData.get( "pilot", eDVBFrontendParametersSatellite.Pilot_Unknown) defaultSat["is_id"] = frontendData.get("is_id", defaultSat["is_id"]) defaultSat["pls_mode"] = frontendData.get( "pls_mode", defaultSat["pls_mode"]) defaultSat["pls_code"] = frontendData.get( "pls_code", defaultSat["pls_code"]) self.scan_sat = ConfigSubsection() sat_choices = [ (eDVBFrontendParametersSatellite.System_DVB_S, _("DVB-S")), (eDVBFrontendParametersSatellite.System_DVB_S2, _("DVB-S2")) ] sat_choices_dvbs2x = [ (eDVBFrontendParametersSatellite.System_DVB_S, _("DVB-S")), (eDVBFrontendParametersSatellite.System_DVB_S2, _("DVB-S2")), (eDVBFrontendParametersSatellite.System_DVB_S2X, _("DVB-S2X")) ] self.scan_sat.system = ConfigSelection(default=defaultSat["system"], choices=sat_choices) self.scan_sat.system_dvbs2x = ConfigSelection( default=defaultSat["system"], choices=sat_choices_dvbs2x) self.scan_sat.frequency = ConfigInteger( default=defaultSat["frequency"], limits=(1, 99999)) self.scan_sat.inversion = ConfigSelection( default=defaultSat["inversion"], choices=[(eDVBFrontendParametersSatellite.Inversion_Off, _("Off")), (eDVBFrontendParametersSatellite.Inversion_On, _("On")), (eDVBFrontendParametersSatellite.Inversion_Unknown, _("Auto"))]) self.scan_sat.symbolrate = ConfigInteger( default=defaultSat["symbolrate"], limits=(1, 99999)) self.scan_sat.polarization = ConfigSelection( default=defaultSat["polarization"], choices=[ (eDVBFrontendParametersSatellite.Polarisation_Horizontal, _("horizontal")), (eDVBFrontendParametersSatellite.Polarisation_Vertical, _("vertical")), (eDVBFrontendParametersSatellite.Polarisation_CircularLeft, _("circular left")), (eDVBFrontendParametersSatellite.Polarisation_CircularRight, _("circular right")) ]) self.scan_sat.fec = ConfigSelection( default=defaultSat["fec"], choices=[(eDVBFrontendParametersSatellite.FEC_Auto, _("Auto")), (eDVBFrontendParametersSatellite.FEC_1_2, "1/2"), (eDVBFrontendParametersSatellite.FEC_2_3, "2/3"), (eDVBFrontendParametersSatellite.FEC_3_4, "3/4"), (eDVBFrontendParametersSatellite.FEC_5_6, "5/6"), (eDVBFrontendParametersSatellite.FEC_7_8, "7/8"), (eDVBFrontendParametersSatellite.FEC_None, _("None"))]) self.scan_sat.fec_s2 = ConfigSelection( default=defaultSat["fec_s2"], choices=[(eDVBFrontendParametersSatellite.FEC_1_2, "1/2"), (eDVBFrontendParametersSatellite.FEC_2_3, "2/3"), (eDVBFrontendParametersSatellite.FEC_3_4, "3/4"), (eDVBFrontendParametersSatellite.FEC_3_5, "3/5"), (eDVBFrontendParametersSatellite.FEC_4_5, "4/5"), (eDVBFrontendParametersSatellite.FEC_5_6, "5/6"), (eDVBFrontendParametersSatellite.FEC_7_8, "7/8"), (eDVBFrontendParametersSatellite.FEC_8_9, "8/9"), (eDVBFrontendParametersSatellite.FEC_9_10, "9/10")]) self.scan_sat.fec_s2x_qpsk = ConfigSelection( default=defaultSat["fec_s2x_qpsk"], choices=[(eDVBFrontendParametersSatellite.FEC_13_45, "13/45"), (eDVBFrontendParametersSatellite.FEC_9_20, "9/20"), (eDVBFrontendParametersSatellite.FEC_11_20, "11/20")]) self.scan_sat.fec_s2x_8psk = ConfigSelection( default=defaultSat["fec_s2x_8psk"], choices=[(eDVBFrontendParametersSatellite.FEC_23_36, "23/36"), (eDVBFrontendParametersSatellite.FEC_25_36, "25/36"), (eDVBFrontendParametersSatellite.FEC_13_18, "13/28")]) self.scan_sat.fec_s2x_8apsk = ConfigSelection( default=defaultSat["fec_s2x_8apsk"], choices=[(eDVBFrontendParametersSatellite.FEC_5_9_L, "5/9-L"), (eDVBFrontendParametersSatellite.FEC_26_45_L, "26/45-L")]) self.scan_sat.fec_s2x_16apsk = ConfigSelection( default=defaultSat["fec_s2x_16apsk"], choices=[(eDVBFrontendParametersSatellite.FEC_1_2_L, "1/2-L"), (eDVBFrontendParametersSatellite.FEC_8_15_L, "8/15-L"), (eDVBFrontendParametersSatellite.FEC_5_9_L, "5/9-L"), (eDVBFrontendParametersSatellite.FEC_26_45, "26/45"), (eDVBFrontendParametersSatellite.FEC_3_5, "3/5"), (eDVBFrontendParametersSatellite.FEC_3_5_L, "3/5-L"), (eDVBFrontendParametersSatellite.FEC_28_45, "28/45"), (eDVBFrontendParametersSatellite.FEC_23_36, "23/36"), (eDVBFrontendParametersSatellite.FEC_2_3_L, "2/3-L"), (eDVBFrontendParametersSatellite.FEC_25_36, "25/36"), (eDVBFrontendParametersSatellite.FEC_13_18, "13/18"), (eDVBFrontendParametersSatellite.FEC_7_9, "7/9"), (eDVBFrontendParametersSatellite.FEC_77_90, "77/90")]) self.scan_sat.fec_s2x_32apsk = ConfigSelection( default=defaultSat["fec_s2x_32apsk"], choices=[(eDVBFrontendParametersSatellite.FEC_2_3_L, "2/3-L"), (eDVBFrontendParametersSatellite.FEC_32_45, "32/45"), (eDVBFrontendParametersSatellite.FEC_11_15, "11/15"), (eDVBFrontendParametersSatellite.FEC_7_9, "7/9")]) self.scan_sat.modulation = ConfigSelection( default=defaultSat["modulation"], choices=[(eDVBFrontendParametersSatellite.Modulation_QPSK, "QPSK"), (eDVBFrontendParametersSatellite.Modulation_8PSK, "8PSK") ]) self.scan_sat.modulation_dvbs2x = ConfigSelection( default=defaultSat["modulation_s2x"], choices=[ (eDVBFrontendParametersSatellite.Modulation_QPSK, "QPSK"), (eDVBFrontendParametersSatellite.Modulation_8PSK, "8PSK"), (eDVBFrontendParametersSatellite.Modulation_8APSK, "8APSK"), (eDVBFrontendParametersSatellite.Modulation_16APSK, "16APSK"), (eDVBFrontendParametersSatellite.Modulation_32APSK, "32APSK") ]) self.scan_sat.rolloff = ConfigSelection( default=defaultSat.get( "rolloff", eDVBFrontendParametersSatellite.RollOff_alpha_0_35), choices=[ (eDVBFrontendParametersSatellite.RollOff_alpha_0_35, "0.35"), (eDVBFrontendParametersSatellite.RollOff_alpha_0_25, "0.25"), (eDVBFrontendParametersSatellite.RollOff_alpha_0_20, "0.20") ]) self.scan_sat.pilot = ConfigSelection( default=defaultSat.get( "pilot", eDVBFrontendParametersSatellite.Pilot_Unknown), choices=[(eDVBFrontendParametersSatellite.Pilot_Off, _("Off")), (eDVBFrontendParametersSatellite.Pilot_On, _("On")), (eDVBFrontendParametersSatellite.Pilot_Unknown, _("Auto")) ]) self.scan_sat.is_id = ConfigInteger( default=defaultSat["is_id"] if defaultSat["is_id"] != -1 else 0, limits=(0, 255)) self.scan_sat.is_id_bool = ConfigSelection( default=defaultSat["is_id"] != -1, choices=[(True, _("Multistream")), (False, _("Ordinary"))]) self.scan_sat.pls_mode = ConfigSelection( default=defaultSat["pls_mode"], choices=[(eDVBFrontendParametersSatellite.PLS_Root, _("Root")), (eDVBFrontendParametersSatellite.PLS_Gold, _("Gold")), (eDVBFrontendParametersSatellite.PLS_Combo, _("Combo")), (eDVBFrontendParametersSatellite.PLS_Unknown, _("Auto"))]) self.scan_sat.pls_code = ConfigInteger(default=defaultSat["pls_code"], limits=(0, 262143))