From 8dfc0e42f702e762f86a2978554624c4f635ff26 Mon Sep 17 00:00:00 2001 From: Max Value Date: Mon, 9 Dec 2024 07:05:17 +0000 Subject: [PATCH] Hard-coded paths --- critters.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/critters.py b/critters.py index 2722966..78594c7 100755 --- a/critters.py +++ b/critters.py @@ -24,10 +24,10 @@ current_track_id = Value("I") # This is the global track ID with current_track_id.get_lock(): current_track_id.value = 1 -audio_path = "../audio/" -cover_path = "../cover/" -icon_path = "../icon/" -upload_path = "../upload/" +audio_path = "/home/stream/critters/audio/" +cover_path = "/home/stream/critters/cover/" +icon_path = "/home/stream/critters/icon/" +upload_path = "/home/stream/critters/upload/" def check_files(track_id): return { @@ -42,7 +42,7 @@ def check_files(track_id): "icon_path": url_for("get_icon", track_id=track_id) } -with open("../secrets.json", "r") as f: +with open("/home/stream/critters/secrets.json", "r") as f: users = json.loads(f.read()) users = {k: generate_password_hash(v) for (k, v) in users.items()} @@ -63,7 +63,7 @@ def homepage(): @auth.login_required def admin(): if request.method == "POST": - con = sqlite3.connect("../../metadata.db") + con = sqlite3.connect("/home/stream/metadata.db") cur = con.cursor() try: commit_id = int(request.form["id"]) @@ -186,7 +186,7 @@ def set_current_id(): current_album = "" current_artist = "" - con = sqlite3.connect("../../metadata.db") + con = sqlite3.connect("/home/stream/metadata.db") cur = con.cursor() track = cur.execute(f"SELECT album, artist FROM critters WHERE id={track_id}").fetchone() @@ -231,7 +231,7 @@ def get_tracks(): } responce_data = [track_data] - con = sqlite3.connect("../../metadata.db") + con = sqlite3.connect("/home/stream/metadata.db") cur = con.cursor() tracks = cur.execute(f"SELECT * FROM critters").fetchall() if tracks is not None: @@ -245,7 +245,7 @@ def get_single_track(track_id): if track_id == 0: with current_track_id.get_lock(): track_id = current_track_id.value - con = sqlite3.connect("../../metadata.db") + con = sqlite3.connect("/home/stream/metadata.db") cur = con.cursor() track = cur.execute(f"SELECT * FROM critters WHERE id={track_id}").fetchone() track_data = { @@ -273,7 +273,7 @@ def get_single_field(track_id, feild): track_id = current_track_id.value result = "Unknown" if feild in db_keys: - con = sqlite3.connect("../../metadata.db") + con = sqlite3.connect("/home/stream/metadata.db") cur = con.cursor() track = cur.execute(f"SELECT {feild} FROM critters WHERE id={track_id}").fetchone() if track is not None: -- 2.39.2