Skip to content

Commit

Permalink
fix: sort names
Browse files Browse the repository at this point in the history
  • Loading branch information
Tabing010102 committed Dec 3, 2024
1 parent 012de7e commit c6ff074
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripts/vndb_id_connector/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

0 comments on commit c6ff074

Please sign in to comment.