File dependency of randomizer module removed

This commit is contained in:
Halhadus 2024-11-25 03:37:43 +03:00
parent ed739b3d8a
commit 9e351ea4ac

View file

@ -1,14 +1,10 @@
import os
import random
import requests
if not os.path.exists("musiclist.txt"):
print("musiclist.txt not found")
exit()
with open("musiclist.txt", "r") as f:
musiclist = f.readlines()
def randomize():
def randomize(listurl):
# Please don't refresh too fast and kill my website and git server...
musiclist = requests.get(listurl).text.split("\n")
html = "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<link href=\"https://fonts.googleapis.com/css2?family=Jetbrains+Mono:wght@400;700&display=swap\" rel=\"stylesheet\">\n</head>\n<body style=\"background-color: #1f1f1f; color: #ffffff; font-family: 'Jetbrains Mono', monospace;\">\n"
html += "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n"
html += "<title>Halhadus' Music List</title>\n"