Fixed bug (better implementation)

After adding "__comment" to the backgrounds.json file code crashed because it treated "__comment" as one of the backgrounds.
pull/1158/head
RiveN 2 years ago committed by GitHub
parent b92386629a
commit afbffa1b50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -16,14 +16,12 @@ from utils.console import print_step, print_substep
with open("utils/backgrounds.json") as json_file: with open("utils/backgrounds.json") as json_file:
background_options = json.load(json_file) background_options = json.load(json_file)
# Remove "__comment" from backgrounds
background_options.pop("__comment", None)
# Add position lambda function # Add position lambda function
# (https://zulko.github.io/moviepy/ref/VideoClip/VideoClip.html#moviepy.video.VideoClip.VideoClip.set_position) # (https://zulko.github.io/moviepy/ref/VideoClip/VideoClip.html#moviepy.video.VideoClip.VideoClip.set_position)
backgrounds = list(background_options.keys()) for name in list(background_options.keys()):
if "__comment" in backgrounds:
backgrounds.remove("__comment")
for name in backgrounds:
pos = background_options[name][3] pos = background_options[name][3]
if pos != "center": if pos != "center":

Loading…
Cancel
Save