add -nod/--noonlinedc cli-flag

This commit is contained in:
Thor77 2016-06-23 21:42:03 +02:00
parent 0aa0c7b7ea
commit 487a50508f
4 changed files with 11 additions and 4 deletions

View File

@ -17,6 +17,7 @@ A simple Teamspeak stat-generator - based on server-logs
# CMD-Arguments # CMD-Arguments
``` ```
usage: tsstats [-h] [-c CONFIG] [--idmap IDMAP] [-l LOG] [-o OUTPUT] [-d] usage: tsstats [-h] [-c CONFIG] [--idmap IDMAP] [-l LOG] [-o OUTPUT] [-d]
[-nod]
A simple Teamspeak stats-generator - based on server-logs A simple Teamspeak stats-generator - based on server-logs
@ -29,6 +30,7 @@ optional arguments:
-o OUTPUT, --output OUTPUT -o OUTPUT, --output OUTPUT
path to the output-file path to the output-file
-d, --debug debug mode -d, --debug debug mode
-nod, --noonlinedc don't add connect until now to onlinetime
``` ```
# Configuration # Configuration

View File

@ -56,7 +56,7 @@ author = 'Thor77'
# The short X.Y version. # The short X.Y version.
version = '0.7' version = '0.7'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '0.7.2' release = '0.7.3'
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.

View File

@ -2,7 +2,7 @@ from setuptools import setup
setup( setup(
name='tsstats', name='tsstats',
version='0.7.2', version='0.7.3',
author='Thor77', author='Thor77',
author_email='thor77@thor77.org', author_email='thor77@thor77.org',
description='A simple Teamspeak stats-generator', description='A simple Teamspeak stats-generator',

View File

@ -36,11 +36,16 @@ def cli():
'-d', '--debug', '-d', '--debug',
help='debug mode', action='store_true' help='debug mode', action='store_true'
) )
parser.add_argument(
'-nod', '--noonlinedc',
help='don\'t add connect until now to onlinetime', action='store_false'
)
args = parser.parse_args() args = parser.parse_args()
main(**vars(args)) main(**vars(args))
def main(config=None, idmap=None, log=None, output=None, debug=False): def main(config=None, idmap=None, log=None,
output=None, debug=False, noonlinedc=True):
if debug: if debug:
logger.setLevel(logging.DEBUG) logger.setLevel(logging.DEBUG)
@ -64,7 +69,7 @@ def main(config=None, idmap=None, log=None, output=None, debug=False):
if not log or not output: if not log or not output:
raise InvalidConfiguration('log or output missing') raise InvalidConfiguration('log or output missing')
clients = parse_logs(log, ident_map=identmap) clients = parse_logs(log, ident_map=identmap, online_dc=noonlinedc)
render_template(clients, output=abspath(output)) render_template(clients, output=abspath(output))