1 #from Components.ActionMap import ActionMap, NumberActionMap
2 #from Components.Input import Input
3 #from Components.Ipkg import IpkgComponent
4 #from Components.Label import Label
5 #from Components.MenuList import MenuList
6 #from Components.Slider import Slider
7 from Components.NimManager import nimmanager
8 from Plugins.Plugin import PluginDescriptor
9 from Screens.ScanSetup import ScanSetup
10 from Screens.ServiceScan import ServiceScan
11 from Screens.MessageBox import MessageBox
12 from Tools.Directories import resolveFilename, SCOPE_CONFIG, copyfile
13 #from Screens.Screen import Screen
15 from enigma import eTimer, eDVBDB
17 class DefaultServiceScan(ServiceScan):
19 <screen position="150,115" size="420,390" title="Service Scan">
20 <widget source="FrontendInfo" render="Pixmap" pixmap="skin_default/icons/scan-s.png" position="5,5" size="64,64" transparent="1" alphatest="on">
21 <convert type="FrontendInfo">TYPE</convert>
22 <convert type="ValueRange">0,0</convert>
23 <convert type="ConditionalShowHide" />
25 <widget source="FrontendInfo" render="Pixmap" pixmap="skin_default/icons/scan-c.png" position="5,5" size="64,64" transparent="1" alphatest="on">
26 <convert type="FrontendInfo">TYPE</convert>
27 <convert type="ValueRange">1,1</convert>
28 <convert type="ConditionalShowHide" />
30 <widget source="FrontendInfo" render="Pixmap" pixmap="skin_default/icons/scan-t.png" position="5,5" size="64,64" transparent="1" alphatest="on">
31 <convert type="FrontendInfo">TYPE</convert>
32 <convert type="ValueRange">2,2</convert>
33 <convert type="ConditionalShowHide" />
35 <widget name="network" position="80,15" size="330,20" font="Regular;20" />
36 <widget name="transponder" position="80,40" size="330,20" font="Regular;20" />
37 <widget name="scan_state" position="10,80" zPosition="2" size="400,20" font="Regular;18" />
38 <widget name="pass" position="10,80" size="400,20" font="Regular;18" />
39 <widget name="scan_progress" position="10,105" size="400,15" pixmap="skin_default/progress_big.png" borderWidth="2" borderColor="#cccccc" />
40 <widget name="servicelist" position="10,135" size="400,265" selectionDisabled="1" />
43 def __init__(self, session, scanList):
45 unlink("rm " + resolveFilename(SCOPE_CONFIG) + "/lamedb");
48 db = eDVBDB.getInstance()
49 db.reloadServicelist()
50 ServiceScan.__init__(self, session, scanList)
52 self.timer.callback.append(self.ok)
53 self.timer.start(1000)
55 class DefaultServicesScannerPlugin(ScanSetup):
57 <screen position="100,115" size="520,390" title="Service scan">
58 <widget name="config" position="10,10" size="500,350" scrollbarMode="showOnDemand" />
59 <widget name="introduction" position="10,365" size="500,25" font="Regular;20" halign="center" />
62 def __init__(self, session, args = None):
63 ScanSetup.__init__(self, session)
65 confdir = resolveFilename(SCOPE_CONFIG)
66 copyfile(confdir + "/lamedb", confdir + "/lamedb.backup)
67 self.scan_type.value = "multisat"
71 self.onFirstExecBegin.append(self.runScan)
73 def selectSat(self, index):
74 for satindex in range(len(self.multiscanlist)):
76 self.multiscanlist[satindex][1].value = False
78 self.multiscanlist[satindex][1].value = True
84 def startScan(self, tlist, flags, feid):
87 # flags |= eComponentScan.scanSearchBAT
88 self.session.openWithCallback(self.scanFinished, DefaultServiceScan, [{"transponders": tlist, "feid": feid, "flags": flags}])
90 self.session.openWithCallback(self.scanFinished, MessageBox, _("Nothing to scan!\nPlease setup your tuner settings before you start a service scan."), MessageBox.TYPE_ERROR)
92 def scanFinished(self, value = None):
94 db = eDVBDB.getInstance()
95 satint = self.multiscanlist[self.scanIndex][0]
96 print "scanned sat:", satint
97 db.saveServicelist("/tmp/lamedb." + str(satint))
98 file = open("/tmp/sat" + str(satint) + ".info", "w")
101 <tag type="services" />
102 <bcastsystem type="DVB-S" />
103 <satellite type="%d" />
111 <files type="directories">
112 <file type="services" name="lamedb.%d">
115 </default>""" % (satint, "Dream", nimmanager.getSatDescription(satint), satint)
120 if self.scanIndex + 1 >= len(self.multiscanlist):
121 print "no more sats to scan"
122 confdir = resolveFilename(SCOPE_CONFIG)
123 copyfile(confdir + "/lamedb.backup", confdir + "/lamedb)
124 db.reloadServicelist()
127 self.selectSat(self.scanIndex)
130 def DefaultServicesScannerMain(session, **kwargs):
131 session.open(DefaultServicesScannerPlugin)
133 def Plugins(**kwargs):
134 return PluginDescriptor(name="Default Services Scanner", description=_("Scans default lamedbs sorted by satellite with a connected dish positioner"), where = PluginDescriptor.WHERE_PLUGINMENU, fnc=DefaultServicesScannerMain)