changeset 33:25843238434a

Change the Python module's name back to rlgall. It is no longer an experimental variant. Using a database as a backend is a settled feature.
author John "Elwin" Edwards
date Thu, 02 Jan 2014 13:09:48 -0500
parents 05a4afbe6299
children 86b616d88020
files README.txt py/cleandb.py py/recorder.py py/rlgall.py py/rlgalldb.py py/setupdb.py py/stats.py web/archive.cgi web/recent.cgi web/scoring/players/index.cgi
diffstat 10 files changed, 529 insertions(+), 527 deletions(-) [+]
line wrap: on
line diff
--- a/README.txt	Thu Jan 02 11:48:15 2014 -0500
+++ b/README.txt	Thu Jan 02 13:09:48 2014 -0500
@@ -12,7 +12,7 @@
 py/recorder.py processes the log files and stores the data in a PostgreSQL
 database.  It should be run periodically by cron.
 
-py/rlgalldb.py is a module which recorder.py requires.  It should be installed
+py/rlgall.py is a module which recorder.py requires.  It should be installed
 in /lib/python<x.y>/site-packages or the equivalent location.
 
 web/ contains the static parts of the rlgallery.org website.  Note that when 
--- a/py/cleandb.py	Thu Jan 02 11:48:15 2014 -0500
+++ b/py/cleandb.py	Thu Jan 02 13:09:48 2014 -0500
@@ -1,7 +1,7 @@
 #!/usr/bin/python3
 # cleandb.py: empty the database in an orderly fashion
 
-import rlgalldb as rlgall
+import rlgall
 import psycopg2
 
 dbconn = psycopg2.connect("dbname=rlg")
--- a/py/recorder.py	Thu Jan 02 11:48:15 2014 -0500
+++ b/py/recorder.py	Thu Jan 02 13:09:48 2014 -0500
@@ -2,7 +2,7 @@
 
 import os
 import psycopg2
-import rlgalldb as rlgall
+import rlgall
 
 # Contains a dir for everyone who registered
 everydir = "/var/dgl/dgldir/ttyrec/"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/py/rlgall.py	Thu Jan 02 13:09:48 2014 -0500
@@ -0,0 +1,516 @@
+# rlgall.py
+# Module for the Roguelike Gallery, using a postgres database
+# Requires Python 3.3
+
+import os
+import psycopg2
+from datetime import datetime
+import pytz
+
+# Configuration
+logdir = "/var/dgl/var/games/roguelike/"
+webdir = "/var/www/lighttpd/scoring/"
+ppagename = webdir + "players/{0}.html"
+hpagename = webdir + "highscores.html"
+
+# HTML fragments for templating
+phead = """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html><head>
+<title>{0}</title>
+<link rel="stylesheet" href="/scoring/scores.css" type="text/css">
+</head>
+"""
+
+ptop = """<body>
+<h1>Yendor Guild</h1>
+"""
+
+navtop = '<div class="nav"><a href="/">rlgallery.org</a> -&gt; {0}</div>\n'
+navscore = '<div class="nav"><a href="/">rlgallery.org</a> -&gt; \
+<a href="/scoring/">Scores</a> -&gt; {0}</div>\n'
+navplayer = '<div class="nav"><a href="/">rlgallery.org</a> -&gt; \
+<a href="/scoring/">Scores</a> -&gt; <a href="/scoring/players/">Players</a> \
+-&gt; {0}</div>'
+
+pti = '<h2>{0}</h2>\n'
+
+secthead = '<h3>{0}</h3>\n'
+tblhead = '<div class="stable">\n'
+rowstart = '<div class="sentry">\n'
+rowend = '</div>\n'
+cell = '  <span class="sdata">{0}</span>\n'
+rcell = '  <span class="sdatar">{0}</span>\n'
+hcell = '  <span class="shdata">{0}</span>\n'
+tblend = '</div>\n'
+pend = "</body></html>\n"
+