From 0dfca7e316d323e9933aad152da5ded71786965b Mon Sep 17 00:00:00 2001 From: Halhadus Date: Thu, 12 Dec 2024 01:48:57 +0300 Subject: [PATCH] Fixed music.db problem of script for PyInstaller --- localwrapped-pyi.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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")