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), concurrent.futures.as_completed(futures),
total=len(futures), total=len(futures),
desc="Converting", desc="Converting",
unit="track",
bar_format=TQDM_BAR_FORMAT, bar_format=TQDM_BAR_FORMAT,
): ):
# Only show loading bar # Only show loading bar

View file

@ -659,9 +659,13 @@ class Track(Media):
audio[k] = v audio[k] = v
if embed_cover and cover is None: if embed_cover and cover is None:
cover = Tracklist.get_cover_obj( cover = (
self.cover_path, self.container, self.client.source Tracklist.get_cover_obj(
) if hasattr(self,"cover_path") else None self.cover_path, self.container, self.client.source
)
if hasattr(self, "cover_path")
else None
)
if isinstance(audio, FLAC): if isinstance(audio, FLAC):
if embed_cover and cover: if embed_cover and cover:
@ -1521,16 +1525,20 @@ class Album(Tracklist, Media):
self.download_message() self.download_message()
cover_path = _choose_and_download_cover( cover_path = (
self.cover_urls, _choose_and_download_cover(
kwargs.get("embed_cover_size", "large"), self.cover_urls,
self.folder, kwargs.get("embed_cover_size", "large"),
kwargs.get("keep_hires_cover", True), self.folder,
( kwargs.get("keep_hires_cover", True),
kwargs.get("max_artwork_width", 1e9), (
kwargs.get("max_artwork_height", 1e9), kwargs.get("max_artwork_width", 1e9),
), kwargs.get("max_artwork_height", 1e9),
) if self.cover_urls else None ),
)
if self.cover_urls
else None
)
if cover_path and kwargs.get("embed_cover", True): # embed by default if cover_path and kwargs.get("embed_cover", True): # embed by default
logger.debug("Getting cover_obj from %s", cover_path) 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) possibles = (80, 160, 320, 640, 1280)
assert size in possibles, f"size must be in {possibles}" assert size in possibles, f"size must be in {possibles}"
# A common occurance is a valid size but no uuid # A common occurance is a valid size but no uuid
if not uuid: if not uuid:
return None return None
return TIDAL_COVER_URL.format(uuid=uuid.replace("-", "/"), height=size, width=size) return TIDAL_COVER_URL.format(uuid=uuid.replace("-", "/"), height=size, width=size)