diff --git a/scripts/vndb_id_connector/main.py b/scripts/vndb_id_connector/main.py index 79c43de..f2fd408 100644 --- a/scripts/vndb_id_connector/main.py +++ b/scripts/vndb_id_connector/main.py @@ -101,13 +101,16 @@ def get_names(vid, bangumi_id=None): "steam": "", "bangumi": str(bangumi_match), "vndb": str(vid), - "names": sorted(get_names(vid, bangumi_match)) + "names": get_names(vid, bangumi_match) }) - json_result['entries'] = sorted(matches, key=lambda x: ( + matches = sorted(matches, key=lambda x: ( int(x['vndb'][1:]) if len(x['vndb']) > 1 else float('inf'), int(x['bangumi']) if x['bangumi'] else float('inf'), int(x['steam']) if x['steam'] else float('inf') )) + for match in matches: + match['names'] = sorted(match['names']) + json_result['entries'] = matches saved_file_path = '../../game_id_connector/2-vndb_automated.json' if len(sys.argv) == 1 else sys.argv[1] with open(saved_file_path, 'w', encoding='utf8') as f3: f3.writelines(json.dumps(json_result, ensure_ascii=False, indent=2))