mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 15:47:18 +02:00
27 lines
572 B
Python
27 lines
572 B
Python
import json
|
|
import os
|
|
|
|
FOLDER = 'touch-layouts'
|
|
OUTPUT_FILE = os.path.join(FOLDER, 'ids.json')
|
|
|
|
product_ids = list()
|
|
|
|
# Get files in folder
|
|
for file in os.listdir(FOLDER):
|
|
if not file.endswith('.json') or file == 'ids.json':
|
|
continue
|
|
|
|
with open(os.path.join(FOLDER, file)) as fp:
|
|
content = json.load(fp)
|
|
product_ids.append(content['product_id'])
|
|
|
|
# Sort list
|
|
product_ids.sort()
|
|
|
|
# Write to file
|
|
output = json.dumps(product_ids, separators=(',', ': '), indent=2) + '\n'
|
|
with open(OUTPUT_FILE, 'w') as fp:
|
|
fp.write(output)
|
|
|
|
print(output)
|