Fix cover URL hashing

This commit is contained in:
xz3513 2021-12-30 14:43:13 -05:00
parent 237e0a232a
commit 42cf8bab14
1 changed files with 11 additions and 3 deletions

View File

@ -2,6 +2,7 @@
import abc
import concurrent.futures
import hashlib
import logging
import os
import re
@ -2300,9 +2301,16 @@ def _choose_and_download_cover(
downsize: Tuple[int, int] = (999999, 999999),
) -> str:
# choose optimal cover size and download it
temp_cover_path = os.path.join(
gettempdir(), f"cover_{hash(cover_urls.values())}.jpg"
)
def sorted_list(x: Iterable) -> list:
xlist = list(x)
xlist.sort()
return xlist
hashcode: str = hashlib.md5(str(sorted_list(cover_urls.values())).encode('utf-8', errors='replace')).hexdigest()
temp_cover_path = os.path.join(gettempdir(), f"cover_{hashcode}.jpg")
secho(f"Downloading cover art ({preferred_size})", bold=True)
assert (