ocarina/libsaria/server/request.py
Bryan Schumaker c02bffb652 libsaria: Web server controls playback
I can choose songs to play by clicking rows in an html table.  I also
write text to the client as it becomes available, rather than doing it
all at once.
2011-05-15 15:39:14 -04:00

20 lines
473 B
Python

# Bryan Schumaker (5 / 15 / 2011)
from BaseHTTPServer import BaseHTTPRequestHandler
import files
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
path = files.format_path(self.path)
if not files.find_file(path):
self.send_error(404, "File Not Found: %s" % path)
return
type = files.get_type(path)
self.send_response(200)
self.send_header('Content-type', type)
self.end_headers()
files.send_file(self.wfile.write, path)
self.wfile.close()