Replace YEAR by DATE (close #42)

This commit is contained in:
vitiko98 2020-12-19 12:56:59 -04:00
parent df578d1d02
commit 4861c6ab85
5 changed files with 11 additions and 9 deletions

View File

@ -61,7 +61,7 @@ def add_common_arg(custom_parser, default_folder, default_quality):
"--directory", "--directory",
metavar="PATH", metavar="PATH",
default=default_folder, default=default_folder,
help=f'directory for downloads (default: "{default_folder}")' help=f'directory for downloads (default: "{default_folder}")',
) )
custom_parser.add_argument( custom_parser.add_argument(
"-q", "-q",
@ -92,7 +92,9 @@ def add_common_arg(custom_parser, default_folder, default_quality):
"-e", "--embed-art", action="store_true", help="embed cover art into files" "-e", "--embed-art", action="store_true", help="embed cover art into files"
) )
custom_parser.add_argument( custom_parser.add_argument(
"--og-cover", action="store_true", help="download cover art in its original quality (bigger file)" "--og-cover",
action="store_true",
help="download cover art in its original quality (bigger file)",
) )
custom_parser.add_argument( custom_parser.add_argument(
"--no-cover", action="store_true", help="don't download cover art" "--no-cover", action="store_true", help="don't download cover art"

View File

@ -59,7 +59,7 @@ class QobuzDL:
no_m3u_for_playlists=False, no_m3u_for_playlists=False,
quality_fallback=True, quality_fallback=True,
cover_og_quality=False, cover_og_quality=False,
no_cover=False no_cover=False,
): ):
self.directory = self.create_dir(directory) self.directory = self.create_dir(directory)
self.quality = quality self.quality = quality
@ -112,7 +112,7 @@ class QobuzDL:
self.no_cover, self.no_cover,
) )
except requests.exceptions.RequestException as e: except requests.exceptions.RequestException as e:
logger.error(f"Error getting release: {e}") logger.error(f"{RED}Error getting release: {e}", exc_info=True)
def handle_url(self, url): def handle_url(self, url):
possibles = { possibles = {

View File

@ -162,7 +162,7 @@ def download_and_tag(
embed_art, embed_art,
) )
except Exception as e: except Exception as e:
logger.error(f"{RED}Error tagging the file: {e}") logger.error(f"{RED}Error tagging the file: {e}", exc_info=True)
def download_id_by_type( def download_id_by_type(
@ -227,7 +227,6 @@ def download_id_by_type(
else: 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: if "goodies" in meta:
try: try:
get_extra(meta["goodies"][0]["url"], dirn, "booklet.pdf") get_extra(meta["goodies"][0]["url"], dirn, "booklet.pdf")

View File

@ -24,6 +24,7 @@ def get_title(track_dict):
return title return title
# Use KeyError catching instead of dict.get to avoid empty tags
def tag_flac(filename, root_dir, final_name, d, album, istrack=True, em_image=False): def tag_flac(filename, root_dir, final_name, d, album, istrack=True, em_image=False):
""" """
Tag a FLAC file Tag a FLAC file
@ -61,13 +62,13 @@ def tag_flac(filename, root_dir, final_name, d, album, istrack=True, em_image=Fa
audio["ALBUMARTIST"] = d["album"]["artist"]["name"] # ALBUM ARTIST audio["ALBUMARTIST"] = d["album"]["artist"]["name"] # ALBUM ARTIST
audio["TRACKTOTAL"] = str(d["album"]["tracks_count"]) # TRACK TOTAL audio["TRACKTOTAL"] = str(d["album"]["tracks_count"]) # TRACK TOTAL
audio["ALBUM"] = d["album"]["title"] # ALBUM TITLE audio["ALBUM"] = d["album"]["title"] # ALBUM TITLE
audio["YEAR"] = d["album"]["release_date_original"].split("-")[0] audio["DATE"] = d["album"]["release_date_original"].split("-")[0]
else: else:
audio["GENRE"] = ", ".join(album["genres_list"]) # GENRE audio["GENRE"] = ", ".join(album["genres_list"]) # GENRE
audio["ALBUMARTIST"] = album["artist"]["name"] # ALBUM ARTIST audio["ALBUMARTIST"] = album["artist"]["name"] # ALBUM ARTIST
audio["TRACKTOTAL"] = str(album["tracks_count"]) # TRACK TOTAL audio["TRACKTOTAL"] = str(album["tracks_count"]) # TRACK TOTAL
audio["ALBUM"] = album["title"] # ALBUM TITLE audio["ALBUM"] = album["title"] # ALBUM TITLE
audio["YEAR"] = album["release_date_original"].split("-")[0] # YEAR audio["DATE"] = album["release_date_original"].split("-")[0]
if em_image: if em_image:
emb_image = os.path.join(root_dir, "cover.jpg") emb_image = os.path.join(root_dir, "cover.jpg")

View File

@ -13,7 +13,7 @@ requirements = read_file("requirements.txt").strip().split()
setup( setup(
name=pkg_name, name=pkg_name,
version="0.8.1", version="0.8.2",
author="Vitiko", author="Vitiko",
author_email="vhnz98@gmail.com", author_email="vhnz98@gmail.com",
description="The complete Lossless and Hi-Res music downloader for Qobuz", description="The complete Lossless and Hi-Res music downloader for Qobuz",