Library viewer

This gives the web interface a list of artists and albums currently in
the library.
This commit is contained in:
Bryan Schumaker 2010-11-16 23:05:10 -05:00
parent ac8c4abd9e
commit f0f6573d09
1 changed files with 22 additions and 0 deletions

22
html/library.py Normal file
View File

@ -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("<html><body>")
def footer(wfile):
wfile.write("</body></html>")
def body(wfile):
for artist, ar_key in library.artists():
wfile.write("<h2>%s</h2>" % artist)
for album, al_key in library.albums(ar_key):
wfile.write("%s<br>" % album)
def to_html(wfile):
header(wfile)
body(wfile)
footer(wfile)