From afbffa1b5025be458680e1594c4914e984c1d70e Mon Sep 17 00:00:00 2001 From: RiveN <61630074+RiveN000@users.noreply.github.com> Date: Mon, 22 Aug 2022 14:22:35 +0200 Subject: [PATCH] Fixed bug (better implementation) After adding "__comment" to the backgrounds.json file code crashed because it treated "__comment" as one of the backgrounds. --- video_creation/background.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/video_creation/background.py b/video_creation/background.py index 1089d29..c451025 100644 --- a/video_creation/background.py +++ b/video_creation/background.py @@ -16,14 +16,12 @@ from utils.console import print_step, print_substep with open("utils/backgrounds.json") as json_file: background_options = json.load(json_file) +# Remove "__comment" from backgrounds +background_options.pop("__comment", None) + # Add position lambda function # (https://zulko.github.io/moviepy/ref/VideoClip/VideoClip.html#moviepy.video.VideoClip.VideoClip.set_position) -backgrounds = list(background_options.keys()) - -if "__comment" in backgrounds: - backgrounds.remove("__comment") - -for name in backgrounds: +for name in list(background_options.keys()): pos = background_options[name][3] if pos != "center":