Mercurial > hg > rlgallery-misc
annotate web/scoring/players/index.cgi @ 26:b003235abe75
Add lighttpd configuration files.
author | John "Elwin" Edwards |
---|---|
date | Mon, 28 Oct 2013 20:33:23 -0700 |
parents | 17f656035775 |
children | e8f3b7994d88 |
rev | line source |
---|---|
10
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
1 #!/usr/bin/python |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
2 |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
3 import os |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
4 import sys |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
5 import rlgall |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
6 |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
7 playerdir = "/var/www/lighttpd/scoring/players/" |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
8 linkstr = '<li><a href="./{0}.html">{0}</a></li>\n' |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
9 |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
10 filelist = os.listdir(playerdir) |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
11 namelist = [] |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
12 |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
13 for filename in filelist: |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
14 if filename.endswith(".html"): |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
15 namelist.append(filename.rsplit(".html", 1)[0]) |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
16 namelist.sort() |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
17 |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
18 sys.stdout.write("Content-type: text/html\r\n\r\n") |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
19 sys.stdout.write(rlgall.phead.format("Players")) |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
20 sys.stdout.write(rlgall.ptop) |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
21 sys.stdout.write(rlgall.navscore.format("Players")) |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
22 sys.stdout.write(rlgall.pti.format("Players")) |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
23 |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
24 if not namelist: |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
25 sys.stdout.write("<p>No one is here.</p>\n") |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
26 else: |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
27 sys.stdout.write("<ul>\n") |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
28 for name in namelist: |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
29 sys.stdout.write(linkstr.format(name)) |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
30 sys.stdout.write("</ul>\n") |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
31 |
17f656035775
Import the web/scoring/ files.
John "Elwin" Edwards <elwin@sdf.org>
parents:
diff
changeset
|
32 sys.stdout.write(rlgall.pend) |