From 8a3da48a268599aa45dcd0df74f6cc607783aa74 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Wed, 15 Mar 2023 16:38:05 -0400 Subject: [PATCH] [bin] Fix wallpaper lookups --- bin/.bin/get_bing_potd.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/.bin/get_bing_potd.py b/bin/.bin/get_bing_potd.py index d03220e..598d9c1 100755 --- a/bin/.bin/get_bing_potd.py +++ b/bin/.bin/get_bing_potd.py @@ -17,11 +17,15 @@ target_path = f"{home}/var/media/backgrounds/bing/{today}.jpg" # If the file for today already exists, just exit if os.path.isfile(target_path): - yesterday_img = imagehash.average_hash(Image.open(check_path)) - today_img = imagehash.average_hash(Image.open(target_path)) - cutoff = 5 # maximum bits that could be different between the hashes. + found_match = False + try: + yesterday_img = imagehash.average_hash(Image.open(check_path)) + today_img = imagehash.average_hash(Image.open(target_path)) + cutoff = 5 # maximum bits that could be different between the hashes. - found_match = today_img - yesterday_img < cutoff + found_match = today_img - yesterday_img < cutoff + except: + pass if not found_match: print(f"Bing image for {today} already exists, skipping download")