ocarina/libsaria/server/pages/rpc.py

56 lines
935 B
Python

# Bryan Schumaker (5 / 15 / 2011)
from libsaria import sources
from libsaria import controls
def play(write):
controls.play()
def pause(write):
controls.pause()
def next(write):
controls.next()
def stop(write):
controls.stop()
def forward(write):
controls.seek_forward()
def rewind(write):
controls.seek_backward()
def play_id(write, id):
sources.play_id(long(id[0]))
def title(write):
write(sources.get_attrs("title")[0])
def artist(write):
write(sources.get_attrs("artist")[0])
def album(write):
write(sources.get_attrs("album")[0])
def playing(write):
write(controls.playing())
rpc = {
"play":(play, "html"),
"pause":(pause, "html"),
"stop":(stop, "html"),
"next":(next, "html"),
"forward":(forward, "html"),
"rewind":(rewind, "html"),
"title":(title, "html"),
"artist":(artist, "html"),
"album":(album, "html"),
"playing":(playing, "html"),
"play_id":(play_id, "html"),
}
docs = {
"RPC":rpc,
}