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, transponders, feid, flags):
43 self.progressbar = progressbar
45 self.scan = eComponentScan()
46 self.state = self.Idle
49 self.scanStatusChanged()
52 # parm = eDVBFrontendParametersSatellite()
54 # parm.frequency = 11817000
55 # parm.symbol_rate = 27500000
56 # parm.polarisation = 1 # eDVBFrontendParametersSatellite.Polarisation.Vertical
57 # parm.fec = 3 # eDVBFrontendParametersSatellite.FEC.f3_4;
58 # parm.inversion = 1 #eDVBFrontendParametersSatellite.Inversion.Off;
59 # parm.orbital_position = 192
60 # self.scan.addInitial(parm)
62 # # until we have a terrestrial.xml:
63 # for x in [490000000, 530000000, 546000000, 570000000, 626000000]:
64 # parm = eDVBFrontendParametersTerrestrial()
66 # parm.inversion = 2 # eDVBFrontendParametersTerrestrial.Inversion.Unknown;
67 # parm.bandwidth = 0 #eDVBFrontendParametersTerrestrial.Bandwidth.Bw8MHz;
68 # parm.code_rate_HP = parm.code_rate_LP = 6 #eDVBFrontendParametersTerrestrial.FEC.fAuto;
69 # parm.modulation = 1 #eDVBFrontendParametersTerrestrial.Modulation.QAM16;
70 # parm.transmission_mode = 1 # eDVBFrontendParametersTerrestrial.TransmissionMode.TM8k;
71 # parm.guard_interval = 0 # eDVBFrontendParametersTerrestrial.GuardInterval.GI_1_32;
72 # parm.hierarchy = 0 #eDVBFrontendParametersTerrestrial.Hierarchy.HNone;
73 # self.scan.addInitial(parm)
75 for x in transponders:
76 self.scan.addInitial(x)
78 #self.scan.addInitial(parm)
81 self.scan.statusChanged.get().append(self.scanStatusChanged)
82 self.state = self.Running
83 err = self.scan.start(self.feid, self.flags)
85 self.state = self.Error
88 self.scanStatusChanged()
91 self.scan.statusChanged.get().remove(self.scanStatusChanged)
93 print "*** warning *** scan was not finished!"
98 print "state is %d " % (self.state)
99 return self.state == self.Done or self.state == self.Error