From 2e75bf4fdcad7fe475768819d8894339e5d1052c Mon Sep 17 00:00:00 2001 From: Robert Honz Date: Fri, 9 Feb 2024 11:01:25 +0100 Subject: 🛠️ Skip lyrics if lyrics not available. Fixes #38 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tidal_dl_ng/download.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tidal_dl_ng/download.py b/tidal_dl_ng/download.py index e67ce96..7490753 100644 --- a/tidal_dl_ng/download.py +++ b/tidal_dl_ng/download.py @@ -296,12 +296,13 @@ class Download: if self.settings.data.lyrics_embed or self.settings.data.lyrics_file: # Try to retrieve lyrics. try: - lyrics: str = track.lyrics().subtitles if hasattr(track, "lyrics") else "" - except HTTPError: + lyrics: str = track.lyrics().subtitles + except (HTTPError, AttributeError): + lyrics: str = "" # TODO: Implement proper logging. print(f"Could not retrieve lyrics for `{name_builder_item(track)}`.") - if lyrics: + if lyrics and self.settings.data.lyrics_file: self.lyrics_write_file(path_file + EXTENSION_LYRICS, lyrics) # `None` values are not allowed. -- cgit v1.3.1