Formatting

This commit is contained in:
Nathan Thomas 2022-02-20 11:51:45 -08:00
parent 297ff216b2
commit 418e9544b1
3 changed files with 24 additions and 15 deletions

View file

@ -637,6 +637,7 @@ class ConvertCommand(Command):
concurrent.futures.as_completed(futures),
total=len(futures),
desc="Converting",
unit="track",
bar_format=TQDM_BAR_FORMAT,
):
# Only show loading bar

View file

@ -659,9 +659,13 @@ class Track(Media):
audio[k] = v
if embed_cover and cover is None:
cover = Tracklist.get_cover_obj(
self.cover_path, self.container, self.client.source
) if hasattr(self,"cover_path") else None
cover = (
Tracklist.get_cover_obj(
self.cover_path, self.container, self.client.source
)
if hasattr(self, "cover_path")
else None
)
if isinstance(audio, FLAC):
if embed_cover and cover:
@ -1521,16 +1525,20 @@ class Album(Tracklist, Media):
self.download_message()
cover_path = _choose_and_download_cover(
self.cover_urls,
kwargs.get("embed_cover_size", "large"),
self.folder,
kwargs.get("keep_hires_cover", True),
(
kwargs.get("max_artwork_width", 1e9),
kwargs.get("max_artwork_height", 1e9),
),
) if self.cover_urls else None
cover_path = (
_choose_and_download_cover(
self.cover_urls,
kwargs.get("embed_cover_size", "large"),
self.folder,
kwargs.get("keep_hires_cover", True),
(
kwargs.get("max_artwork_width", 1e9),
kwargs.get("max_artwork_height", 1e9),
),
)
if self.cover_urls
else None
)
if cover_path and kwargs.get("embed_cover", True): # embed by default
logger.debug("Getting cover_obj from %s", cover_path)

View file

@ -178,9 +178,9 @@ 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:
if not uuid:
return None
return TIDAL_COVER_URL.format(uuid=uuid.replace("-", "/"), height=size, width=size)