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