LoaderSpot/update_versions.py

23 lines
No EOL
493 B
Python

import json
import re
with open('temp_data.json', 'r') as f:
data = json.load(f)
with open('versions.json', 'r') as f:
file_data = json.load(f)
key = list(data.keys())[0]
file_data[key] = data[key]
file_data = dict(
sorted(
file_data.items(),
key=lambda x: [
int(part) if part.isdigit() else part for part in re.split(r'(\d+)', x[0])
],
reverse=True
)
)
with open('versions.json', 'w') as f:
json.dump(file_data, f, indent=2)