xdfcgi/README.md

68 lines
1.9 KiB
Markdown
Raw Normal View History

2024-10-12 23:45:11 +05:30
# xdfcgi
A common gateway inferface (CGI) program written in C to display Race CTS leaderboards of Xonotic servers. It can also be a static page generator.
2017-09-12 14:45:57 +05:30
## Requirements
2024-10-12 23:45:11 +05:30
sqlite-devel python3 python-sqlite
## Compiling
`make` makes a static page generator.
2024-10-12 23:45:11 +05:30
`make cgi` makes a CGI program.
2024-10-12 23:45:11 +05:30
2024-10-14 01:08:11 +05:30
## Usage: Import data from Xonotic
This program uses an sqlite3 database file created from `~/.xonotic/data/data/server.db` (text).
2024-10-14 01:08:11 +05:30
sqlite3 my-new.db
sqlite > .read schema.sql
python scripts/import-from-xon.py my-new.db ~/.xonotic/data/data/server.db
## Usage: (CGI) Queries
2017-09-12 14:45:57 +05:30
* `(none)`
- file: `queries/mranks.sql`
- Requests the map list of the server, the best times scored per map and by which player.
* `?fastest-players`
- file: `queries/fastest-players.sql`
- Requests the map list of the server, the highest velocities attained per map and by which player.
2017-09-12 14:45:57 +05:30
* `?map=[map name]`
- file: `queries/mleaderboard-ojoin.sql`
2017-09-12 14:45:57 +05:30
- Requests the leaderboard of the map.
* `?player=[clientid]`
- file: `queries/rplayers.sql`
2017-09-12 14:45:57 +05:30
- Requests a player's ranks for all maps leaderboards s/he is present on.
`queries/fastest-player-of-map.sql` is used exclusively by the python script `scripts/allmaps.py`.
2024-10-12 23:45:11 +05:30
## Usage: Static Page Generation
python scripts/allmaps.py
The files `allmaps.py`, `output/leaderboard.css`, `overview.html`, `map.html` produce the output.
2024-10-12 23:45:11 +05:30
Before executing `allmaps.py`, copy and modify the templates.
cp templates/overview.html .
cp templates/map.html .
`allmaps.py` outputs an html file for all distinct maps in the database. The leaderboards for each map (equivalent to `?map=[map name]`) are in `output/maps/`.
2017-09-12 14:45:57 +05:30
## Game Versions Used Under:
2024-10-14 01:08:11 +05:30
* Xonotic 0.8.1
* Xonotic 0.8.2
2017-09-12 14:45:57 +05:30
## Compilers
2024-10-14 01:08:11 +05:30
2024-10-12 23:45:11 +05:30
* gcc (GCC) 10.2.1
2017-09-12 14:45:57 +05:30
* MinGW, GCC 4.7.1
2017-09-12 14:45:57 +05:30
__________________
2024-10-14 01:08:11 +05:30
The script `scripts/import-from-xon.py` is based on `https://git.teknik.io/antares/xonotic-py-sqlite3-defrag2db` by [Antares](https://antares.neocities.org/).