diff --git a/GUI.py b/GUI.py index 4588083..7b8b23c 100644 --- a/GUI.py +++ b/GUI.py @@ -43,7 +43,7 @@ def index(): @app.route("/backgrounds", methods=["GET"]) def backgrounds(): - return render_template("backgrounds.html", file="backgrounds.json") + return render_template("backgrounds.html", file="background_videos.json") @app.route("/background/add", methods=["POST"]) @@ -91,10 +91,10 @@ def videos_json(): return send_from_directory("video_creation/data", "videos.json") -# Make backgrounds.json accessible -@app.route("/backgrounds.json") +# Make background_videos.json accessible +@app.route("/background_videos.json") def backgrounds_json(): - return send_from_directory("utils", "backgrounds.json") + return send_from_directory("utils", "background_videos.json") # Make videos in results folder accessible diff --git a/GUI/backgrounds.html b/GUI/backgrounds.html index 541e39f..438aa90 100644 --- a/GUI/backgrounds.html +++ b/GUI/backgrounds.html @@ -125,7 +125,7 @@ // Show background videos $(document).ready(function () { - $.getJSON("backgrounds.json", + $.getJSON("background_videos.json", function (data) { delete data["__comment"]; var background = ''; diff --git a/utils/gui_utils.py b/utils/gui_utils.py index 94d2efd..1f784d8 100644 --- a/utils/gui_utils.py +++ b/utils/gui_utils.py @@ -125,12 +125,12 @@ def modify_settings(data: dict, config_load, checks: dict): # Delete background video def delete_background(key): - # Read backgrounds.json - with open("utils/backgrounds.json", "r", encoding="utf-8") as backgrounds: + # Read background_videos.json + with open("utils/background_videos.json", "r", encoding="utf-8") as backgrounds: data = json.load(backgrounds) - # Remove background from backgrounds.json - with open("utils/backgrounds.json", "w", encoding="utf-8") as backgrounds: + # Remove background from background_videos.json + with open("utils/background_videos.json", "w", encoding="utf-8") as backgrounds: if data.pop(key, None): json.dump(data, backgrounds, ensure_ascii=False, indent=4) else: @@ -179,7 +179,7 @@ def add_background(youtube_uri, filename, citation, position): filename = filename.replace(" ", "_") # Check if background doesn't already exist - with open("utils/backgrounds.json", "r", encoding="utf-8") as backgrounds: + with open("utils/background_videos.json", "r", encoding="utf-8") as backgrounds: data = json.load(backgrounds) # Check if key isn't already taken @@ -193,7 +193,7 @@ def add_background(youtube_uri, filename, citation, position): return # Add background video to json file - with open("utils/backgrounds.json", "r+", encoding="utf-8") as backgrounds: + with open("utils/background_videos.json", "r+", encoding="utf-8") as backgrounds: data = json.load(backgrounds) data[filename] = [youtube_uri, filename + ".mp4", citation, position]