Mercurial > hg > rlgallery-misc
annotate web/scoring/players/index.cgi @ 44:7c789e87ee5d
Rearrange the statistics pages.
Move each game's charts onto individual pages.  Put links to these
pages on /scoring/index.html, instead of dumping all the charts there.
| author | John "Elwin" Edwards | 
|---|---|
| date | Thu, 16 Jan 2014 11:04:45 -0800 | 
| parents | 25843238434a | 
| children | 6138c27d1950 | 
| rev | line source | 
|---|---|
| 30 | 1 #!/usr/bin/python3 | 
| 
10
 
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 | 
| 
33
 
25843238434a
Change the Python module's name back to rlgall.
 
John "Elwin" Edwards 
parents: 
30 
diff
changeset
 | 
5 import rlgall | 
| 
10
 
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 | 
| 30 | 18 sys.stdout.write("Content-Type: text/html; charset=utf-8\r\n\r\n") | 
| 
10
 
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) | 
