From 7ffd4e14fda8e1cadb7997d543e156f190dda896 Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Sun, 15 May 2011 13:49:02 -0400 Subject: [PATCH] libsaria: Added RPC pages For now, I can play and pause. I'll eventually add more operations to the list. --- libsaria/server/pages/__init__.py | 5 +++-- libsaria/server/pages/root.py | 2 +- libsaria/server/pages/rpc.py | 20 ++++++++++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 libsaria/server/pages/rpc.py diff --git a/libsaria/server/pages/__init__.py b/libsaria/server/pages/__init__.py index 0852f0b5..ef80baa9 100644 --- a/libsaria/server/pages/__init__.py +++ b/libsaria/server/pages/__init__.py @@ -1,17 +1,18 @@ # Bryan Schumaker (5 / 15 / 2011) import root +import rpc docs = {} docs.update(root.docs) +docs.update(rpc.docs) types = { - "html":"text/html" + "html":"text/html", } def lookup(file): doc = docs - print doc, file, doc.get(file[0], None) for cmp in file: doc = doc.get(cmp, None) if doc == None: diff --git a/libsaria/server/pages/root.py b/libsaria/server/pages/root.py index 4d3e49ee..50bda57d 100644 --- a/libsaria/server/pages/root.py +++ b/libsaria/server/pages/root.py @@ -7,5 +7,5 @@ def index(): return text docs = { - "index.html":(index, "html") + "index.html":(index, "html"), } diff --git a/libsaria/server/pages/rpc.py b/libsaria/server/pages/rpc.py new file mode 100644 index 00000000..43f924fc --- /dev/null +++ b/libsaria/server/pages/rpc.py @@ -0,0 +1,20 @@ +# Bryan Schumaker (5 / 15 / 2011) + +from libsaria import controls + +def play(): + controls.play() + return "" + +def pause(): + controls.pause() + return "" + +rpc = { + "play.html":(play, "html"), + "pause.html":(pause, "html"), +} + +docs = { + "RPC":rpc, +}