comparison web/scoring/players/index.cgi @ 10:17f656035775

Import the web/scoring/ files.
author John "Elwin" Edwards <elwin@sdf.org>
date Wed, 05 Sep 2012 22:34:00 -0700
parents
children e8f3b7994d88
comparison
equal deleted inserted replaced
9:84c8e2c0b7f3 10:17f656035775
1 #!/usr/bin/python
2
3 import os
4 import sys
5 import rlgall
6
7 playerdir = "/var/www/lighttpd/scoring/players/"
8 linkstr = '<li><a href="./{0}.html">{0}</a></li>\n'
9
10 filelist = os.listdir(playerdir)
11 namelist = []
12
13 for filename in filelist:
14 if filename.endswith(".html"):
15 namelist.append(filename.rsplit(".html", 1)[0])
16 namelist.sort()
17
18 sys.stdout.write("Content-type: text/html\r\n\r\n")
19 sys.stdout.write(rlgall.phead.format("Players"))
20 sys.stdout.write(rlgall.ptop)
21 sys.stdout.write(rlgall.navscore.format("Players"))
22 sys.stdout.write(rlgall.pti.format("Players"))
23
24 if not namelist:
25 sys.stdout.write("<p>No one is here.</p>\n")
26 else:
27 sys.stdout.write("<ul>\n")
28 for name in namelist:
29 sys.stdout.write(linkstr.format(name))
30 sys.stdout.write("</ul>\n")
31
32 sys.stdout.write(rlgall.pend)