mirror of
https://github.com/Wojtek242/qobuz-dl.git
synced 2024-11-22 11:05:25 +01:00
misc
This commit is contained in:
parent
69728e21ee
commit
678910d2f3
@ -141,7 +141,8 @@ def download_and_tag(
|
||||
|
||||
if artist or album_artist:
|
||||
new_track_title = (
|
||||
f"{artist if artist else album_artist}" f' - {track_metadata["title"]}'
|
||||
f"{artist if artist else album_artist}"
|
||||
f' - {track_metadata["title"]}'
|
||||
)
|
||||
if version:
|
||||
new_track_title = f"{new_track_title} ({version})"
|
||||
@ -215,11 +216,13 @@ def download_id_by_type(
|
||||
album_format, quality_met = get_format(client, meta, quality)
|
||||
if not downgrade_quality and not quality_met:
|
||||
logger.info(
|
||||
f"{OFF}Skipping {album_title} as doesn't met quality requirement"
|
||||
f"{OFF}Skipping {album_title} as it doesn't "
|
||||
"meet quality requirement"
|
||||
)
|
||||
return
|
||||
|
||||
logger.info(f"\n{YELLOW}Downloading: {album_title}\nQuality: {album_format}\n")
|
||||
logger.info(f"\n{YELLOW}Downloading: {album_title}\n"
|
||||
f"Quality: {album_format}\n")
|
||||
dirT = (
|
||||
meta["artist"]["name"],
|
||||
album_title,
|
||||
@ -233,14 +236,16 @@ def download_id_by_type(
|
||||
if no_cover:
|
||||
logger.info(f"{OFF}Skipping cover")
|
||||
else:
|
||||
get_extra(meta["image"]["large"], dirn, og_quality=cover_og_quality)
|
||||
get_extra(meta["image"]["large"], dirn,
|
||||
og_quality=cover_og_quality)
|
||||
|
||||
if "goodies" in meta:
|
||||
try:
|
||||
get_extra(meta["goodies"][0]["url"], dirn, "booklet.pdf")
|
||||
except: # noqa
|
||||
pass
|
||||
media_numbers = [track["media_number"] for track in meta["tracks"]["items"]]
|
||||
media_numbers = [track["media_number"] for track in
|
||||
meta["tracks"]["items"]]
|
||||
is_multiple = True if len([*{*media_numbers}]) > 1 else False
|
||||
for i in meta["tracks"]["items"]:
|
||||
parse = client.get_track_url(i["id"], quality)
|
||||
@ -267,10 +272,12 @@ def download_id_by_type(
|
||||
meta = client.get_track_meta(item_id)
|
||||
track_title = get_title(meta)
|
||||
logger.info(f"\n{YELLOW}Downloading: {track_title}")
|
||||
track_format, quality_met = get_format(client, meta, quality, True, parse)
|
||||
track_format, quality_met = get_format(client, meta,
|
||||
quality, True, parse)
|
||||
if not downgrade_quality and not quality_met:
|
||||
logger.info(
|
||||
f"{OFF}Skipping {track_title} as doesn't met quality requirement"
|
||||
f"{OFF}Skipping {track_title} as it doesn't "
|
||||
"meet quality requirement"
|
||||
)
|
||||
return
|
||||
dirT = (
|
||||
@ -286,10 +293,12 @@ def download_id_by_type(
|
||||
logger.info(f"{OFF}Skipping cover")
|
||||
else:
|
||||
get_extra(
|
||||
meta["album"]["image"]["large"], dirn, og_quality=cover_og_quality
|
||||
meta["album"]["image"]["large"], dirn,
|
||||
og_quality=cover_og_quality
|
||||
)
|
||||
is_mp3 = True if int(quality) == 5 else False
|
||||
download_and_tag(dirn, count, parse, meta, meta, True, is_mp3, embed_art)
|
||||
download_and_tag(dirn, count, parse, meta,
|
||||
meta, True, is_mp3, embed_art)
|
||||
else:
|
||||
logger.info(f"{OFF}Demo. Skipping")
|
||||
logger.info(f"{GREEN}Completed")
|
||||
|
@ -37,16 +37,10 @@ def _format_genres(genres: list) -> str:
|
||||
'Pop/Rock, Rock, Alternatif et Indé'
|
||||
'''
|
||||
|
||||
if len(genres) <= 1:
|
||||
return ''.join(genres)
|
||||
|
||||
prev = genres[0]
|
||||
new_genres = [prev]
|
||||
for genre in genres[1:]:
|
||||
new_genres.append(genre.replace(f'{prev}→', ''))
|
||||
prev = genre
|
||||
|
||||
return ', '.join(new_genres)
|
||||
if genres == []:
|
||||
return ''
|
||||
else:
|
||||
return ', '.join(genres[-1].split("→"))
|
||||
|
||||
|
||||
# Use KeyError catching instead of dict.get to avoid empty tags
|
||||
|
Loading…
Reference in New Issue
Block a user