autotimer/epgrefresh: follow webif change
[enigma2-plugins.git] / webinterface / src / WebScreens.py
1 from enigma import eServiceReference
2 from Screens.Screen import Screen
3 from WebComponents.Sources.RequestData import RequestData
4
5 class WebScreen(Screen):
6         def __init__(self, session, request):
7                 Screen.__init__(self, session)
8                 self.stand_alone = True
9                 self.request = request
10                 self.instance = None
11
12 class DummyWebScreen(WebScreen):
13         #use it, if you dont need any source, just to can do a static file with an xml-file
14         def __init__(self, session, request):
15                 WebScreen.__init__(self, session, request)
16
17 class UpdateWebScreen(WebScreen):
18         def __init__(self, session, request):
19                 WebScreen.__init__(self, session, request)
20                 from Components.Sources.Clock import Clock
21
22                 self["CurrentTime"] = Clock()
23
24
25 class MessageWebScreen(WebScreen):
26         def __init__(self, session, request):
27                 WebScreen.__init__(self, session, request)
28                 from WebComponents.Sources.Message import Message
29
30                 self["Message"] = Message(session, func=Message.PRINT)
31                 self["GetAnswer"] = Message(session, func=Message.ANSWER)
32
33 class ServiceListReloadWebScreen(WebScreen):
34         def __init__(self, session, request):
35                 WebScreen.__init__(self, session, request)
36                 from WebComponents.Sources.ServiceListReload import ServiceListReload
37
38                 self["ServiceListReload"] = ServiceListReload(session)
39
40 class AudioWebScreen(WebScreen):
41         def __init__(self, session, request):
42                 WebScreen.__init__(self, session, request)
43                 from WebComponents.Sources.AudioTracks import AudioTracks
44
45                 self["AudioTracks"] = AudioTracks(session, func=AudioTracks.GET)
46                 self["SelectAudioTrack"] = AudioTracks(session, func=AudioTracks.SET)
47
48 class AboutWebScreen(WebScreen):
49         def __init__(self, session, request):
50                 WebScreen.__init__(self, session, request)
51                 from WebComponents.Sources.About import About
52                 from WebComponents.Sources.Frontend import Frontend
53                 from WebComponents.Sources.Hdd import Hdd
54                 from WebComponents.Sources.Network import Network
55                 from Components.config import config
56                 from Components.About import about
57                 from Components.Sources.StaticText import StaticText
58                 from Tools.DreamboxHardware import getFPVersion
59                 from Tools.HardwareInfo import HardwareInfo
60
61                 hw = HardwareInfo()
62
63                 self["About"] = About(session)
64
65                 self["Network"] = Network()
66                 self["Hdd"] = Hdd()
67                 self["Frontends"] = Frontend()
68                 self["EnigmaVersion"] = StaticText(about.getEnigmaVersionString())
69                 self["ImageVersion"] = StaticText(about.getVersionString())
70                 self["WebIfVersion"] = StaticText(config.plugins.Webinterface.version.value)
71                 self["FpVersion"] = StaticText(str(getFPVersion()))
72                 self["DeviceName"] = StaticText(hw.get_device_name())
73
74 class VolumeWebScreen(WebScreen):
75         def __init__(self, session, request):
76                 WebScreen.__init__(self, session, request)
77
78                 from WebComponents.Sources.Volume import Volume
79                 self["Volume"] = Volume(session)
80
81 class SettingsWebScreen(WebScreen):
82         def __init__(self, session, request):
83                 WebScreen.__init__(self, session, request)
84                 from WebComponents.Sources.Settings import Settings
85
86                 self["Settings"] = Settings(session)
87
88 class SubServiceWebScreen(WebScreen):
89         def __init__(self, session, request):
90                 WebScreen.__init__(self, session, request)
91                 from WebComponents.Sources.SubServices import SubServices
92
93                 self["SubServices"] = SubServices(session)
94
95 class StreamSubServiceWebScreen(WebScreen):
96         def __init__(self, session, request):
97                 WebScreen.__init__(self, session, request)
98                 from WebComponents.Sources.SubServices import SubServices
99
100                 self["StreamSubServices"] = SubServices(session, streamingScreens)
101
102 class ServiceListWebScreen(WebScreen):
103         def __init__(self, session, request):
104                 WebScreen.__init__(self, session, request)
105                 
106                 from Components.Sources.ServiceList import ServiceList
107                 from Screens.ChannelSelection import service_types_tv
108         
109                 fav = eServiceReference(service_types_tv + ' FROM BOUQUET "bouquets.tv" ORDER BY bouquet')
110                 self["ServiceList"] = ServiceList(fav, command_func=self.getServiceList, validate_commands=False)
111                 self["localip"] = RequestData(request, what=RequestData.HOST)
112                 
113         def getServiceList(self, sRef):
114                 self["ServiceList"].root = sRef 
115
116 class ServiceListRecursiveWebScreen(WebScreen):
117         def __init__(self, session, request):
118                 WebScreen.__init__(self, session, request)
119                 
120                 from WebComponents.Sources.ServiceListRecursive import ServiceListRecursive
121                 self["ServiceListRecursive"] = ServiceListRecursive(session, func=ServiceListRecursive.FETCH)
122
123 class SwitchServiceWebScreen(WebScreen):
124         def __init__(self, session, request):
125                 WebScreen.__init__(self, session, request)
126                 
127                 from WebComponents.Sources.SwitchService import SwitchService
128                 self["SwitchService"] = SwitchService(session)
129
130 class ReadPluginListWebScreen(WebScreen):
131         def __init__(self, session, request):
132                 WebScreen.__init__(self, session, request)
133                 from WebComponents.Sources.ReadPluginList import ReadPluginList
134                 self["ReadPluginList"] = ReadPluginList(session)
135
136 class LocationsAndTagsWebScreen(WebScreen):
137         def __init__(self, session, request):
138                 WebScreen.__init__(self, session, request)
139                 from WebComponents.Sources.LocationsAndTags import LocationsAndTags
140
141                 self["CurrentLocation"] = LocationsAndTags(session, LocationsAndTags.CURRLOCATION)
142                 self["Locations"] = LocationsAndTags(session, LocationsAndTags.LOCATIONS)
143                 self["AddLocation"] = LocationsAndTags(session, LocationsAndTags.ADDLOCATION)
144                 self["RemoveLocation"] = LocationsAndTags(session, LocationsAndTags.REMOVELOCATION)
145                 self["Tags"] = LocationsAndTags(session, LocationsAndTags.TAGS)
146
147 class EpgWebScreen(WebScreen):
148         def __init__(self, session, request):
149                 WebScreen.__init__(self, session, request)
150                 from WebComponents.Sources.EPG import EPG
151
152                 self["EpgSearch"] = EPG(session, func=EPG.SEARCH)
153                 self["EpgSearchSimilar"] = EPG(session, func=EPG.SEARCHSIMILAR)
154                 self["EpgService"] = EPG(session, func=EPG.SERVICE)
155                 self["EpgBouquetNow"] = EPG(session, func=EPG.BOUQUETNOW)
156                 self["EpgBouquetNext"] = EPG(session, func=EPG.BOUQUETNEXT)
157                 self["EpgServiceNow"] = EPG(session, func=EPG.SERVICENOW)
158                 self["EpgServiceNext"] = EPG(session, func=EPG.SERVICENEXT)
159                 self["EpgBouquet"] = EPG(session, func=EPG.BOUQUET)
160                 self["EpgMulti"] = EPG(session, func=EPG.MULTI)
161                 self["localip"] = RequestData(request, what=RequestData.HOST)
162
163                 self["EpgServiceWap"] = EPG(session, func=EPG.SERVICE, endtm=True)
164
165         def getServiceList(self, sRef):
166                 self["ServiceList"].root = sRef
167
168 class MovieWebScreen(WebScreen):
169         def __init__(self, session, request):
170                 WebScreen.__init__(self, session, request)
171                 from Components.MovieList import MovieList
172                 from Tools.Directories import resolveFilename, SCOPE_HDD
173                 from WebComponents.Sources.Movie import Movie
174
175                 movielist = MovieList(eServiceReference("2:0:1:0:0:0:0:0:0:0:" + resolveFilename(SCOPE_HDD)))
176                 self["MovieList"] = Movie(session, movielist, func=Movie.LIST)
177                 self["MovieFileDel"] = Movie(session, movielist, func=Movie.DEL)
178                 self["localip"] = RequestData(request, what=RequestData.HOST)
179
180 class MediaPlayerWebScreen(WebScreen):
181         def __init__(self, session, request):
182                 WebScreen.__init__(self, session, request)
183                 from WebComponents.Sources.MP import MP
184
185                 self["FileList"] = MP(session, func=MP.LIST)
186                 self["PlayFile"] = MP(session, func=MP.PLAY)
187                 self["AddFile"] = MP(session, func = MP.ADD)
188                 self["RemoveFile"] = MP(session, func=MP.REMOVE)
189                 self["Command"] = MP(session, func=MP.COMMAND)
190                 self["WritePlaylist"] = MP(session, func=MP.WRITEPLAYLIST)
191                 self["CurrentTrack"] = MP(session, func=MP.CURRENT)
192                 self["LoadPlaylist"] = MP(session, func=MP.LOADPLAYLIST)
193
194 class AutoTimerWebScreen(WebScreen):
195         def __init__(self, session, request):
196                 WebScreen.__init__(self, session, request)
197                 from WebComponents.Sources.AT import AT
198
199                 self["AutoTimerList"] = AT(session, func=AT.LIST)
200                 self["AutoTimerWrite"] = AT(session, func=AT.WRITE)
201
202 class TimerWebScreen(WebScreen):
203         def __init__(self, session, request):
204                 WebScreen.__init__(self, session, request)
205                 from WebComponents.Sources.Timer import Timer
206
207                 self["TimerList"] = Timer(session, func=Timer.LIST)
208                 self["TimerAddEventID"] = Timer(session, func=Timer.ADDBYID)
209                 self["TimerAdd"] = Timer(session, func=Timer.ADD)
210                 self["TimerDel"] = Timer(session, func=Timer.DEL)
211                 self["TimerChange"] = Timer(session, func=Timer.CHANGE)
212                 self["TimerListWrite"] = Timer(session, func=Timer.WRITE)
213                 self["TVBrowser"] = Timer(session, func=Timer.TVBROWSER)
214                 self["RecordNow"] = Timer(session, func=Timer.RECNOW)
215                 self["TimerCleanup"] = Timer(session, func=Timer.CLEANUP)
216
217 class RemoteWebScreen(WebScreen):
218         def __init__(self, session, request):
219                 WebScreen.__init__(self, session, request)
220                 from WebComponents.Sources.RemoteControl import RemoteControl
221
222                 self["RemoteControl"] = RemoteControl(session)
223
224 class PowerWebScreen(WebScreen):
225         def __init__(self, session, request):
226                 WebScreen.__init__(self, session, request)
227                 from WebComponents.Sources.PowerState import PowerState
228
229                 self["PowerState"] = PowerState(session)
230
231 class ParentControlWebScreen(WebScreen):
232         def __init__(self, session, request):
233                 WebScreen.__init__(self, session, request)
234                 from WebComponents.Sources.ParentControl import ParentControl
235
236                 self["ParentControlList"] = ParentControl(session)
237
238 class WapWebScreen(WebScreen):
239         def __init__(self, session, request):
240                 WebScreen.__init__(self, session, request)
241                 from WebComponents.Sources.WAPfunctions import WAPfunctions
242
243                 self["WAPFillOptionListYear"] = WAPfunctions(session, func=WAPfunctions.LISTTIME)
244                 self["WAPFillOptionListDay"] = WAPfunctions(session, func=WAPfunctions.LISTTIME)
245                 self["WAPFillOptionListMonth"] = WAPfunctions(session, func=WAPfunctions.LISTTIME)
246                 self["WAPFillOptionListShour"] = WAPfunctions(session, func=WAPfunctions.LISTTIME)
247                 self["WAPFillOptionListSmin"] = WAPfunctions(session, func=WAPfunctions.LISTTIME)
248                 self["WAPFillOptionListEhour"] = WAPfunctions(session, func=WAPfunctions.LISTTIME)
249                 self["WAPFillOptionListEmin"] = WAPfunctions(session, func=WAPfunctions.LISTTIME)
250
251                 self["WAPFillOptionListRecord"] = WAPfunctions(session, func=WAPfunctions.OPTIONLIST)
252                 self["WAPFillOptionListAfterEvent"] = WAPfunctions(session, func=WAPfunctions.OPTIONLIST)
253
254                 self["WAPFillValueName"] = WAPfunctions(session, func=WAPfunctions.FILLVALUE)
255                 self["WAPFillValueDescr"] = WAPfunctions(session, func=WAPfunctions.FILLVALUE)
256                 self["WAPFillLocation"] = WAPfunctions(session, func=WAPfunctions.LOCATIONLIST)
257                 self["WAPFillTags"] = WAPfunctions(session, func=WAPfunctions.TAGLIST)
258
259                 self["WAPFillOptionListRepeated"] = WAPfunctions(session, func=WAPfunctions.REPEATED)
260                 self["WAPServiceList"] = WAPfunctions(session, func=WAPfunctions.SERVICELIST)
261
262                 self["WAPdeleteOldOnSave"] = WAPfunctions(session, func=WAPfunctions.DELETEOLD)
263
264 streamingScreens = []
265
266 class StreamingWebScreen(WebScreen):
267         def __init__(self, session, request):
268                 WebScreen.__init__(self, session, request)
269                 from Components.Sources.StreamService import StreamService
270                 self["StreamService"] = StreamService(self.session.nav)
271                 streamingScreens.append(self)
272                 self.screenIndex = len(streamingScreens) - 1
273
274         def getRecordService(self):
275                 if self.has_key("StreamService"):
276                         return self["StreamService"].getService()
277                 return None
278
279         def getRecordServiceRef(self):
280                 if self.has_key("StreamService"):
281                         return self["StreamService"].ref
282                 return None
283
284 class M3uStreamingWebScreen(WebScreen):
285         def __init__(self, session, request):
286                 WebScreen.__init__(self, session, request)
287                 from Components.Sources.StaticText import StaticText
288                 from Components.Sources.Config import Config
289                 from Components.config import config
290                 self["ref"] = StaticText()
291                 self["localip"] = RequestData(request, what=RequestData.HOST)
292
293 class M3uStreamingCurrentServiceWebScreen(WebScreen):
294         def __init__(self, session, request):
295                 WebScreen.__init__(self, session, request)
296                 from WebComponents.Sources.CurrentService import CurrentService
297
298                 self["CurrentService"] = CurrentService(session)
299                 self["localip"] = RequestData(request, what=RequestData.HOST)
300
301 class TsM3uWebScreen(WebScreen):
302         def __init__(self, session, request):
303                 WebScreen.__init__(self, session, request)
304                 from Components.Sources.StaticText import StaticText
305                 from Components.Sources.Config import Config
306                 from Components.config import config
307                 self["file"] = StaticText()
308                 self["localip"] = RequestData(request, what=RequestData.HOST)
309                 self["localport"] = RequestData(request, what=RequestData.PORT)
310
311 class RestartWebScreen(WebScreen):
312         def __init__(self, session, request):
313                 WebScreen.__init__(self, session, request)
314                 import plugin
315                 plugin.restartWebserver(session)
316
317 class GetPidWebScreen(WebScreen):
318         def __init__(self, session, request):
319                  WebScreen.__init__(self, session, request)
320                  from Components.Sources.StaticText import StaticText
321                  from enigma import iServiceInformation
322                  pids = self.session.nav.getCurrentService()
323                  if pids is not None:
324                         pidinfo = pids.info()
325                         VPID = hex(pidinfo.getInfo(iServiceInformation.sVideoPID))
326                         APID = hex(pidinfo.getInfo(iServiceInformation.sAudioPID))
327                         PPID = hex(pidinfo.getInfo(iServiceInformation.sPMTPID))
328                         self["pids"] = StaticText("%s,%s,%s" % (PPID.lstrip("0x"), VPID.lstrip("0x"), APID.lstrip("0x")))
329                  else:
330                         self["pids"] = StaticText("0x,0x,0x")
331
332                  self["localip"] = RequestData(request, what=RequestData.HOST)
333
334 class DeviceInfoWebScreen(WebScreen):
335         def __init__(self, session, request):
336                 WebScreen.__init__(self, session, request)
337                 from WebComponents.Sources.Network import Network
338                 from WebComponents.Sources.Hdd import Hdd
339                 from WebComponents.Sources.Frontend import Frontend
340                 from Components.config import config
341                 from Components.About import about
342                 from Components.Sources.StaticText import StaticText
343                 from Tools.DreamboxHardware import getFPVersion
344                 from Tools.HardwareInfo import HardwareInfo
345
346                 hw = HardwareInfo()
347
348                 self["Network"] = Network()
349                 self["Hdd"] = Hdd()
350                 self["Frontends"] = Frontend()
351                 self["EnigmaVersion"] = StaticText(about.getEnigmaVersionString())
352                 self["ImageVersion"] = StaticText(about.getVersionString())
353                 self["WebIfVersion"] = StaticText(config.plugins.Webinterface.version.value)
354                 self["FpVersion"] = StaticText(str(getFPVersion()))
355                 self["DeviceName"] = StaticText(hw.get_device_name())
356
357 class ServicePlayableWebScreen(WebScreen):
358         def __init__(self, session, request):
359                 WebScreen.__init__(self, session, request)
360                 from WebComponents.Sources.ServicePlayable import ServicePlayable
361                 
362                 self["ServicePlayable"] = ServicePlayable(session, type=ServicePlayable.SINGLE)
363
364 class ServiceListPlayableWebScreen(WebScreen):
365         def __init__(self, session, request):
366                 WebScreen.__init__(self, session, request)
367                 from WebComponents.Sources.ServicePlayable import ServicePlayable
368                 
369                 self["ServiceListPlayable"] = ServicePlayable(session, type=ServicePlayable.BOUQUET)
370
371 class SleepTimerWebScreen(WebScreen):
372         def __init__(self, session, request):
373                 WebScreen.__init__(self, session, request)
374                 
375                 from WebComponents.Sources.SleepTimer import SleepTimer         
376                 self["SleepTimer"] = SleepTimer(session)
377                 
378 class TPMWebScreen(WebScreen):
379         def __init__(self, session, request):
380                 WebScreen.__init__(self, session, request)
381                 
382                 from WebComponents.Sources.TPMChallenge import TPMChallenge
383                 self["TPM"] = TPMChallenge()
384
385 class ExternalWebScreen(WebScreen):
386         def __init__(self, session, request):
387                 WebScreen.__init__(self, session, request)
388
389                 from WebComponents.Sources.External import External
390                 self["External"] = External()