also hand epgrefresh session if not explicitely enabled thus allowing to run it from...
[enigma2-plugins.git] / epgrefresh / src / EPGRefreshResource.py
1 from twisted.web2 import resource, responsecode, http
2 from EPGRefresh import epgrefresh
3
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):
7         def __init__(self):
8                 resource.Resource.__init__(self)
9
10         def render(self, req):
11                 if req.args.has_key("refresh"):
12                         if epgrefresh.forceRefresh():
13                                 output = "initiated refresh"
14                         else:
15                                 output = "could not initiate refresh"
16                 else:
17                         output = "unknown command"
18                 return http.Response(responsecode.OK, stream = output)
19