cleanup
[enigma2-plugins.git] / webinterface / src / WebChilds / RedirecToCurrentStream.py
1 from twisted.web import resource, server
2 from ServiceReference import ServiceReference
3
4 class RedirecToCurrentStreamResource(resource.Resource):
5         """
6                 used to redirect the client to the streamproxy with the current service tuned on TV
7         """
8         def __init__(self, session):
9                 resource.Resource.__init__(self)
10                 self.session = session
11
12         def render(self, request):
13                 currentServiceRef = self.session.nav.getCurrentlyPlayingServiceReference()
14                 if currentServiceRef is not None:
15                         sref = currentServiceRef.toString()
16                 else:
17                         sref = "N/A"
18
19                 request.redirect("http://%s:8001/%s" % (request.getHost().host, sref))
20                 request.finish()
21                 return server.NOT_DONE_YET
22