From f0f6573d090ab45ada342e55bf75f7ec1286b695 Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Tue, 16 Nov 2010 23:05:10 -0500 Subject: [PATCH] Library viewer This gives the web interface a list of artists and albums currently in the library. --- html/library.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 html/library.py diff --git a/html/library.py b/html/library.py new file mode 100644 index 00000000..4924becc --- /dev/null +++ b/html/library.py @@ -0,0 +1,22 @@ +# Bryan Schumaker +import libsaria +library = libsaria.sources.library +walk = library.walk +get_attrs = library.get_attrs + +def header(wfile): + wfile.write("") + +def footer(wfile): + wfile.write("") + +def body(wfile): + for artist, ar_key in library.artists(): + wfile.write("

%s

" % artist) + for album, al_key in library.albums(ar_key): + wfile.write("%s
" % album) + +def to_html(wfile): + header(wfile) + body(wfile) + footer(wfile)