[StreamServerSeek] Stream WebChild
[enigma2-plugins.git] / streamserverseek / src / plugin.py
1 from Plugins.Plugin import PluginDescriptor
2
3 from enigma import eEnv
4 from Plugins.Extensions.WebInterface.WebChilds.Toplevel import addExternalChild
5 from Plugins.Extensions.WebInterface.WebChilds.Screenpage import ScreenPage
6
7 from twisted.web import static
8 from twisted.python import util
9
10 from Plugins.Extensions.StreamServerSeek.StreamServerSeek import StreamServerSeek
11 from WebChilds.Stream import StreamResource
12
13 if hasattr(static.File, 'render_GET'):
14         class File(static.File):
15                 def render_POST(self, request):
16                         return self.render_GET(request)
17 else:
18         File = static.File
19
20 def autostart(reason,**kwargs):
21         if "session" in kwargs:
22                 sss = StreamServerSeek(session = kwargs["session"])
23                 print "session %s" % sss
24
25                 root = File(eEnv.resolve("${libdir}/enigma2/python/Plugins/Extensions/StreamServerSeek/web-data"))
26                 root.putChild("web", ScreenPage(kwargs["session"], util.sibpath(__file__, "web"), True) )
27                 root.putChild("stream", StreamResource(kwargs["session"]))
28                 addExternalChild( ("streamserverseek", root) )
29
30 def Plugins(**kwargs): 
31         return [PluginDescriptor(where = [PluginDescriptor.WHERE_SESSIONSTART], fnc = autostart)]