Merge pull request #20 from Jylpah/master

Fix DB support
This commit is contained in:
Jylpah authored and GitHub committed 2020-07-10 15:40:12 +03:00
commit c252c4dfbf
2 files changed
+7 -3

No files matched your search

+4 -3
View File
@@ -1138,10 +1138,10 @@ async def mk_replayQ(queue : asyncio.Queue, args : argparse.Namespace, db : moto
bu.debug(str(args.filters)) bu.debug(str(args.filters))
filters = json.loads(args.filters) filters = json.loads(args.filters)
bu.debug(json.dumps(filters, indent=2)) bu.debug(json.dumps(filters, indent=2))
cursor = dbc.find(filters, {'_id': 0 }) cursor = dbc.find(filters)
else: else:
# select all # select all
cursor = dbc.find({}, {}) cursor = dbc.find({})
bu.debug('Reading replays...') bu.debug('Reading replays...')
async for replay_json in cursor: async for replay_json in cursor:
_id = replay_json['_id'] _id = replay_json['_id']
@@ -1257,7 +1257,8 @@ async def read_replay_JSON(replay_json: dict, args : argparse.Namespace) -> dict
#db = args.db #db = args.db
result = {} result = {}
try: 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') bu.debug('Invalid replay')
return None return None
+3
View File
@@ -350,6 +350,9 @@ def NOW() -> int:
def rebase_file_args(current_dir, files): def rebase_file_args(current_dir, files):
"""REbase file command line params after moving working dir to the script's dir""" """REbase file command line params after moving working dir to the script's dir"""
if (files[0] == '-') or (files[0] == 'db:'):
return files
else:
return [ os.path.join(current_dir, fn) for fn in files ] return [ os.path.join(current_dir, fn) for fn in files ]
async def read_int_list(filename: str) -> list(): async def read_int_list(filename: str) -> list():