]> OzVa Git service - critters-api/commitdiff
Hard-coded paths
authorMax Value <greenwoodw50@gmail.com>
Mon, 9 Dec 2024 07:05:17 +0000 (07:05 +0000)
committerMax Value <greenwoodw50@gmail.com>
Mon, 9 Dec 2024 07:05:17 +0000 (07:05 +0000)
critters.py

index 27229666641e0751aa4dcfcfca2f5f2ef8e0e40b..78594c78217b735515604db15e78d972b69c2265 100755 (executable)
@@ -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: