mirror of
https://github.com/nathom/streamrip.git
synced 2024-09-19 11:18:45 -04:00
Update utils.py with trivial sanity checks
Check that uuid isn't None even when a valid size is present, as it happens somewhat frequently.
This commit is contained in:
parent
877b19bb3b
commit
7e8cd1bd4e
1 changed files with 6 additions and 1 deletions
|
@ -178,7 +178,10 @@ def tidal_cover_url(uuid, size):
|
|||
"""
|
||||
possibles = (80, 160, 320, 640, 1280)
|
||||
assert size in possibles, f"size must be in {possibles}"
|
||||
|
||||
|
||||
# A common occurance is a valid size but no uuid
|
||||
if not uuid:
|
||||
return None
|
||||
return TIDAL_COVER_URL.format(uuid=uuid.replace("-", "/"), height=size, width=size)
|
||||
|
||||
|
||||
|
@ -335,6 +338,8 @@ def get_cover_urls(resp: dict, source: str) -> dict:
|
|||
|
||||
if source == "tidal":
|
||||
uuid = resp["cover"]
|
||||
if not uuid:
|
||||
return None
|
||||
return {
|
||||
sk: tidal_cover_url(uuid, size)
|
||||
for sk, size in zip(COVER_SIZES, (160, 320, 640, 1280))
|
||||
|
|
Loading…
Reference in a new issue