[bin] Fix wallpaper lookups
This commit is contained in:
@ -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")
|
||||
|
||||
Reference in New Issue
Block a user