ocarina/html/library.py

25 lines
616 B
Python

# 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):
link = "<a href=\"album.py?artist=%s&album=%s\">%s</a><br>"
for artist, ar_key in library.artists():
wfile.write("<h2>%s</h2>" % artist)
for album, al_key in library.albums(ar_key):
wfile.write(link % (ar_key, al_key, album))
#wfile.write("<a href=\"album.py?artist=\">%s</a><br>" % album)
def to_html(wfile, args):
header(wfile)
body(wfile)
footer(wfile)