X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/b2f097f145a0116cc4c9f58f6bcc2006d6dca14c..bf976ae7302a8f3e2b6ecde2336a9cbef890720d:/lib/python/Components/ServiceScan.py diff --git a/lib/python/Components/ServiceScan.py b/lib/python/Components/ServiceScan.py index 7cbc65db..aeffaf2f 100644 --- a/lib/python/Components/ServiceScan.py +++ b/lib/python/Components/ServiceScan.py @@ -26,7 +26,7 @@ class ServiceScan: self.state = self.Error self.errorcode = errcode else: - self.text.setText(_("scan in progress - %d %% done!\n%d services found!") % (self.scan.getProgress(), self.scan.getNumServices())) + self.text.setText(_("scan in progress - %d %% done!\n%d services found!") % (self.scan.getProgress(), self.foundServices + self.scan.getNumServices())) if self.state == self.Done: if self.scan.getNumServices() == 1: @@ -34,51 +34,50 @@ class ServiceScan: elif self.scan.getNumServices() == 0: self.text.setText(_("scan done!\nNo service found!")) else: - self.text.setText(_("scan done!\n%d services found!") % (self.scan.getNumServices())) + self.text.setText(_("scan done!\n%d services found!") % (self.foundServices + self.scan.getNumServices())) if self.state == self.Error: self.text.setText(_("ERROR - failed to scan (%s)!") % (self.Errors[self.errorcode]) ) + + if self.state == self.Done or self.state == self.Error: + if self.run != len(self.scanList) - 1: + self.foundServices += self.scan.getNumServices() + self.execEnd() + self.run += 1 + self.doRun() + self.execBegin() - def __init__(self, progressbar, text, transponders, feid, flags): + def __init__(self, progressbar, text, servicelist, passNumber, scanList): + self.foundServices = 0 self.progressbar = progressbar self.text = text + self.servicelist = servicelist + self.passNumber = passNumber + self.scanList = scanList + self.run = 0 + + self.doRun() + + def doRun(self): self.scan = eComponentScan() + + self.feid = self.scanList[self.run]["feid"] + self.flags = self.scanList[self.run]["flags"] self.state = self.Idle - self.feid = feid - self.flags = flags self.scanStatusChanged() -# if 1: -# parm = eDVBFrontendParametersSatellite() -# -# parm.frequency = 11817000 -# parm.symbol_rate = 27500000 -# parm.polarisation = 1 # eDVBFrontendParametersSatellite.Polarisation.Vertical -# parm.fec = 3 # eDVBFrontendParametersSatellite.FEC.f3_4; -# parm.inversion = 1 #eDVBFrontendParametersSatellite.Inversion.Off; -# parm.orbital_position = 192 -# self.scan.addInitial(parm) -# else: -# # until we have a terrestrial.xml: -# for x in [490000000, 530000000, 546000000, 570000000, 626000000]: -# parm = eDVBFrontendParametersTerrestrial() -# parm.frequency = x -# parm.inversion = 2 # eDVBFrontendParametersTerrestrial.Inversion.Unknown; -# parm.bandwidth = 0 #eDVBFrontendParametersTerrestrial.Bandwidth.Bw8MHz; -# parm.code_rate_HP = parm.code_rate_LP = 6 #eDVBFrontendParametersTerrestrial.FEC.fAuto; -# parm.modulation = 1 #eDVBFrontendParametersTerrestrial.Modulation.QAM16; -# parm.transmission_mode = 1 # eDVBFrontendParametersTerrestrial.TransmissionMode.TM8k; -# parm.guard_interval = 0 # eDVBFrontendParametersTerrestrial.GuardInterval.GI_1_32; -# parm.hierarchy = 0 #eDVBFrontendParametersTerrestrial.Hierarchy.HNone; -# self.scan.addInitial(parm) - - for x in transponders: + for x in self.scanList[self.run]["transponders"]: self.scan.addInitial(x) - - #self.scan.addInitial(parm) + + def updatePass(self): + size = len(self.scanList) + if size > 1: + self.passNumber.setText(_("pass") + " " + str(self.run + 1) + "/" + str(size) + " (" + _("Tuner") + " " + str(self.scanList[self.run]["feid"]) + ")") def execBegin(self): + self.updatePass() self.scan.statusChanged.get().append(self.scanStatusChanged) + self.scan.newService.get().append(self.newService) self.state = self.Running err = self.scan.start(self.feid, self.flags) if err: @@ -89,11 +88,15 @@ class ServiceScan: def execEnd(self): self.scan.statusChanged.get().remove(self.scanStatusChanged) + self.scan.newService.get().remove(self.newService) if not self.isDone(): print "*** warning *** scan was not finished!" del self.scan def isDone(self): - print "state is %d " % (self.state) return self.state == self.Done or self.state == self.Error + + def newService(self): + newServiceName = self.scan.getLastServiceName() + self.servicelist.addItem(newServiceName)