2009-10-06 11:50:21 -06:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
import cgitb; cgitb.enable()
|
|
|
|
import os
|
|
|
|
|
2009-10-06 12:47:36 -06:00
|
|
|
import Config
|
|
|
|
|
2009-10-06 11:50:21 -06:00
|
|
|
print """Content-Type: text/html\n\n"""
|
|
|
|
print """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\n\n"""
|
|
|
|
head = open('head.html').read() % "Pflanzarr Results"
|
|
|
|
print head
|
|
|
|
print "<H1>Results</H1>"
|
2009-10-06 12:47:36 -06:00
|
|
|
print open('links.html').read()
|
2009-10-06 11:50:21 -06:00
|
|
|
|
|
|
|
try:
|
2009-10-06 12:47:36 -06:00
|
|
|
winner = open(os.path.join(Config.DATA_PATH, 'winner')).read()
|
2009-10-06 11:50:21 -06:00
|
|
|
except:
|
|
|
|
winner = "No winner yet."
|
|
|
|
|
|
|
|
print "<H3>Last Winner: ", winner, '<H3>'
|
|
|
|
print "<H2>Results so far:</H2>"
|
|
|
|
|
|
|
|
try:
|
2009-10-06 12:47:36 -06:00
|
|
|
games = os.listdir(os.path.join('results'))
|
2009-10-06 11:50:21 -06:00
|
|
|
except:
|
2009-10-06 12:47:36 -06:00
|
|
|
print '<p>The results directory does not exist.'
|
2009-10-06 11:50:21 -06:00
|
|
|
games = []
|
|
|
|
|
|
|
|
if not games:
|
|
|
|
print "<p>No games have occurred yet."
|
|
|
|
gameNums = []
|
|
|
|
for game in games:
|
|
|
|
try:
|
|
|
|
num = int(game)
|
2009-10-06 12:47:36 -06:00
|
|
|
path = os.path.join( 'results', game, 'results.html')
|
2009-10-06 11:50:21 -06:00
|
|
|
if os.path.exists( path ):
|
|
|
|
gameNums.append( int(num) )
|
|
|
|
else:
|
|
|
|
continue
|
|
|
|
|
|
|
|
except:
|
|
|
|
continue
|
|
|
|
|
|
|
|
gameNums.sort(reverse=True)
|
|
|
|
|
|
|
|
for num in gameNums:
|
|
|
|
print '<p>%d - ' % num,
|
2009-10-06 12:47:36 -06:00
|
|
|
print '<a href="results/%d/game.avi">v</a>' % num,
|
|
|
|
print '<a href="results/%d/results.html">r</a>' % num
|