From a0305a7a6ea8b04757a139ce465d732fe5169f76 Mon Sep 17 00:00:00 2001 From: Hellow <74311245+HeIIow2@users.noreply.github.com> Date: Wed, 8 May 2024 16:47:56 +0200 Subject: [PATCH] fix: don't add year as artist --- development/actual_donwload.py | 6 +++--- music_kraken/pages/musify.py | 21 ++++++++++++--------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/development/actual_donwload.py b/development/actual_donwload.py index 548e228..65d07f9 100644 --- a/development/actual_donwload.py +++ b/development/actual_donwload.py @@ -6,9 +6,9 @@ logging.getLogger().setLevel(logging.DEBUG) if __name__ == "__main__": commands = [ - "s: #a Crystal F", - "10", - "2", + "s: #a Happy Days", + "7", + "9", ] diff --git a/music_kraken/pages/musify.py b/music_kraken/pages/musify.py index ebcb8e6..2a9fc8f 100644 --- a/music_kraken/pages/musify.py +++ b/music_kraken/pages/musify.py @@ -681,17 +681,20 @@ class Musify(Page): anchor: BeautifulSoup = artist_crumb.find("a") if anchor is not None: href = anchor.get("href") - artist_source_list: List[Source] = [] - if href is not None: - artist_source_list.append(Source(self.SOURCE_TYPE, self.HOST + href.strip())) + href_parts = href.split("/") + if not(len(href_parts) <= 1 or href_parts[-2] != "artist"): + artist_source_list: List[Source] = [] - span: BeautifulSoup = anchor.find("span") - if span is not None: - artist_list.append(Artist( - name=span.get_text(strip=True), - source_list=artist_source_list - )) + if href is not None: + artist_source_list.append(Source(self.SOURCE_TYPE, self.HOST + href.strip())) + + span: BeautifulSoup = anchor.find("span") + if span is not None: + artist_list.append(Artist( + name=span.get_text(strip=True), + source_list=artist_source_list + )) else: self.LOGGER.debug("there are not 4 breadcrumb items, which shouldn't be the case")