website/gen/albums.py

17 lines
394 B
Python
Raw Normal View History

2024-09-06 00:50:44 -05:00
#! /usr/bin/python3
import json
input = open("albums.dat", "r")
lines = input.read().splitlines()
with open("albums.json", "w") as out:
l = []
for line in lines:
split = line.split('\\')
link = split[0]
name = split[1]
artist = split[2]
l.append({"name": name, "artist": artist, "link": link})
j = json.dumps(l, indent=2)
out.write(j)