1
0
Fork 0
mirror of synced 2024-06-03 03:04:42 +12:00

Fix bug, if image is corrupt

This commit is contained in:
Dummerle 2021-09-19 23:14:38 +02:00
parent f248fbbdce
commit 9a04bd519f

View file

@ -89,8 +89,14 @@ def download_image(game, force=False):
# finalArt = Image.open(f'{image_dir}/' + game.app_name + '/DieselGameBoxTall.png')
# finalArt.save(f'{image_dir}/{game.app_name}/FinalArt.png')
# And same with the grayscale one
bg = Image.open(os.path.join(image_dir, f"{game.app_name}/DieselGameBoxTall.png"))
try:
bg = Image.open(os.path.join(image_dir, f"{game.app_name}/DieselGameBoxTall.png"))
except UnidentifiedImageError:
logger.warning("Reload image for " + game.app_title)
# avoid endless recursion
if not force:
download_image(game, True)
return
uninstalledArt = bg.convert('L')
uninstalledArt = uninstalledArt.resize((200, int(200 * 4 / 3)))
uninstalledArt.save(f'{image_dir}/{game.app_name}/UninstalledArt.png')