2016-05-18 21:40:21 +02:00
# TeamspeakStats [](https://travis-ci.org/Thor77/TeamspeakStats) [](https://coveralls.io/github/Thor77/TeamspeakStats?branch=master) [](https://landscape.io/github/Thor77/TeamspeakStats/master) [](https://pypi.python.org/pypi/tsstats) [](http://teamspeakstats.readthedocs.io/en/latest/?badge=latest)
2015-03-05 18:48:10 +01:00
A simple Teamspeak stat-generator - based on server-logs
2015-03-05 18:53:47 +01:00
2016-05-11 20:39:45 +02:00

2015-07-13 21:14:03 +02:00
# Installation
2016-05-11 20:40:23 +02:00
- Install the package via PyPi `pip install tsstats`
2016-10-28 23:42:44 +02:00
- Clone this repo `git clone https://github.com/Thor77/TeamspeakStats` and install with `python setup.py install`
- Just use the package as is via `python -m tsstats [-h]`
2015-07-13 21:14:03 +02:00
2015-03-13 21:03:42 +01:00
# Usage
2016-05-11 20:40:23 +02:00
- Run the script `tsstats [-h]`
2016-10-30 20:41:38 +01:00
- Optionally create a config-file (see [Configuration ](https://github.com/Thor77/TeamspeakStats#configuration ))
2015-03-13 21:03:42 +01:00
2016-10-30 21:07:00 +01:00
# Example
```
tsstats -l /var/log/teamspeak3-server/ts3server*.log -o /var/www/tsstats.html
```
Parse logs matching `ts3server*.log` in `/var/log/teamspeak3-server` and write output to `/var/www/tsstats.html`
2016-10-30 21:08:27 +01:00
# CLI-Usage
2015-08-26 20:00:48 +02:00
```
2016-06-08 18:12:57 +02:00
usage: tsstats [-h] [-c CONFIG] [--idmap IDMAP] [-l LOG] [-o OUTPUT] [-d]
2016-06-23 21:42:03 +02:00
[-nod]
2015-08-26 20:00:48 +02:00
A simple Teamspeak stats-generator - based on server-logs
optional arguments:
2016-06-08 18:12:57 +02:00
-h, --help show this help message and exit
-c CONFIG, --config CONFIG
path to config
--idmap IDMAP path to id_map
-l LOG, --log LOG path to your logfile(s)
-o OUTPUT, --output OUTPUT
path to the output-file
-d, --debug debug mode
2016-06-23 21:42:03 +02:00
-nod, --noonlinedc don't add connect until now to onlinetime
2016-08-10 23:10:23 +02:00
-t TEMPLATE, --template TEMPLATE
path to custom template
2016-09-17 22:47:04 +02:00
-dtf DATETIMEFORMAT, --datetimeformat DATETIMEFORMAT
format of date/time-values (datetime.strftime)
2016-11-11 18:45:52 +01:00
-otth ONLINETIMETHRESHOLD, --onlinetimethreshold ONLINETIMETHRESHOLD
threshold for displaying onlinetime (in seconds)
2015-08-26 20:00:48 +02:00
```
2015-03-05 18:53:47 +01:00
# Configuration
2016-05-10 23:05:12 +02:00
#### [General]
| Key | Description |
|-----|-------------|
| log | Path to TS3Server-logfile(s) (supports [globbing ](https://docs.python.org/3/library/glob.html )) |
| output | Path to the location, where the generator will put the generated `.html` -file |
2016-06-08 18:12:57 +02:00
| idmap | Path to [IdentMap ](http://teamspeakstats.readthedocs.io/en/latest/identmap.html ) |
| debug | debug mode |
2016-06-25 20:45:46 +02:00
| onlinedc | Add timedelta from last-connect until now to onlinetime for connected clients |
2016-08-10 23:10:23 +02:00
| template | Path to a custom template file (relative from `tsstats/` or absolute) |
2016-09-17 22:47:04 +02:00
| datetimeformat | Format of date/time-values used for render-timestamp and last online (using [datetime.strftime ](https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior )) |
2016-11-14 21:28:02 +01:00
| onlinetimethreshold | Clients with an onlinetime below that threshold (in seconds) are hidden in the onlinetime-section |
2015-05-18 19:43:37 +02:00
2015-03-05 18:53:47 +01:00
## Example
```
[General]
2016-05-10 23:05:12 +02:00
log = /usr/local/bin/teamspeak-server/logs/ts3server*_1.log
output = /var/www/html/stats.html
2015-05-12 21:38:34 +02:00
```
2016-10-30 19:49:19 +01:00
# Contributing
Please make sure tests are succeeding and your code follows [flake8 ](https://flake8.readthedocs.io )-guidelines.
## Run tests
- Install testing-requirements `pip install -r testing_requirements.txt`
- Run `py.test tsstats/`
2015-03-13 21:03:42 +01:00
# TODO
- Localization