patrlim-musicshite/main.py

19 lines
612 B
Python
Raw Normal View History

2024-06-29 22:49:36 +01:00
import os
os.system('git pull')
2024-06-10 20:48:19 +01:00
filelist = os.listdir()
jsonfile = open("songs.json", "w", encoding="utf-8")
jsonfile.write('{\n "songs":[\n')
2024-06-10 20:48:19 +01:00
i = 0
for file in filelist:
2024-06-10 20:48:19 +01:00
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 }")
2024-06-10 20:48:19 +01:00
if i != len(os.listdir()):
jsonfile.write(",")
jsonfile.write("\n")
2024-06-29 22:49:36 +01:00
jsonfile.write(' ]\n}')