#!/usr/bin/python from HTMLParser import HTMLParser import os, cgi print """Content-Type: text/html Special Photo Series


""" class MyHTMLParser(HTMLParser): def __init__(self, fn): HTMLParser.__init__(self) self.is_title = False self.title = "" self.feed(file(fn).read()) def handle_starttag(self, tag, attrs): if tag == "title": self.is_title = True def handle_endtag(self, tag): if tag == "title": self.is_title = False def handle_data(self, data): if self.is_title: self.title += data def get_title(fn): p = MyHTMLParser(fn) return p.title l = [] for f in os.listdir("."): if not f.endswith(".html") and not f.endswith(".htm"): continue l.append((get_title(f), f)) l.sort() for t, f in l: print "

%s" % (cgi.escape(f), cgi.escape(t)) print """


All Panoramas

All Photo Series




"""