implement ffa parsing

This commit is contained in:
Yannik Schmidt
2019-07-07 16:52:14 +02:00
parent bc36a16bf5
commit d5376c6184
2 changed files with 46 additions and 1 deletions

View File

@@ -8,6 +8,9 @@ import NetworkListener
import httpAPI
from threading import Thread
import backends.genericFFA as ffaParser
import insurgencyParsing as iparser
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')
@@ -24,16 +27,26 @@ parser.add_argument('--one-thread', dest='oneThread', action='store_const',\
help="run everything in main thread (implies no-follow)")
parser.add_argument('--cache-file', dest='cacheFile',\
help="A cache file which makes restarting the system fast")
parser.add_argument('--ffa', action='store_const', default=False, const=True, \
help="Use the free-for-all parser")
if __name__ == "__main__":
args = parser.parse_args()
if args.cacheFile:
open(args.cacheFile, "a").close()
if args.ffa:
parser = ffaParser
else:
parser = iparser
FileReader.readfiles( args.files ,\
start_at_end=args.start_at_end,\
nofollow=args.nofollow, \
oneThread=args.oneThread, \
cacheFile=args.cacheFile)
cacheFile=args.cacheFile, \
parsingBackend=parser)
if not args.parse_only:
print("Starting network-listener(s)")
Thread(target=httpAPI.app.run).start()