From 961eacf3c4015fa57de83376f3deb19bd60ffa7d Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Sun, 26 Dec 2010 22:51:18 -0500 Subject: [PATCH] Began new library browser The new library browser will eventually morph into a web-based clone of the desktop Ocarina application. --- html/index.html | 1 + html/library2.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 html/library2.py diff --git a/html/index.html b/html/index.html index 12d58e4f..8f0d5577 100644 --- a/html/index.html +++ b/html/index.html @@ -20,6 +20,7 @@ function set_version() +
Library Browser
Library Browser 2
Remote Controls
diff --git a/html/library2.py b/html/library2.py new file mode 100644 index 00000000..5f3c0af7 --- /dev/null +++ b/html/library2.py @@ -0,0 +1,45 @@ +# Bryan Schumaker (12 / 26 / 2010) + +import libsaria +library = libsaria.sources.library +walk = library.walk +get_attrs = library.get_attrs + +cols = [("Title", 400), ("Length", 60), ("Artist", 200), ("Album", 200), ("Year", 50)] + +def header(wfile): + wfile.write("") + +def footer(wfile): + wfile.write("") + +def content_header(wfile): + wfile.write("") + for col, width in cols: + wfile.write("" % (width, col)) + wfile.write("
%s
") + wfile.write("
") + +def body(wfile): + wfile.write("header stuff goes here") + content_header(wfile) + wfile.write("
") + wfile.write("") + colors = ["white", "aliceblue"] + i = 0 + for id in walk(): + wfile.write("") + for index, attr in enumerate(get_attrs(id, "title", "lenstr", "artist", "album", "year")): + wfile.write("" % (cols[index][1], colors[i], attr)) + wfile.write("") + if i == 0: + i = 1 + else: + i = 0 + wfile.write("
%s
") + wfile.write("footer stuff goes here") + +def to_html(wfile, args): + header(wfile) + body(wfile) + footer(wfile)