Merge pull request #266 from xz3513/dev

Fix cover URL hashing
This commit is contained in:
Nathan Thomas 2022-01-14 19:14:40 -08:00 committed by GitHub
commit 52826d95b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 (