1 from twisted.web import http, resource
2 from EPGRefresh import epgrefresh
4 # pretty basic resource which is just present to have a way to start a
5 # forced refresh through the webif
6 class EPGRefreshResource(resource.Resource):
8 resource.Resource.__init__(self)
10 def render(self, req):
12 if req.args.has_key("refresh"):
13 if epgrefresh.forceRefresh():
14 output = "initiated refresh"
17 output = "could not initiate refresh"
19 output = "unknown command"
21 result = """<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
24 <e2statetext>%s</e2statetext>
26 """ % ('true' if res else 'false', output)
28 req.setResponseCode(http.OK)
29 req.setHeader('Content-type', 'application; xhtml+xml')
30 req.setHeader('charset', 'UTF-8')