1 from enigma import eComponentScan, eDVBFrontendParametersSatellite, eDVBFrontendParametersCable, eDVBFrontendParametersTerrestrial
11 0: "error starting scanning",
12 1: "error while scanning",
13 2: "no resource manager",
17 def scanStatusChanged(self):
18 if self.state == self.Running:
19 self.progressbar.setValue(self.scan.getProgress())
20 if self.scan.isDone():
21 errcode = self.scan.getError()
24 self.state = self.Done
26 self.state = self.Error
27 self.errorcode = errcode
29 self.text.setText(_("scan in progress - %d %% done!\n%d services found!") % (self.scan.getProgress(), self.scan.getNumServices()))
31 if self.state == self.Done:
32 if self.scan.getNumServices() == 1:
33 self.text.setText(_("scan done!\nOne service found!"))
34 elif self.scan.getNumServices() == 0:
35 self.text.setText(_("scan done!\nNo service found!"))
37 self.text.setText(_("scan done!\n%d services found!") % (self.scan.getNumServices()))
39 if self.state == self.Error:
40 self.text.setText(_("ERROR - failed to scan (%s)!") % (self.Errors[self.errorcode]) )
42 def __init__(self, progressbar, text, servicelist, transponders, feid, flags):
43 self.progressbar = progressbar
45 self.scan = eComponentScan()
46 self.state = self.Idle
49 self.servicelist = servicelist
50 self.scanStatusChanged()
52 for x in transponders:
53 self.scan.addInitial(x)
55 #self.scan.addInitial(parm)
58 self.scan.statusChanged.get().append(self.scanStatusChanged)
59 self.scan.newService.get().append(self.newService)
60 self.state = self.Running
61 err = self.scan.start(self.feid, self.flags)
63 self.state = self.Error
66 self.scanStatusChanged()
69 self.scan.statusChanged.get().remove(self.scanStatusChanged)
70 self.scan.newService.get().remove(self.newService)
72 print "*** warning *** scan was not finished!"
77 return self.state == self.Done or self.state == self.Error
80 newServiceName = self.scan.getLastServiceName()
81 self.servicelist.addItem(newServiceName)