Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/nathom/streamrip into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
nathom committed Jan 15, 2022
2 parents 389b5b9 + 52826d9 commit ad70d6b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions streamrip/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import abc
import concurrent.futures
import hashlib
import logging
import os
import re
Expand Down Expand Up @@ -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 (
Expand Down

0 comments on commit ad70d6b

Please sign in to comment.