diff options
| author | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-05-08 12:55:10 +0000 |
|---|---|---|
| committer | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-05-08 12:55:10 +0000 |
| commit | 9df197b0346cdea53967bf9ed578ff30e2424100 (patch) | |
| tree | 3a8401ade97504263a480a5a170a338cf332edb3 /lib | |
| parent | 4eff668d8019ed9255d72b4373f6b1053231f129 (diff) | |
| download | enigma2-9df197b0346cdea53967bf9ed578ff30e2424100.tar.gz enigma2-9df197b0346cdea53967bf9ed578ff30e2424100.zip | |
add ability to select in scan what is todo with existing services (Clear before scan)
a) "yes" means remove all services and transponders for this sat position / all selected sat positions
b) "no" means hold all services and transponders for this sat position / all selected sat positions
this resets all old new found flags (incremental scan)
c) "yes (hold feeds) means the same as a) but hold all feed services/transponders
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/components/scan.h | 2 | ||||
| -rw-r--r-- | lib/dvb/scan.cpp | 81 | ||||
| -rw-r--r-- | lib/dvb/scan.h | 2 | ||||
| -rw-r--r-- | lib/python/Screens/ScanSetup.py | 57 |
4 files changed, 130 insertions, 12 deletions
diff --git a/lib/components/scan.h b/lib/components/scan.h index 9ce6539f..5a3ce492 100644 --- a/lib/components/scan.h +++ b/lib/components/scan.h @@ -45,7 +45,7 @@ public: void addInitial(const eDVBFrontendParametersTerrestrial &p); /* please keep the flags in sync with lib/dvb/scan.h ! */ - enum { scanNetworkSearch=1 }; + enum { scanNetworkSearch=1, scanRemoveServices=4, scanDontRemoveFeeds=8 }; int start(int feid, int flags=0); }; diff --git a/lib/dvb/scan.cpp b/lib/dvb/scan.cpp index e722b3c5..01b3cd32 100644 --- a/lib/dvb/scan.cpp +++ b/lib/dvb/scan.cpp @@ -15,6 +15,7 @@ #include <lib/base/eerror.h> #include <lib/base/estring.h> #include <errno.h> +#include <set> #define SCAN_eDebug(x...) eDebug(x) #define SCAN_eDebugNoNewLine(x...) eDebugNoNewLine(x) @@ -422,6 +423,86 @@ void eDVBScan::start(const eSmartPtrList<iDVBFrontendParameters> &known_transpon void eDVBScan::insertInto(iDVBChannelList *db) { + if (m_flags & scanRemoveServices) + { + bool clearTerrestrial=false; + bool clearCable=false; + std::set<unsigned int> scanned_sat_positions; + + std::list<ePtr<iDVBFrontendParameters> >::iterator it(m_ch_scanned.begin()); + for (;it != m_ch_scanned.end(); ++it) + { + int system; + (*it)->getSystem(system); + switch(system) + { + case iDVBFrontend::feSatellite: + { + eDVBFrontendParametersSatellite sat_parm; + (*it)->getDVBS(sat_parm); + scanned_sat_positions.insert(sat_parm.orbital_position); + break; + } + case iDVBFrontend::feTerrestrial: + { + clearTerrestrial=true; + break; + } + case iDVBFrontend::feCable: + { + clearCable=true; + break; + } + } + } + + for (it=m_ch_unavailable.begin();it != m_ch_unavailable.end(); ++it) + { + int system; + (*it)->getSystem(system); + switch(system) + { + case iDVBFrontend::feSatellite: + { + eDVBFrontendParametersSatellite sat_parm; + (*it)->getDVBS(sat_parm); + scanned_sat_positions.insert(sat_parm.orbital_position); + break; + } + case iDVBFrontend::feTerrestrial: + { + clearTerrestrial=true; + break; + } + case iDVBFrontend::feCable: + { + clearCable=true; + break; + } + } + } + + if (clearTerrestrial) + { + eDVBChannelID chid; + chid.dvbnamespace=0xEEEE0000; + db->removeServices(chid); + } + if (clearCable) + { + eDVBChannelID chid; + chid.dvbnamespace=0xFFFF0000; + db->removeServices(chid); + } + for (std::set<unsigned int>::iterator x(scanned_sat_positions.begin()); x != scanned_sat_positions.end(); ++x) + { + eDVBChannelID chid; + if (m_flags & scanDontRemoveFeed) + chid.dvbnamespace = eDVBNamespace((*it)<<16)); + db->removeServices(chid, *it); + } + } + for (std::map<eDVBChannelID, ePtr<iDVBFrontendParameters> >::const_iterator ch(m_new_channels.begin()); ch != m_new_channels.end(); ++ch) db->addChannelToList(ch->first, ch->second); diff --git a/lib/dvb/scan.h b/lib/dvb/scan.h index 2756fb12..0a7c6ada 100644 --- a/lib/dvb/scan.h +++ b/lib/dvb/scan.h @@ -68,7 +68,7 @@ public: eDVBScan(iDVBChannel *channel); ~eDVBScan(); - enum { scanNetworkSearch = 1, scanSearchBAT = 2 }; + enum { scanNetworkSearch = 1, scanSearchBAT = 2, scanRemoveServices = 4, scanDontRemoveFeeds=8 }; void start(const eSmartPtrList<iDVBFrontendParameters> &known_transponders, int flags); enum { evtUpdate, evtNewService, evtFinish, evtFail }; diff --git a/lib/python/Screens/ScanSetup.py b/lib/python/Screens/ScanSetup.py index f007f6f2..ff76d020 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -202,11 +202,12 @@ class ScanSetup(Screen): self.updateSatList() print config.scan.satselection[config.scan.nims.value] self.list.append(getConfigListEntry(_("Satellite"), config.scan.satselection[config.scan.nims.value])) + self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices)) elif currentConfigSelectionElement(config.scan.type) == "multisat": # if (norotor) tlist = [] SatList = nimmanager.getSatListForNim(config.scan.nims.value) - + self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices)) for x in SatList: if self.Satexists(tlist, x[1]) == 0: tlist.append(x[1]) @@ -228,7 +229,7 @@ class ScanSetup(Screen): self.list.append(getConfigListEntry(_("FEC"), config.scan.cab.fec)) self.list.append(getConfigListEntry(_("Network scan"), config.scan.cab.networkScan)) elif currentConfigSelectionElement(config.scan.typecable) == "complete": - pass + self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices)) if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]): if currentConfigSelectionElement(config.scan.typeterrestrial) == "single_transponder": @@ -243,7 +244,7 @@ class ScanSetup(Screen): self.list.append(getConfigListEntry(_("Guard interval mode"), config.scan.ter.guard)) self.list.append(getConfigListEntry(_("Hierarchy mode"), config.scan.ter.hierarchy)) elif currentConfigSelectionElement(config.scan.typeterrestrial) == "complete": - pass + self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices)) if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"] and currentConfigSelectionElement(config.scan.type) == "single_transponder") or \ (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"] and currentConfigSelectionElement(config.scan.typecable) == "single_transponder") or \ @@ -283,6 +284,7 @@ class ScanSetup(Screen): config.scan.type = configElement_nonSave("config.scan.type", configSelection, 0, (("single_transponder", _("Single transponder")), ("single_satellite", _("Single satellite")), ("multisat", _("Multisat")))) config.scan.typecable = configElement_nonSave("config.scan.typecable", configSelection, 0, (("single_transponder", _("Single transponder")), ("complete", _("Complete")))) config.scan.typeterrestrial = configElement_nonSave("config.scan.typeterrestrial", configSelection, 0, (("single_transponder", _("Single transponder")), ("complete", _("Complete")))) + config.scan.clearallservices = configElement_nonSave("config.scan.clearallservices", configSelection, 0, (("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (hold feeds)")))) nimList = [ ] for nim in nimmanager.nimList(): @@ -362,7 +364,7 @@ class ScanSetup(Screen): parm = eDVBFrontendParametersSatellite() parm.frequency = frequency * 1000 parm.symbol_rate = symbol_rate * 1000 - parm.polarisation = polarisation # eDVBFrontendParametersSatellite.Polarisation.Verti + parm.polarisation = polarisation # eDVBFrontendParametersSatellite.Polarisation.Verti parm.fec = fec # eDVBFrontendParametersSatellite.FEC.f3_4; #parm.fec = 6 # AUTO parm.inversion = inversion #eDVBFrontendParametersSatellite.Inversion.Off; @@ -376,7 +378,7 @@ class ScanSetup(Screen): parm = eDVBFrontendParametersCable() parm.frequency = frequency * 1000 parm.symbol_rate = symbol_rate * 1000 - parm.modulation = modulation # modulation # eDVBFrontendParametersSatellite.Polarisation.Verti + parm.modulation = modulation # modulation # eDVBFrontendParametersSatellite.Polarisation.Verti parm.fec = fec # eDVBFrontendParametersSatellite.FEC.f3_4; #parm.fec = 6 # AUTO parm.inversion = inversion #eDVBFrontendParametersSatellite.Inversion.Off; @@ -407,8 +409,15 @@ class ScanSetup(Screen): config.scan.sat.inversion.value, orbpos) elif currentConfigSelectionElement(config.scan.type) == "single_satellite": - getInitialTransponderList(tlist, int(self.satList[config.scan.nims.value][config.scan.satselection[config.scan.nims.value].value][1])) + sat = self.satList[config.scan.nims.value][config.scan.satselection[config.scan.nims.value].value] + getInitialTransponderList(tlist, int(sat[1])) flags |= eComponentScan.scanNetworkSearch + tmp = currentConfigSelectionElement(config.scan.clearallservices) + if tmp == "yes": + flags |= eComponentScan.scanRemoveServices + elif tmp == "yes_hold_feeds": + flags |= eComponentScan.scanRemoveServices + flags |= eComponentScan.scanDontRemoveFeeds elif currentConfigSelectionElement(config.scan.type) == "multisat": SatList = nimmanager.getSatListForNim(config.scan.nims.value) for x in self.multiscanlist: @@ -416,6 +425,12 @@ class ScanSetup(Screen): print " " + str(x[1].parent.configPath) getInitialTransponderList(tlist, x[1].parent.configPath) flags |= eComponentScan.scanNetworkSearch + tmp = currentConfigSelectionElement(config.scan.clearallservices) + if tmp == "yes": + flags |= eComponentScan.scanRemoveServices + elif tmp == "yes_hold_feeds": + flags |= eComponentScan.scanRemoveServices + flags |= eComponentScan.scanDontRemoveFeeds elif (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"]): if currentConfigSelectionElement(config.scan.typecable) == "single_transponder": @@ -429,10 +444,16 @@ class ScanSetup(Screen): elif currentConfigSelectionElement(config.scan.typecable) == "complete": getInitialCableTransponderList(tlist, nimmanager.getCableDescription(config.scan.nims.value)) flags |= eComponentScan.scanNetworkSearch + tmp = currentConfigSelectionElement(config.scan.clearallservices) + if tmp == "yes": + flags |= eComponentScan.scanRemoveServices + elif tmp == "yes_hold_feeds": + flags |= eComponentScan.scanRemoveServices + flags |= eComponentScan.scanDontRemoveFeeds elif (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]): if currentConfigSelectionElement(config.scan.typeterrestrial) == "single_transponder": - self.addTerTransponder(tlist, + self.addTerTransponder(tlist, config.scan.ter.frequency.value[0] * 1000000, inversion = config.scan.ter.inversion.value, bandwidth = config.scan.ter.bandwidth.value, @@ -447,6 +468,12 @@ class ScanSetup(Screen): elif currentConfigSelectionElement(config.scan.typeterrestrial) == "complete": getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(config.scan.nims.value)) flags |= eComponentScan.scanNetworkSearch + tmp = currentConfigSelectionElement(config.scan.clearallservices) + if tmp == "yes": + flags |= eComponentScan.scanRemoveServices + elif tmp == "yes_hold_feeds": + flags |= eComponentScan.scanRemoveServices + flags |= eComponentScan.scanDontRemoveFeeds for x in self["config"].list: x[1].save() @@ -510,7 +537,14 @@ class ScanSimple(Screen): scanPossible = True getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(slotid)) if scanPossible: - scanList.append({"transponders": tlist, "feid": slotid, "flags": eComponentScan.scanNetworkSearch}) + flags=eComponentScan.scanNetworkSearch + tmp = currentConfigSelectionElement(config.scan.clearallservices) + if tmp == "yes": + flags |= eComponentScan.scanRemoveServices + elif tmp == "yes_hold_feeds": + flags |= eComponentScan.scanRemoveServices + flags |= eComponentScan.scanDontRemoveFeeds + scanList.append({"transponders": tlist, "feid": slotid, "flags": flags}) if len(scanList): self.session.openWithCallback(self.doNothing, ServiceScan, scanList = scanList) else: @@ -518,7 +552,7 @@ class ScanSimple(Screen): def doNothing(self): pass - + def keyCancel(self): self.close() @@ -567,7 +601,10 @@ class ScanSimple(Screen): nimcount = nimmanager.getNimSocketCount() if nimcount > 0: - nim = configElement_nonSave(0, configSelection, 0,(("yes", _("yes")),("no", _("no")))) + config.scan = ConfigSubsection() + config.scan.clearallservices = configElement_nonSave("config.scan.clearallservices", configSelection, 0, (("no", _("no")), ("yes", _("yes")), ("yes_hold_feeds", _("yes (hold feeds)")))) + self.list.append(getConfigListEntry(_("Clear before scan"), config.scan.clearallservices)) + nim = configElement_nonSave(0, configSelection, 0, (("yes", _("yes")), ("no", _("no")))) self.list.append(getConfigListEntry(_("Scan NIM") + " 0 (" + nimmanager.getNimTypeName(0) + ")", nim)) if nimcount > 1 and self.ScanNimTwoNeeded(): nim = configElement_nonSave(1, configSelection, 0, (("yes", _("yes")), ("no", _("no")))) |
