-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathegs-isthereanydeal.py
35 lines (30 loc) · 941 Bytes
/
egs-isthereanydeal.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import json
def transform_library(legendary_file, itad_file):
# Read legendary library
with open(legendary_file, 'r') as f:
legendary_data = json.load(f)
# Create ITAD format
itad_format = {
"version": "03",
"data": [
{
"group": "epicmanualimport",
"public": False,
"games": []
}
]
}
# Transform each game
for game in legendary_data['library']:
game_entry = {
"id": game['app_name'],
"title": game['extra']['about']['description'],
"platforms": 0,
"playtime": 0
}
itad_format['data'][0]['games'].append(game_entry)
# Save transformed file
with open('transformed_legendary_library.json', 'w') as f:
json.dump(itad_format, f, indent=2)
# Use the function
transform_library('legendary_library.json', 'collection.json')