rlgallery-misc/web/scoring/players/index.cgi
John "Elwin" Edwards f272772dcb Change the Python module's name back to rlgall.
It is no longer an experimental variant.  Using a database as a backend
is a settled feature.
2014-01-02 13:09:48 -05:00

32 lines
807 B
Python
Executable file

#!/usr/bin/python3
import os
import sys
import rlgall
playerdir = "/var/www/lighttpd/scoring/players/"
linkstr = '<li><a href="./{0}.html">{0}</a></li>\n'
filelist = os.listdir(playerdir)
namelist = []
for filename in filelist:
if filename.endswith(".html"):
namelist.append(filename.rsplit(".html", 1)[0])
namelist.sort()
sys.stdout.write("Content-Type: text/html; charset=utf-8\r\n\r\n")
sys.stdout.write(rlgall.phead.format("Players"))
sys.stdout.write(rlgall.ptop)
sys.stdout.write(rlgall.navscore.format("Players"))
sys.stdout.write(rlgall.pti.format("Players"))
if not namelist:
sys.stdout.write("<p>No one is here.</p>\n")
else:
sys.stdout.write("<ul>\n")
for name in namelist:
sys.stdout.write(linkstr.format(name))
sys.stdout.write("</ul>\n")
sys.stdout.write(rlgall.pend)