adding another version of 'how to stream the current service':
[enigma2-plugins.git] / webinterface / src / WebChilds / RedirecToCurrentStream.py
1 from twisted.web2 import resource
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         self.session = session
10         resource.Resource.__init__(self)
11
12     def render(self, req):
13         currentServiceRef = self.session.nav.getCurrentlyPlayingServiceReference()
14         if currentServiceRef is not None:
15             sref = currentServiceRef.toString()
16         else:
17             sref = "N/A"
18         return http.RedirectResponse("http://%s:8001/%s"%(req.host,sref))
19