import os os.system('git pull') filelist = os.listdir() jsonfile = open("songs.json", "w", encoding="utf-8") jsonfile.write('{\n "songs":[\n') i = 0 for file in filelist: i += 1 if file[-4:] != ".ogg": continue jsonfile.write(" {\n" + ' "name":' + '"' + file.replace(".ogg","") + '",' + "\n") jsonfile.write(' "url":' + '"' + 'https://github.com/patrlim/musicshite/raw/main/' + file.replace(" ","%20") + '"' + "\n }") if i != len(os.listdir()): jsonfile.write(",") jsonfile.write("\n") jsonfile.write(' ]\n}')