add basic webif hook to force scan -> http(s)://<ip or hostname>/autotimer?parse
authorMoritz Venn <ritzmo@users.schwerkraft.elitedvb.net>
Tue, 11 Aug 2009 10:22:44 +0000 (10:22 +0000)
committerMoritz Venn <ritzmo@users.schwerkraft.elitedvb.net>
Tue, 11 Aug 2009 10:22:44 +0000 (10:22 +0000)
autotimer/src/AutoTimerResource.py [new file with mode: 0644]
autotimer/src/Makefile.am
autotimer/src/webinterface/AutoTimer.py [new file with mode: 0644]
autotimer/src/webinterface/Makefile.am [new file with mode: 0755]

diff --git a/autotimer/src/AutoTimerResource.py b/autotimer/src/AutoTimerResource.py
new file mode 100644 (file)
index 0000000..cc2b170
--- /dev/null
@@ -0,0 +1,27 @@
+from twisted.web2 import resource, responsecode, http
+from AutoTimer import AutoTimer
+from plugin import autotimer
+from . import _
+
+# pretty basic resource which is just present to have a way to start a
+# forced run through the webif
+class AutoTimerResource(resource.Resource):
+       def __init__(self):
+               resource.Resource.__init__(self)
+
+       def render(self, req):
+               remove = False
+               if autotimer is None:
+                       autotimer = AutoTimer()
+                       remove = True
+
+               if req.args.has_key("parse"):
+                       ret = autotimer.parseEPG()
+                       output = _("Found a total of %d matching Events.\n%d Timer were added and %d modified.") % (ret[0], ret[1], ret[2])
+               else:
+                       output = "unknown command"
+
+               if remove:
+                       autotimer = None
+               return http.Response(responsecode.OK ,stream = output)
+
index 030700f..cd9887d 100755 (executable)
@@ -1,4 +1,6 @@
 installdir = /usr/lib/enigma2/python/Plugins/Extensions/AutoTimer\r
 \r
+SUBDIRS = webinterface\r
+\r
 install_PYTHON = *.py\r
 install_DATA = plugin.png autotimerwizard.xml maintainer.info LICENSE\r
diff --git a/autotimer/src/webinterface/AutoTimer.py b/autotimer/src/webinterface/AutoTimer.py
new file mode 100644 (file)
index 0000000..cd9c3d0
--- /dev/null
@@ -0,0 +1,5 @@
+from Plugins.Extensions.WebInterface.WebChilds.Toplevel import addExternalChild
+from Plugins.Extensions.AutoTimer.AutoTimerResource import AutoTimerResource
+
+addExternalChild( ("autotimer", AutoTimerResource()) )
+
diff --git a/autotimer/src/webinterface/Makefile.am b/autotimer/src/webinterface/Makefile.am
new file mode 100755 (executable)
index 0000000..a669979
--- /dev/null
@@ -0,0 +1,3 @@
+installdir = /usr/lib/enigma2/python/Plugins/Extensions/WebInterface/WebChilds/External/
+
+install_PYTHON = *.py