73 lines
1.9 KiB
Python
73 lines
1.9 KiB
Python
# Bryan Schumaker (5 / 15 / 2011)
|
|
|
|
from libsaria import sources
|
|
|
|
SCRIPT = "<script type=\"text/javascript\" src=\"%s\"></script>"
|
|
|
|
def write_file(write, file):
|
|
f = open(file)
|
|
write(f.read())
|
|
f.close()
|
|
|
|
def index(write):
|
|
write_file(write, "html/index.html")
|
|
|
|
def library(write):
|
|
write("<html><head>")
|
|
write(SCRIPT % "controls.js")
|
|
write(SCRIPT % "utils.js")
|
|
write("</head><body><table>\n")
|
|
color = "white"
|
|
get_attrs = sources.library.get_attrs
|
|
for id in sources.library.list_ids():
|
|
title, artist, album = get_attrs(id, "title", "artist", "album")
|
|
write("<tr style=\"background:%s\" ondblclick=play_id(%s)>" % (color, id))
|
|
write("<td><a href=\"RPC/play_id/%s\" onclick=\"play_id(%s);return false\">%s</a></td>" % (id, id, title))
|
|
write("<td>%s</td><td>%s</td>\n" % (artist, album))
|
|
if color == "white":
|
|
color = "aliceblue"
|
|
else:
|
|
color = "white"
|
|
write("</table></body></html>")
|
|
|
|
def controls_page(write):
|
|
write_file(write, "html/controls.html")
|
|
|
|
def play_button(write):
|
|
write_file(write, "html/images/play.png")
|
|
|
|
def pause_button(write):
|
|
write_file(write, "html/images/pause.png")
|
|
|
|
def stop_button(write):
|
|
write_file(write, "html/images/stop.png")
|
|
|
|
def next_button(write):
|
|
write_file(write, "html/images/next.png")
|
|
|
|
def rewind_button(write):
|
|
write_file(write, "html/images/rewind.png")
|
|
|
|
def forward_button(write):
|
|
write_file(write, "html/images/forward.png")
|
|
|
|
def controls(write):
|
|
write_file(write, "html/controls.js")
|
|
|
|
def utils(write):
|
|
write_file(write, "html/utils.js")
|
|
|
|
docs = {
|
|
"index.html":(index, "html"),
|
|
"library.html":(library, "html"),
|
|
"controls.html":(controls_page, "html"),
|
|
"controls.js":(controls, "js"),
|
|
"utils.js":(utils, "js"),
|
|
"play.png":(play_button, "png"),
|
|
"pause.png":(pause_button, "png"),
|
|
"stop.png":(stop_button, "png"),
|
|
"next.png":(next_button, "png"),
|
|
"forward.png":(rewind_button, "png"),
|
|
"rewind.png":(forward_button, "png"),
|
|
}
|