import os

import json

def generate_file_list(directory):

files = []

for filename in os.listdir(directory):

filepath = os.path.join(directory, filename)

if os.path.isfile(filepath):

files.append({"path": filepath, "type": 1})

data = {

"_ids": files,

"_loopMode": 0,

"_selected": 2,

"_shuffled": True

}

return json.dumps(data, indent=4)

# change directory, there need to be two slashes, for example: C:\\SteamLibrary\\steamapps\\common\\ULTRAKILL\\CyberGrind\\Music directory = r"your folder located in the ultrakill/cybergrind/music folder" json_output = generate_file_list(directory) print(json_output)