#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)
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);
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])
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":
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 \
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():
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;
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;
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:
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":
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,
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()
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:
def doNothing(self):
pass
-
+
def keyCancel(self):
self.close()
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"))))