Ne crash plus s'il n'y a pas d'image pour l'APN et/ou l'objectif

This commit is contained in:
Antoine Van Elstraete 2019-08-26 12:47:32 +02:00 committed by Antoine Van Elstraete
parent 8a1c0f0780
commit c0a329c950

View File

@ -153,6 +153,7 @@ def camera_and_lens(informations, language, colors, temp_dir):
''' '''
Informations about cameras and lenses used. Informations about cameras and lenses used.
''' '''
image1, image2 = None, None
with open("helpers/dictionary.json") as file: with open("helpers/dictionary.json") as file:
helper = json.load(file) helper = json.load(file)
text = _("Cameras & lenses") text = _("Cameras & lenses")
@ -200,7 +201,7 @@ def camera_and_lens(informations, language, colors, temp_dir):
"helpers/lenses/{}.jpg".format(top_lens.replace(" ", "_").replace("/", "_")), "helpers/lenses/{}.jpg".format(top_lens.replace(" ", "_").replace("/", "_")),
"{}/{}.jpg".format(temp_dir, top_lens.replace(" ", "_").replace("/", "_"))) "{}/{}.jpg".format(temp_dir, top_lens.replace(" ", "_").replace("/", "_")))
image2 = "{}/{}.jpg".format(temp_dir, top_lens.replace(" ", "_").replace("/", "_")) image2 = "{}/{}.jpg".format(temp_dir, top_lens.replace(" ", "_").replace("/", "_"))
if image1 or image2: if image1 and image2:
run(["montage", image1, image2, "-geometry", "+10+0", "-quality", "94", "{}/top_camera_lens.jpg".format(temp_dir)], check=True) run(["montage", image1, image2, "-geometry", "+10+0", "-quality", "94", "{}/top_camera_lens.jpg".format(temp_dir)], check=True)
text += ".. image:: {}.jpg\n\t:height: 5cm\n\n".format("top_camera_lens") text += ".. image:: {}.jpg\n\t:height: 5cm\n\n".format("top_camera_lens")
if len(informations['cameras']) > 1: if len(informations['cameras']) > 1: