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 self.text.setText(_("scan done!"))
34 if self.state == self.Error:
35 self.text.setText(_("ERROR - failed to scan (%s)!") % (self.Errors[self.errorcode]) )
37 def __init__(self, progressbar, text, transponders, feid, flags):
38 self.progressbar = progressbar
40 self.scan = eComponentScan()
41 self.state = self.Idle
44 self.scanStatusChanged()
47 # parm = eDVBFrontendParametersSatellite()
49 # parm.frequency = 11817000
50 # parm.symbol_rate = 27500000
51 # parm.polarisation = 1 # eDVBFrontendParametersSatellite.Polarisation.Vertical
52 # parm.fec = 3 # eDVBFrontendParametersSatellite.FEC.f3_4;
53 # parm.inversion = 1 #eDVBFrontendParametersSatellite.Inversion.Off;
54 # parm.orbital_position = 192
55 # self.scan.addInitial(parm)
57 # # until we have a terrestrial.xml:
58 # for x in [490000000, 530000000, 546000000, 570000000, 626000000]:
59 # parm = eDVBFrontendParametersTerrestrial()
61 # parm.inversion = 2 # eDVBFrontendParametersTerrestrial.Inversion.Unknown;
62 # parm.bandwidth = 0 #eDVBFrontendParametersTerrestrial.Bandwidth.Bw8MHz;
63 # parm.code_rate_HP = parm.code_rate_LP = 6 #eDVBFrontendParametersTerrestrial.FEC.fAuto;
64 # parm.modulation = 1 #eDVBFrontendParametersTerrestrial.Modulation.QAM16;
65 # parm.transmission_mode = 1 # eDVBFrontendParametersTerrestrial.TransmissionMode.TM8k;
66 # parm.guard_interval = 0 # eDVBFrontendParametersTerrestrial.GuardInterval.GI_1_32;
67 # parm.hierarchy = 0 #eDVBFrontendParametersTerrestrial.Hierarchy.HNone;
68 # self.scan.addInitial(parm)
70 for x in transponders:
71 self.scan.addInitial(x)
73 #self.scan.addInitial(parm)
76 self.scan.statusChanged.get().append(self.scanStatusChanged)
77 self.state = self.Running
78 err = self.scan.start(self.feid, self.flags)
80 self.state = self.Error
83 self.scanStatusChanged()
86 self.scan.statusChanged.get().remove(self.scanStatusChanged)
88 print "*** warning *** scan was not finished!"
93 print "state is %d " % (self.state)
94 return self.state == self.Done or self.state == self.Error