patrlim-musicshite/main.py

17 lines
591 B
Python
Raw Normal View History

2024-06-29 22:49:36 +01:00
import os
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")
2024-07-08 18:06:35 +01:00
jsonfile.write(' "url":' + '"' + 'https://git.merith.xyz/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}')