From ff99de216c0067f9da87ba315656061c7b1b6d1e Mon Sep 17 00:00:00 2001 From: Yannik Schmidt Date: Sat, 2 Feb 2019 16:09:37 +0100 Subject: [PATCH] [git fast commit] 02. Feb 2019 - 16:09:37 --- StorrageBackend.py | 2 +- insurgencyParsing.py | 23 ++++++++++++----------- startInsurgency.py | 10 +++++++--- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/StorrageBackend.py b/StorrageBackend.py index bbad023..15b778b 100644 --- a/StorrageBackend.py +++ b/StorrageBackend.py @@ -28,7 +28,7 @@ def get_player_rank(p): return "N/A" -def dump_rating(top=0, forceMeanSort=False, enforceWhitelist=None): +def dumpRatings(top=0, forceMeanSort=False, enforceWhitelist=None): global known_players ret = "" if forceMeanSort: diff --git a/insurgencyParsing.py b/insurgencyParsing.py index 9091433..293b2e1 100644 --- a/insurgencyParsing.py +++ b/insurgencyParsing.py @@ -49,26 +49,27 @@ def parse(f, exit_of_eof=True, start_at_end=False): seek_start = True continue - + evalRound = False # and line and stop if it was round end # round_lines += [line] if last_line_was_winner and not is_round_end(line): f.seek(f.tell()-1,0) - break + evalRound = True elif is_round_end(line): last_round_end = line - break + evalRound = True elif is_winner_event(line): last_line_was_winner = True - # parse and evaluate round # - r=parseRoundFromLines(round_lines) - if not r: - return - try: - TS.evaluate_round(r) - except Warning as e: - pass + # parse and evaluate round # + if evalRound: + nextRound = parseRoundFromLines(round_lines) + round_lines = [] + if nextRound: + try: + TS.evaluate_round(nextRound) + except Warning as e: + pass def parseRoundFromLines(r): diff --git a/startInsurgency.py b/startInsurgency.py index 1707c9e..d029ed1 100755 --- a/startInsurgency.py +++ b/startInsurgency.py @@ -10,10 +10,14 @@ parser.add_argument('files', metavar='FILE', type=str, nargs='+',\ 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)") + const=True, default=False, \ + help="start at the end of each file (overwrites no-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)") - + const=True, default=False, \ + help="wait for changes on the files (does not imply start-at-end)") +parser.add_argument('--one-thread', dest='one-thread', action='store_const',\ + const=True, default=False, \ + help="run everything in main thread (implies no-follow)") if __name__ == "__main__": args = parser.parse_args() FileReader.readfiles( args.files ,\