README/comment update.

This commit is contained in:
- 2022-02-20 07:00:01 -08:00
parent 832e4b97a9
commit 3850cf3032
2 changed files with 8 additions and 6 deletions

View File

@ -8,11 +8,11 @@ A common gateway inferface (CGI) program written in C to display data related to
The first is only needed for compilation of the C program. The latter two are only for the auxiliary script `allmaps.py`. The first is only needed for compilation of the C program. The latter two are only for the auxiliary script `allmaps.py`.
## Compiling ## Compiling
`make` makes a cgi program. `make` makes a CGI program.
`make staticgen` makes a static page generator. `make staticgen` makes a static page generator.
## CGI Query Strings ## Usage: CGI Query Strings
The program queries the database `db/cts.db` (`./src/dbquery.c`, function `static bool executequery`) The program queries the database `db/cts.db` (`./src/dbquery.c`, function `static bool executequery`)
* `(none)` * `(none)`
@ -27,8 +27,10 @@ The program queries the database `db/cts.db` (`./src/dbquery.c`, function `stati
- Query file: `queries/rplayers.sql` - Query file: `queries/rplayers.sql`
- Requests a player's ranks for all maps leaderboards s/he is present on. - Requests a player's ranks for all maps leaderboards s/he is present on.
## Static Page Generation ## Usage: Static Page Generation
The files `allmaps.py`, `output/leaderboard.css`, `template-generic.html`, `template_map-generic.html` are for static page generation. Before executing `allmaps.py`, copy and modify the templates. The CGI program is still invoked in static generation. The files `allmaps.py`, `output/leaderboard.css`, `template.html`, `template_map.html` help produce the output.
Before executing `allmaps.py`, copy and modify the templates.
cp ./template-generic.html ./template.html cp ./template-generic.html ./template.html
cp ./template_map-generic.html ./template_map.html cp ./template_map-generic.html ./template_map.html
@ -42,8 +44,8 @@ The files `allmaps.py`, `output/leaderboard.css`, `template-generic.html`, `temp
* Xonotic 0.8.2 * Xonotic 0.8.2
## Compilers ## Compilers
* gcc (GCC) 10.2.1
* MinGW, GCC 4.7.1 * MinGW, GCC 4.7.1
__________________ __________________
This program uses an sqlite3 database file created from `~/.xonotic/data/data/server.db`. This program uses an sqlite3 database file created from `~/.xonotic/data/data/server.db`.

View File

@ -31,7 +31,6 @@ def renderindex(template):
pass pass
def main(): def main():
# for each map generate an html file.
template = "" template = ""
with open("template.html", 'r') as fin: with open("template.html", 'r') as fin:
template = fin.read() template = fin.read()
@ -39,6 +38,7 @@ def main():
maps = getmaps("db/cts.db") maps = getmaps("db/cts.db")
with open("template_map.html", 'r') as fin: with open("template_map.html", 'r') as fin:
template = fin.read() template = fin.read()
# for each map generate an html file.
for game_map in maps: for game_map in maps:
# game_map is a tuple obj. # game_map is a tuple obj.
map_name = game_map[0] map_name = game_map[0]