view web/scoring/players/index.cgi @ 25:dd72d2dd923f

Move the inprogress dirs into a single directory. The inprogress dirs are now at /dgldir/inprogress/$GAME instead of /dgldir/inprogress-$GAME. This is less cluttered and may be more convenient for watching.
author John "Elwin" Edwards
date Sun, 20 Oct 2013 19:05:58 -0700
parents 17f656035775
children e8f3b7994d88
line wrap: on
line source

#!/usr/bin/python

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\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)