From 98db34bc8e5629c120ac6cd34f76019835a727d3 Mon Sep 17 00:00:00 2001 From: nathannathant <74019033+pynathanthomas@users.noreply.github.com> Date: Wed, 24 Feb 2021 14:50:57 -0800 Subject: [PATCH 1/7] added support for other types of links also removed print statements, changed a few lines whose charcount > 79. --- qobuz_dl/core.py | 86 +++++++++++++++++++++++++++++++------------- qobuz_dl/metadata.py | 15 ++------ 2 files changed, 63 insertions(+), 38 deletions(-) diff --git a/qobuz_dl/core.py b/qobuz_dl/core.py index 3b7c4d0..553a388 100644 --- a/qobuz_dl/core.py +++ b/qobuz_dl/core.py @@ -21,7 +21,8 @@ WEB_URL = "https://play.qobuz.com/" ARTISTS_SELECTOR = "td.chartlist-artist > a" TITLE_SELECTOR = "td.chartlist-name > a" EXTENSIONS = (".mp3", ".flac") -QUALITIES = {5: "5 - MP3", 6: "6 - FLAC", 7: "7 - 24B<96kHz", 27: "27 - 24B>96kHz"} +QUALITIES = {5: "5 - MP3", 6: "6 - FLAC", + 7: "7 - 24B<96kHz", 27: "27 - 24B>96kHz"} logger = logging.getLogger(__name__) @@ -32,7 +33,8 @@ class PartialFormatter(string.Formatter): def get_field(self, field_name, args, kwargs): try: - val = super(PartialFormatter, self).get_field(field_name, args, kwargs) + val = super(PartialFormatter, self).get_field(field_name, + args, kwargs) except (KeyError, AttributeError): val = None, field_name return val @@ -95,12 +97,29 @@ class QobuzDL: def get_id(self, url): return re.match( - r"https?://(?:w{0,3}|play|open)\.qobuz\.com/(?:(?:album|track|artist" - r"|playlist|label)/|[a-z]{2}-[a-z]{2}/album/-?\w+(?:-\w+)*-?/|user/" - r"library/favorites/)(\w+)", + r"https?://(?:w{0,3}|play|open)\.qobuz\.com/(?:(?:album|track" + r"|artist|playlist|label)/|[a-z]{2}-[a-z]{2}/album/-?\w+(?:-\w+)*" + r"-?/|user/library/favorites/)(\w+)", url, ).group(1) + def get_type(self, url): + if re.match(r'https?', url) is not None: + url_type = url.split('/')[3] + if url_type not in ['album', 'artist', 'playlist', + 'track', 'label']: + if url_type == "user": + url_type = url.split('/')[-1] + else: + # url is from Qobuz store + # e.g. "https://www.qobuz.com/us-en/album/..." + url_type = url.split('/')[4] + else: + # url missing base + # e.g. "/us-en/album/{artist}/{id}" + url_type = url.split('/')[2] + return url_type + def download_from_id(self, item_id, album=True, alt_path=None): if handle_download_id(self.downloads_db, item_id, add_id=False): logger.info( @@ -144,24 +163,27 @@ class QobuzDL: "track": {"album": False, "func": None, "iterable_key": None}, } try: - url_type = url.split("/")[3] + url_type = self.get_type(url) type_dict = possibles[url_type] item_id = self.get_id(url) except (KeyError, IndexError): logger.info( - f'{RED}Invalid url: "{url}". Use urls from https://play.qobuz.com!' + f'{RED}Invalid url: "{url}". Use urls from ' + 'https://play.qobuz.com!' ) return if type_dict["func"]: content = [item for item in type_dict["func"](item_id)] content_name = content[0]["name"] logger.info( - f"{YELLOW}Downloading all the music from {content_name} ({url_type})!" + f"{YELLOW}Downloading all the music from {content_name} " + f"({url_type})!" ) new_path = self.create_dir( os.path.join(self.directory, sanitize_filename(content_name)) ) - items = [item[type_dict["iterable_key"]]["items"] for item in content][0] + items = [item[type_dict["iterable_key"]]["items"] + for item in content][0] logger.info(f"{YELLOW}{len(items)} downloads in queue") for item in items: self.download_from_id( @@ -210,9 +232,11 @@ class QobuzDL: logger.info( f'{YELLOW}Searching {self.lucky_type}s for "{query}".\n' - f"{YELLOW}qobuz-dl will attempt to download the first {self.lucky_limit} results." + f"{YELLOW}qobuz-dl will attempt to download the first " + f"{self.lucky_limit} results." ) - results = self.search_by_type(query, self.lucky_type, self.lucky_limit, True) + results = self.search_by_type(query, self.lucky_type, + self.lucky_limit, True) if download: self.download_list_of_urls(results) @@ -275,7 +299,8 @@ class QobuzDL: ) url = "{}{}/{}".format(WEB_URL, item_type, i.get("id", "")) - item_list.append({"text": text, "url": url} if not lucky else url) + item_list.append({"text": text, "url": url} if not lucky + else url) return item_list except (KeyError, IndexError): logger.info(f"{RED}Invalid type: {item_type}") @@ -287,7 +312,8 @@ class QobuzDL: except (ImportError, ModuleNotFoundError): if os.name == "nt": sys.exit( - 'Please install curses with "pip3 install windows-curses" to continue' + 'Please install curses with ' + '"pip3 install windows-curses" to continue' ) raise @@ -306,13 +332,15 @@ class QobuzDL: try: item_types = ["Albums", "Tracks", "Artists", "Playlists"] - selected_type = pick(item_types, "I'll search for:\n[press Intro]")[0][ - :-1 - ].lower() - logger.info(f"{YELLOW}Ok, we'll search for {selected_type}s{RESET}") + selected_type = pick(item_types, + "I'll search for:\n[press Intro]" + )[0][:-1].lower() + logger.info(f"{YELLOW}Ok, we'll search for " + f"{selected_type}s{RESET}") final_url_list = [] while True: - query = input(f"{CYAN}Enter your search: [Ctrl + c to quit]\n-{DF} ") + query = input(f"{CYAN}Enter your search: [Ctrl + c to quit]\n" + f"-{DF} ") logger.info(f"{YELLOW}Searching...{RESET}") options = self.search_by_type( query, selected_type, self.interactive_limit @@ -334,10 +362,12 @@ class QobuzDL: options_map_func=get_title_text, ) if len(selected_items) > 0: - [final_url_list.append(i[0]["url"]) for i in selected_items] + [final_url_list.append(i[0]["url"]) + for i in selected_items] y_n = pick( ["Yes", "No"], - "Items were added to queue to be downloaded. Keep searching?", + "Items were added to queue to be downloaded. " + "Keep searching?", ) if y_n[0][0] == "N": break @@ -347,7 +377,8 @@ class QobuzDL: if final_url_list: desc = ( "Select [intro] the quality (the quality will " - "be automatically\ndowngraded if the selected is not found)" + "be automatically\ndowngraded if the selected " + "is not found)" ) self.quality = pick( qualities, @@ -389,11 +420,13 @@ class QobuzDL: pl_title = sanitize_filename(soup.select_one("h1").text) pl_directory = os.path.join(self.directory, pl_title) logger.info( - f"{YELLOW}Downloading playlist: {pl_title} ({len(track_list)} tracks)" + f"{YELLOW}Downloading playlist: {pl_title} " + f"({len(track_list)} tracks)" ) for i in track_list: - track_id = self.get_id(self.search_by_type(i, "track", 1, lucky=True)[0]) + track_id = self.get_id(self.search_by_type(i, "track", 1, + lucky=True)[0]) if track_id: self.download_from_id(track_id, False, pl_directory) @@ -410,7 +443,9 @@ class QobuzDL: dirs.sort() audio_rel_files = [ # os.path.abspath(os.path.join(local, file_)) - # os.path.join(rel_folder, os.path.basename(os.path.normpath(local)), file_) + # os.path.join(rel_folder, + # os.path.basename(os.path.normpath(local)), + # file_) os.path.join(os.path.basename(os.path.normpath(local)), file_) for file_ in files if os.path.splitext(file_)[-1] in EXTENSIONS @@ -423,7 +458,8 @@ class QobuzDL: if not audio_files or len(audio_files) != len(audio_rel_files): continue - for audio_rel_file, audio_file in zip(audio_rel_files, audio_files): + for audio_rel_file, audio_file in zip(audio_rel_files, + audio_files): try: pl_item = ( EasyMP3(audio_file) diff --git a/qobuz_dl/metadata.py b/qobuz_dl/metadata.py index 4061df2..b3264e4 100644 --- a/qobuz_dl/metadata.py +++ b/qobuz_dl/metadata.py @@ -44,14 +44,6 @@ def tag_flac(filename, root_dir, final_name, d, album, :param bool istrack :param bool em_image: Embed cover art into file """ - print('in tag_flac d:') - # print(json.dumps(d.keys(), indent=2)) - # print(d.keys()) - print('album:') - # print(album.keys()) - # print(json.dumps(album.keys(), indent=2)) - print(f'{filename=}') - print(f'{istrack=}') audio = FLAC(filename) audio["TITLE"] = get_title(d) @@ -190,13 +182,10 @@ def tag_mp3(filename, root_dir, final_name, d, album, audio['TPOS'] = id3.TPOS(encoding=3, text=str(d["media_number"])) - def lookup_and_set_tags(tag_name, value): - id3tag = id3_legend[tag_name] - audio[id3tag.__name__] = id3tag(encoding=3, text=value) - # write metadata in `tags` to file for k, v in tags.items(): - lookup_and_set_tags(k, v) + id3tag = id3_legend[k] + audio[id3tag.__name__] = id3tag(encoding=3, text=v) if em_image: emb_image = os.path.join(root_dir, "cover.jpg") From 69728e21ee3b5e6104f4a30326eaa7b264669ea3 Mon Sep 17 00:00:00 2001 From: nathannathant <74019033+pynathanthomas@users.noreply.github.com> Date: Thu, 25 Feb 2021 13:58:04 -0800 Subject: [PATCH 2/7] fixed genre formatting issue --- qobuz_dl/metadata.py | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/qobuz_dl/metadata.py b/qobuz_dl/metadata.py index b3264e4..37162d7 100644 --- a/qobuz_dl/metadata.py +++ b/qobuz_dl/metadata.py @@ -30,6 +30,25 @@ def _format_copyright(s: str) -> str: return s +def _format_genres(genres: list) -> str: + '''Fixes the weirdly formatted genre lists returned by the API. + >>> g = ['Pop/Rock', 'Pop/Rock→Rock', 'Pop/Rock→Rock→Alternatif et Indé'] + >>> _format_genres(g) + '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) + + # 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): @@ -72,17 +91,17 @@ def tag_flac(filename, root_dir, final_name, d, album, pass if istrack: - audio["GENRE"] = ", ".join(d["album"]["genres_list"]) # GENRE - audio["ALBUMARTIST"] = d["album"]["artist"]["name"] # ALBUM ARTIST - audio["TRACKTOTAL"] = str(d["album"]["tracks_count"]) # TRACK TOTAL - audio["ALBUM"] = d["album"]["title"] # ALBUM TITLE + audio["GENRE"] = _format_genres(d["album"]["genres_list"]) # GENRE + audio["ALBUMARTIST"] = d["album"]["artist"]["name"] # ALBUMARTIST + audio["TRACKTOTAL"] = str(d["album"]["tracks_count"]) # TRACK TOTAL + audio["ALBUM"] = d["album"]["title"] # ALBUM TITLE audio["DATE"] = d["album"]["release_date_original"] audio["COPYRIGHT"] = _format_copyright(d["copyright"]) else: - audio["GENRE"] = ", ".join(album["genres_list"]) # GENRE - audio["ALBUMARTIST"] = album["artist"]["name"] # ALBUM ARTIST - audio["TRACKTOTAL"] = str(album["tracks_count"]) # TRACK TOTAL - audio["ALBUM"] = album["title"] # ALBUM TITLE + audio["GENRE"] = _format_genres(album["genres_list"]) # GENRE + audio["ALBUMARTIST"] = album["artist"]["name"] # ALBUM ARTIST + audio["TRACKTOTAL"] = str(album["tracks_count"]) # TRACK TOTAL + audio["ALBUM"] = album["title"] # ALBUM TITLE audio["DATE"] = album["release_date_original"] audio["COPYRIGHT"] = _format_copyright(album["copyright"]) @@ -161,14 +180,14 @@ def tag_mp3(filename, root_dir, final_name, d, album, tags['artist'] = album["artist"]["name"] if istrack: - tags["genre"] = ", ".join(d["album"]["genres_list"]) + tags["genre"] = _format_genres(d["album"]["genres_list"]) tags["albumartist"] = d["album"]["artist"]["name"] tags["album"] = d["album"]["title"] tags["date"] = d["album"]["release_date_original"] tags["copyright"] = _format_copyright(d["copyright"]) tracktotal = str(d["album"]["tracks_count"]) else: - tags["genre"] = ", ".join(album["genres_list"]) + tags["genre"] = _format_genres(album["genres_list"]) tags["albumartist"] = album["artist"]["name"] tags["album"] = album["title"] tags["date"] = album["release_date_original"] From 678910d2f3b2fea6ab25b3e3959354c111f17fea Mon Sep 17 00:00:00 2001 From: nathannathant <74019033+pynathanthomas@users.noreply.github.com> Date: Thu, 25 Feb 2021 14:00:48 -0800 Subject: [PATCH 3/7] misc --- qobuz_dl/downloader.py | 27 ++++++++++++++++++--------- qobuz_dl/metadata.py | 14 ++++---------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/qobuz_dl/downloader.py b/qobuz_dl/downloader.py index ad1a25b..d42bd91 100644 --- a/qobuz_dl/downloader.py +++ b/qobuz_dl/downloader.py @@ -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") diff --git a/qobuz_dl/metadata.py b/qobuz_dl/metadata.py index 37162d7..4fec874 100644 --- a/qobuz_dl/metadata.py +++ b/qobuz_dl/metadata.py @@ -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 From c9e6eb13a6ddbbc7417715a1410c9b2b241cf8cc Mon Sep 17 00:00:00 2001 From: nathannathant <74019033+pynathanthomas@users.noreply.github.com> Date: Thu, 25 Feb 2021 21:03:42 -0800 Subject: [PATCH 4/7] changed unicode arrow symbol to ascii code --- qobuz_dl/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qobuz_dl/metadata.py b/qobuz_dl/metadata.py index 4fec874..fe2fbf1 100644 --- a/qobuz_dl/metadata.py +++ b/qobuz_dl/metadata.py @@ -40,7 +40,7 @@ def _format_genres(genres: list) -> str: if genres == []: return '' else: - return ', '.join(genres[-1].split("→")) + return ', '.join(genres[-1].split('\u2192')) # Use KeyError catching instead of dict.get to avoid empty tags From c7e2d0007b843845122422b7b75a95d693ecc642 Mon Sep 17 00:00:00 2001 From: nathannathant <74019033+pynathanthomas@users.noreply.github.com> Date: Thu, 25 Feb 2021 21:09:38 -0800 Subject: [PATCH 5/7] formatting --- qobuz_dl/metadata.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/qobuz_dl/metadata.py b/qobuz_dl/metadata.py index fe2fbf1..8d594a2 100644 --- a/qobuz_dl/metadata.py +++ b/qobuz_dl/metadata.py @@ -85,17 +85,17 @@ def tag_flac(filename, root_dir, final_name, d, album, pass if istrack: - audio["GENRE"] = _format_genres(d["album"]["genres_list"]) # GENRE - audio["ALBUMARTIST"] = d["album"]["artist"]["name"] # ALBUMARTIST - audio["TRACKTOTAL"] = str(d["album"]["tracks_count"]) # TRACK TOTAL - audio["ALBUM"] = d["album"]["title"] # ALBUM TITLE + audio["GENRE"] = _format_genres(d["album"]["genres_list"]) + audio["ALBUMARTIST"] = d["album"]["artist"]["name"] + audio["TRACKTOTAL"] = str(d["album"]["tracks_count"]) + audio["ALBUM"] = d["album"]["title"] audio["DATE"] = d["album"]["release_date_original"] audio["COPYRIGHT"] = _format_copyright(d["copyright"]) else: - audio["GENRE"] = _format_genres(album["genres_list"]) # GENRE - audio["ALBUMARTIST"] = album["artist"]["name"] # ALBUM ARTIST - audio["TRACKTOTAL"] = str(album["tracks_count"]) # TRACK TOTAL - audio["ALBUM"] = album["title"] # ALBUM TITLE + audio["GENRE"] = _format_genres(album["genres_list"]) + audio["ALBUMARTIST"] = album["artist"]["name"] + audio["TRACKTOTAL"] = str(album["tracks_count"]) + audio["ALBUM"] = album["title"] audio["DATE"] = album["release_date_original"] audio["COPYRIGHT"] = _format_copyright(album["copyright"]) From bdb98bb59e4bf14298246a3baa2ea2941652db8d Mon Sep 17 00:00:00 2001 From: nathannathant <74019033+pynathanthomas@users.noreply.github.com> Date: Thu, 25 Feb 2021 21:21:44 -0800 Subject: [PATCH 6/7] Change formatting to suppress linter warnings --- qobuz_dl/downloader.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/qobuz_dl/downloader.py b/qobuz_dl/downloader.py index d42bd91..192c293 100644 --- a/qobuz_dl/downloader.py +++ b/qobuz_dl/downloader.py @@ -30,13 +30,15 @@ def tqdm_download(url, fname, track_name): def get_description(u: dict, track_title, multiple=None): - downloading_title = f'{track_title} [{u["bit_depth"]}/{u["sampling_rate"]}]' + downloading_title = f'{track_title} ' + f'[{u["bit_depth"]}/{u["sampling_rate"]}]' if multiple: downloading_title = f"[Disc {multiple}] {downloading_title}" return downloading_title -def get_format(client, item_dict, quality, is_track_id=False, track_url_dict=None): +def get_format(client, item_dict, quality, + is_track_id=False, track_url_dict=None): quality_met = True if int(quality) == 5: return "MP3", quality_met @@ -53,7 +55,8 @@ def get_format(client, item_dict, quality, is_track_id=False, track_url_dict=Non restrictions = new_track_dict.get("restrictions") if isinstance(restrictions, list): if any( - restriction.get("code") == QL_DOWNGRADE for restriction in restrictions + restriction.get("code") == QL_DOWNGRADE + for restriction in restrictions ): quality_met = False if ( @@ -62,7 +65,8 @@ def get_format(client, item_dict, quality, is_track_id=False, track_url_dict=Non ): return "FLAC", quality_met return ( - f'{new_track_dict["bit_depth"]}B-{new_track_dict["sampling_rate"]}Khz', + f'{new_track_dict["bit_depth"]}B-' + f'{new_track_dict["sampling_rate"]}Khz', quality_met, ) except (KeyError, requests.exceptions.HTTPError): @@ -112,7 +116,7 @@ def download_and_tag( :param int tmp_count: Temporal download file number :param dict track_url_dict: get_track_url dictionary from Qobuz client :param dict track_metadata: Track item dictionary from Qobuz client - :param dict album_or_track_metadata: Album/track dictionary from Qobuz client + :param dict album_or_track_metadata: Album/track dict from Qobuz client :param bool is_track :param bool is_mp3 :param bool embed_art: Embed cover art into file (FLAC-only) @@ -135,7 +139,8 @@ def download_and_tag( # Determine the filename artist = track_metadata.get("performer", {}).get("name") - album_artist = track_metadata.get("album", {}).get("artist", {}).get("name") + album_artist = track_metadata.get("album", {}).get("artist", + {}).get("name") new_track_title = track_metadata.get("title") version = track_metadata.get("version") @@ -148,7 +153,8 @@ def download_and_tag( new_track_title = f"{new_track_title} ({version})" track_file = f'{track_metadata["track_number"]:02}. {new_track_title}' - final_file = os.path.join(root_dir, sanitize_filename(track_file))[:250] + extension + final_file = os.path.join(root_dir, sanitize_filename(track_file))[:250] + + extension if os.path.isfile(final_file): logger.info(f"{OFF}{new_track_title} was already downloaded") @@ -286,7 +292,9 @@ def download_id_by_type( meta["album"]["release_date_original"].split("-")[0], track_format, ) - sanitized_title = sanitize_filename("{} - {} [{}] [{}]".format(*dirT)) + sanitized_title = sanitize_filename( + "{} - {} [{}] [{}]".format(*dirT) + ) dirn = os.path.join(path, sanitized_title) os.makedirs(dirn, exist_ok=True) if no_cover: From e03d3aa97fc46d3a573bd0e54e2a3b0113bab9a0 Mon Sep 17 00:00:00 2001 From: nathannathant <74019033+pynathanthomas@users.noreply.github.com> Date: Thu, 25 Feb 2021 21:35:47 -0800 Subject: [PATCH 7/7] fixed + operator error --- qobuz_dl/downloader.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/qobuz_dl/downloader.py b/qobuz_dl/downloader.py index 192c293..86dde5a 100644 --- a/qobuz_dl/downloader.py +++ b/qobuz_dl/downloader.py @@ -153,8 +153,7 @@ def download_and_tag( new_track_title = f"{new_track_title} ({version})" track_file = f'{track_metadata["track_number"]:02}. {new_track_title}' - final_file = os.path.join(root_dir, sanitize_filename(track_file))[:250] - + extension + final_file = os.path.join(root_dir, sanitize_filename(track_file))[:250] + extension if os.path.isfile(final_file): logger.info(f"{OFF}{new_track_title} was already downloaded")