From 2adffa08e8201ea0ebe72e0d143537f28928a86e Mon Sep 17 00:00:00 2001 From: Jylpah Date: Fri, 10 Jul 2020 15:00:00 +0300 Subject: [PATCH] Fix DB support --- analyze_wotb_replays.py | 7 ++++--- blitzutils.py | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/analyze_wotb_replays.py b/analyze_wotb_replays.py index 14d13c4..c0bcabf 100644 --- a/analyze_wotb_replays.py +++ b/analyze_wotb_replays.py @@ -1138,10 +1138,10 @@ async def mk_replayQ(queue : asyncio.Queue, args : argparse.Namespace, db : moto bu.debug(str(args.filters)) filters = json.loads(args.filters) bu.debug(json.dumps(filters, indent=2)) - cursor = dbc.find(filters, {'_id': 0 }) + cursor = dbc.find(filters) else: # select all - cursor = dbc.find({}, {}) + cursor = dbc.find({}) bu.debug('Reading replays...') async for replay_json in cursor: _id = replay_json['_id'] @@ -1257,7 +1257,8 @@ async def read_replay_JSON(replay_json: dict, args : argparse.Namespace) -> dict #db = args.db result = {} try: - if (replay_json['data']['summary']['mastery_badge'] == None) or (replay_json['data']['summary']['battle_result'] < 0): + # bu.debug(str(replay_json)) + if not wi.chk_JSON_replay(replay_json): bu.debug('Invalid replay') return None diff --git a/blitzutils.py b/blitzutils.py index 298e4df..0356170 100644 --- a/blitzutils.py +++ b/blitzutils.py @@ -350,7 +350,10 @@ def NOW() -> int: def rebase_file_args(current_dir, files): """REbase file command line params after moving working dir to the script's dir""" - return [ os.path.join(current_dir, fn) for fn in files ] + if (files[0] == '-') or (files[0] == 'db:'): + return files + else: + return [ os.path.join(current_dir, fn) for fn in files ] async def read_int_list(filename: str) -> list(): """Read file to a list and return list of integers in the input file"""