X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/83fa9db5a2a4acb79d71f9a662f086d2931c63ae..c9faacfea68f90597fb82504790dc1f7d7b71f3f:/lib/python/Screens/ScanSetup.py diff --git a/lib/python/Screens/ScanSetup.py b/lib/python/Screens/ScanSetup.py index 32e19f55..ab110a24 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -1,11 +1,13 @@ from Screen import Screen -from ServiceScan import * +from Screens.DefaultWizard import DefaultWizard +from ServiceScan import ServiceScan from Components.config import config, ConfigSubsection, ConfigSelection, \ - ConfigYesNo, ConfigInteger, getConfigListEntry, ConfigSlider, ConfigSatlist, ConfigEnableDisable -from Components.ActionMap import NumberActionMap -from Components.ConfigList import ConfigList, ConfigListScreen + ConfigYesNo, ConfigInteger, getConfigListEntry, ConfigSlider, ConfigEnableDisable +from Components.ActionMap import NumberActionMap, ActionMap +from Components.ConfigList import ConfigListScreen from Components.NimManager import nimmanager, getConfigSatlist from Components.Label import Label +from Tools.Directories import resolveFilename, SCOPE_DEFAULTPARTITIONMOUNTDIR, SCOPE_DEFAULTDIR, SCOPE_DEFAULTPARTITION from Screens.MessageBox import MessageBox from enigma import eTimer, eDVBFrontendParametersSatellite, eComponentScan, \ eDVBSatelliteEquipmentControl, eDVBFrontendParametersTerrestrial, \ @@ -84,10 +86,12 @@ def getInitialTransponderList(tlist, pos): parm.symbol_rate = x[2] parm.polarisation = x[3] parm.fec = x[4] - parm.inversion = 2 # AUTO + parm.inversion = x[7] parm.orbital_position = pos parm.system = x[5] parm.modulation = x[6] + parm.rolloff = x[8] + parm.pilot = x[9] tlist.append(parm) def getInitialCableTransponderList(tlist, nim): @@ -156,6 +160,8 @@ class CableTransponderSearchSupport: def cableTransponderSearchSessionClosed(self, *val): print "cableTransponderSearchSessionClosed, val", val + self.cable_search_container.appClosed.remove(self.cableTransponderSearchClosed) + self.cable_search_container.dataAvail.remove(self.getCableTransponderData) self.cable_search_container = None self.cable_search_session = None if val and len(val) and val[0]: @@ -201,8 +207,8 @@ class CableTransponderSearchSupport: return self.__tlist = [ ] self.cable_search_container = eConsoleAppContainer() - self.cable_search_container.appClosed.get().append(self.cableTransponderSearchClosed) - self.cable_search_container.dataAvail.get().append(self.getCableTransponderData) + self.cable_search_container.appClosed.append(self.cableTransponderSearchClosed) + self.cable_search_container.dataAvail.append(self.getCableTransponderData) cableConfig = config.Nims[nim_idx].cable cmd = "tda1002x --init --scan --verbose --wakeup --inv 2 --bus " #FIXMEEEEEE hardcoded i2c devices for dm7025 and dm8000 @@ -273,6 +279,27 @@ class CableTransponderSearchSupport: tmpstr += "\n\n..." self.cable_search_session = self.session.openWithCallback(self.cableTransponderSearchSessionClosed, MessageBox, tmpstr, MessageBox.TYPE_INFO) +class DefaultSatLists(DefaultWizard): + def __init__(self, session, silent = True, showSteps = False): + self.xmlfile = "defaultsatlists.xml" + DefaultWizard.__init__(self, session, silent, showSteps, neededTag = "services") + print "configuredSats:", nimmanager.getConfiguredSats() + + def setDirectory(self): + self.directory = [] + self.directory.append(resolveFilename(SCOPE_DEFAULTDIR)) + import os + os.system("mount %s %s" % (resolveFilename(SCOPE_DEFAULTPARTITION), resolveFilename(SCOPE_DEFAULTPARTITIONMOUNTDIR))) + self.directory.append(resolveFilename(SCOPE_DEFAULTPARTITIONMOUNTDIR)) + + def statusCallback(self, status, progress): + print "statusCallback:", status, progress + from Components.DreamInfoHandler import DreamInfoHandler + if status == DreamInfoHandler.STATUS_DONE: + self["text"].setText(_("The installation of the default services lists is finished.") + "\n\n" + _("Please press OK to continue.")) + self.markDone() + self.disableKeys = False + class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): def __init__(self, session): Screen.__init__(self, session) @@ -298,7 +325,7 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): }, -2) self.statusTimer = eTimer() - self.statusTimer.timeout.get().append(self.updateStatus) + self.statusTimer.callback.append(self.updateStatus) #self.statusTimer.start(5000, True) self.list = [] @@ -333,6 +360,7 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): self.typeOfScanEntry = None self.systemEntry = None + self.modulationEntry = None nim = nimmanager.nim_slots[index_to_scan] if nim.isCompatible("DVB-S"): self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), self.scan_type) @@ -344,6 +372,7 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), self.scan_typeterrestrial) self.list.append(self.typeOfScanEntry) + self.scan_networkScan.value = False if nim.isCompatible("DVB-S"): if self.scan_type.value == "single_transponder": self.updateSatList() @@ -362,38 +391,34 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): self.list.append(getConfigListEntry(_("FEC"), self.scan_sat.fec)) elif self.scan_sat.system.value == "dvb-s2": self.list.append(getConfigListEntry(_("FEC"), self.scan_sat.fec_s2)) - self.list.append(getConfigListEntry(_('Modulation'), self.scan_sat.modulation)) - self.list.append(getConfigListEntry(_("Network scan"), self.scan_networkScan)) + self.modulationEntry = getConfigListEntry(_('Modulation'), self.scan_sat.modulation) + self.list.append(self.modulationEntry) + self.list.append(getConfigListEntry(_('Rolloff'), self.scan_sat.rolloff)) + if self.scan_sat.modulation.value == "8psk": + self.list.append(getConfigListEntry(_('Pilot'), self.scan_sat.pilot)) elif self.scan_type.value == "single_satellite": self.updateSatList() print self.scan_satselection[index_to_scan] self.list.append(getConfigListEntry(_("Satellite"), self.scan_satselection[index_to_scan])) - self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices)) - elif self.scan_type.value == "multisat": - # if (norotor) + self.scan_networkScan.value = True + elif self.scan_type.value.find("multisat") != -1: tlist = [] SatList = nimmanager.getSatListForNim(index_to_scan) - self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices)) for x in SatList: if self.Satexists(tlist, x[0]) == 0: tlist.append(x[0]) - sat = ConfigEnableDisable(default = True) + sat = ConfigEnableDisable(default = self.scan_type.value.find("_yes") != -1 and True or False) configEntry = getConfigListEntry(nimmanager.getSatDescription(x[0]), sat) self.list.append(configEntry) self.multiscanlist.append((x[0], sat)) - # if (rotor): - # for sat in nimmanager.satList: - # self.list.append(getConfigListEntry(sat[1], self.scan_scansat[sat[0]])) + self.scan_networkScan.value = True elif nim.isCompatible("DVB-C"): if self.scan_typecable.value == "single_transponder": self.list.append(getConfigListEntry(_("Frequency"), self.scan_cab.frequency)) - self.list.append(getConfigListEntry(_("Inversions"), self.scan_cab.inversion)) + 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)) - self.list.append(getConfigListEntry(_("Network scan"), self.scan_networkScan)) - elif self.scan_typecable.value == "complete": - self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices)) elif nim.isCompatible("DVB-T"): if self.scan_typeterrestrial.value == "single_transponder": self.list.append(getConfigListEntry(_("Frequency"), self.scan_ter.frequency)) @@ -405,23 +430,9 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): self.list.append(getConfigListEntry(_("Transmission mode"), self.scan_ter.transmission)) self.list.append(getConfigListEntry(_("Guard interval mode"), self.scan_ter.guard)) self.list.append(getConfigListEntry(_("Hierarchy mode"), self.scan_ter.hierarchy)) - self.list.append(getConfigListEntry(_("Network scan"), self.scan_networkScan)) - elif self.scan_typeterrestrial.value == "complete": - self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices)) - -# if (nim.isCompatible("DVB-S") and self.scan_type.type == "single_transponder") or \ -# (nim.isCompatbile("DVB-C") and self.scan_typecable.type == "single_transponder") or \ -# (nim.isCompatible("DVB-T") and self.scan_typeterrestrial.type == "single_transponder"): -# self.configElementSNR = getConfigListEntry(_("SNR"), self.scan_snr) -# self.list.append(self.configElementSNR) -# self.configElementACG = getConfigListEntry(_("AGC"), self.scan_agc) -# self.list.append(self.configElementACG) -# self.configElementBER = getConfigListEntry(_("BER"), self.scan_ber) -# self.list.append(self.configElementBER) -# self.statusTimer.start(500, False) -# else: -# self.statusTimer.stop() - + self.list.append(getConfigListEntry(_("Network scan"), self.scan_networkScan)) + self.list.append(getConfigListEntry(_("Clear before scan"), self.scan_clearallservices)) + self.list.append(getConfigListEntry(_("Only Free scan"), self.scan_onlyfree)) self["config"].list = self.list self["config"].l.setList(self.list) @@ -436,7 +447,8 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): print "cur is", cur if cur == self.typeOfScanEntry or \ cur == self.tunerEntry or \ - cur == self.systemEntry: + cur == self.systemEntry or \ + (self.modulationEntry and self.systemEntry[1].value == "dvb-s2" and cur == self.modulationEntry): self.createSetup() def createConfig(self, frontendData): @@ -480,10 +492,12 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): defaultSat["inversion"] = {"INVERSION_OFF": "off", "INVERSION_ON": "on", "INVERSION_AUTO": "auto"}[frontendData.get("inversion", "INVERSION_AUTO")] defaultSat["symbolrate"] = int(frontendData.get("symbol_rate", 0) / 1000) defaultSat["polarization"] = {"HORIZONTAL": "horizontal", "VERTICAL": "vertical", "CIRCULAR_LEFT": "circular_left", "CIRCULAR_RIGHT": "circular_right", "UNKNOWN": None}[frontendData.get("polarization", "HORIZONTAL")] - + if frontendData.get("system", "DVB-S") == "DVB-S2": defaultSat["fec_s2"] = {"FEC_1_2": "1_2", "FEC_2_3": "2_3", "FEC_3_4": "3_4", "FEC_4_5": "4_5", "FEC_5_6": "5_6", "FEC_7_8": "7_8", "FEC_8_9": "8_9", "FEC_9_10": "9_10"} \ [frontendData.get("fec_inner", "FEC_AUTO")] + defaultSat["rolloff"] = {"ROLLOFF_0_35" : "0_35", "ROLLOFF_0_25" : "0_25", "ROLLOFF_0_20" : "0_20"}[frontendData.get("rolloff", "ROLLOFF_0_35")] + defaultSat["pilot"] = {"PILOT_ON" : "on", "PILOT_OFF" : "off", "PILOT_AUTO" : "auto"}[frontendData.get("pilot", "PILOT_AUTO")] else: defaultSat["fec"] = {"FEC_AUTO": "auto", "FEC_1_2": "1_2", "FEC_2_3": "2_3", "FEC_3_4": "3_4", "FEC_5_6": "5_6", "FEC_7_8": "7_8", "FEC_NONE": "none"} \ [frontendData.get("fec_inner", "FEC_AUTO")] @@ -501,10 +515,11 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): self.scan_cab = ConfigSubsection() self.scan_ter = ConfigSubsection() - self.scan_type = ConfigSelection(default = "single_transponder", choices = [("single_transponder", _("Single transponder")), ("single_satellite", _("Single satellite")), ("multisat", _("Multisat"))]) + self.scan_type = ConfigSelection(default = "single_transponder", choices = [("single_transponder", _("Single transponder")), ("single_satellite", _("Single satellite")), ("multisat", _("Multisat")), ("multisat_yes", _("Multisat"))]) self.scan_typecable = ConfigSelection(default = "single_transponder", choices = [("single_transponder", _("Single transponder")), ("complete", _("Complete"))]) self.scan_typeterrestrial = ConfigSelection(default = "single_transponder", choices = [("single_transponder", _("Single transponder")), ("complete", _("Complete"))]) self.scan_clearallservices = ConfigSelection(default = "no", choices = [("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (keep feeds)"))]) + self.scan_onlyfree = ConfigYesNo(default = False) self.scan_networkScan = ConfigYesNo(default = False) nim_list = [] @@ -532,6 +547,8 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): self.scan_sat.fec = ConfigSelection(default = defaultSat["fec"], choices = [("auto", _("Auto")), ("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("none", _("None"))]) self.scan_sat.fec_s2 = ConfigSelection(default = defaultSat["fec_s2"], choices = [("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("3_5", "3/5"), ("4_5", "4/5"), ("5_6", "5/6"), ("7_8", "7/8"), ("8_9", "8/9"), ("9_10", "9/10")]) self.scan_sat.modulation = ConfigSelection(default = defaultSat["modulation"], choices = [("qpsk", "QPSK"), ("8psk", "8PSK")]) + self.scan_sat.rolloff = ConfigSelection(default = defaultSat.get("rolloff", "0_35"), choices = [("0_35", "0.35"), ("0_25", "0.25"), ("0_20", "0.20")]) + self.scan_sat.pilot = ConfigSelection(default = defaultSat.get("pilot", "auto"), choices = [("off", _("off")), ("on", _("on")), ("auto", _("Auto"))]) # cable self.scan_cab.frequency = ConfigInteger(default = defaultCab["frequency"], limits = (50, 999)) @@ -591,8 +608,8 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): "none": 15 } - def addSatTransponder(self, tlist, frequency, symbol_rate, polarisation, fec, inversion, orbital_position, system, modulation): - print "Add Sat: frequ: " + str(frequency) + " symbol: " + str(symbol_rate) + " pol: " + str(polarisation) + " fec: " + str(self.fecmap[fec]) + " inversion: " + str(inversion) + " modulation: " + str(modulation) + " system: " + str(system) + def addSatTransponder(self, tlist, frequency, symbol_rate, polarisation, fec, inversion, orbital_position, system, modulation, rolloff, pilot): + print "Add Sat: frequ: " + str(frequency) + " symbol: " + str(symbol_rate) + " pol: " + str(polarisation) + " fec: " + str(self.fecmap[fec]) + " inversion: " + str(inversion) + " modulation: " + str(modulation) + " system: " + str(system) + " rolloff" + str(rolloff) + " pilot" + str(pilot) print "orbpos: " + str(orbital_position) parm = eDVBFrontendParametersSatellite() if modulation == 1: @@ -606,6 +623,8 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): parm.fec = self.fecmap[fec] parm.inversion = inversion parm.orbital_position = int(orbital_position) + parm.rolloff = int(rolloff) + parm.pilot = int(pilot) tlist.append(parm) def addCabTransponder(self, tlist, frequency, symbol_rate, modulation, fec, inversion): @@ -624,9 +643,8 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): def keyGo(self): tlist = [] flags = None - extFlags = True - startScan = True + removeAll = True index_to_scan = int(self.scan_nims.value) if self.scan_nims == [ ]: @@ -660,13 +678,14 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): self.scan_sat.inversion.index, orbpos, self.scan_sat.system.index, - self.scan_sat.modulation.index) - flags = self.scan_networkScan.value and eComponentScan.scanNetworkSearch or 0 - extFlags = False + self.scan_sat.modulation.index, + self.scan_sat.rolloff.index, + self.scan_sat.pilot.index) + 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 == "multisat": + elif self.scan_type.value.find("multisat") != -1: SatList = nimmanager.getSatListForNim(index_to_scan) for x in self.multiscanlist: if x[1].value: @@ -681,8 +700,7 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): self.scan_cab.modulation.index + 1, fec, self.scan_cab.inversion.index) - flags = self.scan_networkScan.value and eComponentScan.scanNetworkSearch or 0 - extFlags = False + removeAll = False elif self.scan_typecable.value == "complete": if config.Nims[index_to_scan].cable.scan_type.value == "provider": getInitialCableTransponderList(tlist, index_to_scan) @@ -701,21 +719,24 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): transmission = self.scan_ter.transmission.index, guard = self.scan_ter.guard.index, hierarchy = self.scan_ter.hierarchy.index) - flags = self.scan_networkScan.value and eComponentScan.scanNetworkSearch or 0 - extFlags = False + removeAll = False elif self.scan_typeterrestrial.value == "complete": getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(index_to_scan)) - if flags is None: - flags = eComponentScan.scanNetworkSearch + 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 extFlags: - tmp = self.scan_clearallservices.value - if tmp == "yes": - flags |= eComponentScan.scanRemoveServices - elif tmp == "yes_hold_feeds": - flags |= eComponentScan.scanRemoveServices - flags |= eComponentScan.scanDontRemoveFeeds + if self.scan_onlyfree.value: + flags |= eComponentScan.scanOnlyFree for x in self["config"].list: x[1].save() @@ -756,18 +777,6 @@ class ScanSimple(ConfigListScreen, Screen, CableTransponderSearchSupport): def getNetworksForNim(self, nim): if nim.isCompatible("DVB-S"): networks = nimmanager.getSatListForNim(nim.slot) -# the original code took "loopthrough" etc. into account. Do we need this? -# if nimmanager.getNimConfigMode(1) in ["loopthrough", "satposdepends", "equal", "nothing"]: -# return False -# sec = eDVBSatelliteEquipmentControl.getInstance() -# if sec is not None: -# exclusive_satellites = sec.get_exclusive_satellites(0,1) -# if len(exclusive_satellites) == 2: -# return False -# idx = exclusive_satellites[0]+1 -# exclusive_nim_sats = exclusive_satellites[idx+1:idx+1+exclusive_satellites[idx]] -# if len(exclusive_nim_sats): -# return True elif not nim.empty: networks = [ nim.type ] # "DVB-C" or "DVB-T". TODO: seperate networks for different C/T tuners, if we want to support that. else: @@ -839,7 +848,6 @@ class ScanSimple(ConfigListScreen, Screen, CableTransponderSearchSupport): self.buildTransponderList() def buildTransponderList(self): # this method is called multiple times because of asynchronous stuff - print "buildTransponderList" APPEND_NOW = 0 SEARCH_CABLE_TRANSPONDERS = 1 action = APPEND_NOW