[StreamServerSeek] Reverse-Proxy + Player
[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 WebChilds.ScreenPageCORS import ScreenPageCORS
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 from WebChilds.Proxy import ProxyResource
13
14 if hasattr(static.File, 'render_GET'):
15         class File(static.File):
16                 def render_POST(self, request):
17                         return self.render_GET(request)
18 else:
19         File = static.File
20
21 def autostart(reason,**kwargs):
22         if "session" in kwargs:
23                 sss = StreamServerSeek(session = kwargs["session"])
24                 print "session %s" % sss
25
26                 root = File(eEnv.resolve("${libdir}/enigma2/python/Plugins/Extensions/StreamServerSeek/web-data"))
27                 root.putChild("web", ScreenPageCORS(kwargs["session"], util.sibpath(__file__, "web"), True) )
28                 root.putChild("stream", StreamResource(kwargs["session"]))
29                 root.putChild("proxy", ProxyResource(kwargs["session"]))
30                 addExternalChild( ("streamserverseek", root) )
31
32 def Plugins(**kwargs): 
33         return [PluginDescriptor(where = [PluginDescriptor.WHERE_SESSIONSTART], fnc = autostart)]