diff --git a/localwrapped-pyi.py b/localwrapped-pyi.py index c3153aa..ca64b7f 100644 --- a/localwrapped-pyi.py +++ b/localwrapped-pyi.py @@ -3,6 +3,7 @@ import re import time import sqlite3 import os +import requests def get_working_directory(): # If you see this function, that means you are using the pyinstaller. Use this command to create the executable: @@ -59,7 +60,15 @@ def get_music(): except: return None -def get_db_values(): +def get_db_values(url: str = "https://halhadus.rocks/localwrapped/music.db"): + if not os.path.exists(get_working_directory() + "/music.db"): + try: + download = requests.get(url) + with open(get_working_directory() + "/music.db", "wb") as f: + f.write(download.content) + except: + print("Could not download the database.") + exit() musicconn = sqlite3.connect(get_working_directory() + "/music.db") musicc = musicconn.cursor() musicc.execute("SELECT * FROM music")