moved childs to seperate dir ./WebChilds
[enigma2-plugins.git] / webinterface / src / WebChilds / Toplevel.py
1 from twisted.web2 import resource, static, responsecode, http, http_headers
2 from twisted.python import util
3
4 from Components.config import config
5
6 from Plugins.Extensions import WebInterface
7 from Screenpage import ScreenPage
8 from MovieStreamer import MovieStreamer
9 from Screengrab import GrabResource
10
11 class Toplevel(resource.Resource):
12     addSlash = True
13     def __init__(self,session):
14         self.session = session
15         resource.Resource.__init__(self)
16         
17         self.putChild("web",ScreenPage(self.session,util.sibpath(WebInterface.__file__, "web"))) # "/web/*"
18         self.putChild("webdata",static.File(util.sibpath(WebInterface.__file__, "web-data"))) # FIXME: web-data appears as webdata
19         self.putChild("wap",static.File(util.sibpath(WebInterface.__file__, "wap"))) # static pages for wap
20         self.putChild("movie",MovieStreamer())
21         self.putChild("grab",GrabResource())
22         
23         if config.plugins.Webinterface.includehdd.value:
24             self.putChild("hdd",static.File("/hdd"))
25         
26     def render(self, req):
27         fp = open(util.sibpath(WebInterface.__file__, "web-data")+"/index.html")
28         s = fp.read()
29         fp.close()
30         return http.Response(responsecode.OK, {'Content-type': http_headers.MimeType('text', 'html')},stream=s)