1 from twisted.web import http, resource
2 from AutoTimer import AutoTimer
5 # pretty basic resource which is just present to have a way to start a
6 # forced run through the webif
7 class AutoTimerResource(resource.Resource):
9 resource.Resource.__init__(self)
11 def render(self, req):
12 from plugin import autotimer
17 autotimer = AutoTimer()
20 if req.args.has_key("parse"):
21 ret = autotimer.parseEPG()
22 output = _("Found a total of %d matching Events.\n%d Timer were added and %d modified.") % (ret[0], ret[1], ret[2])
25 output = "unknown command"
31 result = """<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
34 <e2statetext>%s</e2statetext>
36 """ % ('true' if res else 'false', output)
38 req.setResponseCode(http.OK)
39 req.setHeader('Content-type', 'application; xhtml+xml')
40 req.setHeader('charset', 'UTF-8')