From 756416e135aeca49443d2259edf1fb108a090ffb Mon Sep 17 00:00:00 2001 From: Yannik Schmidt Date: Sun, 27 Jan 2019 18:05:01 +0100 Subject: [PATCH] add initializer --- startInsurgency.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 startInsurgency.py diff --git a/startInsurgency.py b/startInsurgency.py new file mode 100644 index 0000000..1f257fa --- /dev/null +++ b/startInsurgency.py @@ -0,0 +1,27 @@ +#!/usr/bin/python3 +import Storrage +import sys +import NetworkParser +import FileInStream +import argparse + +parser = argparse.ArgumentParser(description='Insurgency rating python backend server') +parser.add_argument('files', metavar='FILE', type=str, nargs='+',\ + help='one or more logfiles to parse') +parser.add_argument('--parse-only','-po',dest='parse_only', action='store_const',\ + const=True, default=False,help="only parse, do not listen for queries") +parser.add_argument('--start-at-end','-se',dest='start_at_end', action='store_const',\ + const=True, default=False,help="start at the end of each file (implies follow)") +parser.add_argument('--no-follow','-nf',dest='nofollow', action='store_const',\ + const=True, default=False,help="wait for changes on the files (does not imply start-at-end)") + +if __name__ == "__main__": + args = parser.parse_args() + FileInStream.readfiles( args.files ,\ + args.start_at_end,\ + args.nofollow, + ) + if not args.parse_only: + Query.listen() + else: + sys.exit(0)