diff --git a/scripts/generate-touch-layouts-ids.py b/scripts/generate-touch-layouts-ids.py new file mode 100644 index 0000000..983f0fb --- /dev/null +++ b/scripts/generate-touch-layouts-ids.py @@ -0,0 +1,29 @@ +import os + +FOLDER = 'touch-layouts' +OUTPUT_FILE = os.path.join(FOLDER, 'ids.json') + +gameIds = list() + +# Get files in folder +for file in os.listdir(FOLDER): + if not file.endswith('.json') or file == 'ids.json': + continue + + # Get game ID from file name (as int so we can sort the list later) + gameId = int(file.replace('.json', '')) + gameIds.append(gameId) + +# Sort list of ints +gameIds.sort() +# Convert int to string +gameIds = list(map((lambda x: str(x)), gameIds)) + +# Generate output string +output = '[\n ' + ',\n '.join(gameIds) + '\n]\n' + +# Write to file +with open(OUTPUT_FILE, 'w') as fp: + fp.write(output) + +print(output)