From fbc20d7f4dfa61575543039c7b51d170193f812f Mon Sep 17 00:00:00 2001 From: Hellow <74311245+HeIIow2@users.noreply.github.com> Date: Tue, 12 Sep 2023 16:30:08 +0200 Subject: [PATCH] feat: implemented search for track --- src/actual_donwload.py | 2 +- src/music_kraken/pages/bandcamp.py | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/actual_donwload.py b/src/actual_donwload.py index a952094..bc587f6 100644 --- a/src/actual_donwload.py +++ b/src/actual_donwload.py @@ -29,7 +29,7 @@ if __name__ == "__main__": ] youtube_music_test = [ - "s: hello" + "s: #t Self Loather" ] music_kraken.cli.download(genre="test", command_list=youtube_music_test, process_metadata_anyway=True) diff --git a/src/music_kraken/pages/bandcamp.py b/src/music_kraken/pages/bandcamp.py index 9644646..8c3459b 100644 --- a/src/music_kraken/pages/bandcamp.py +++ b/src/music_kraken/pages/bandcamp.py @@ -86,7 +86,18 @@ class Bandcamp(Page): ) if object_type is BandcampTypes.SONG: - print("NEEDING TO IMPLEMENT SONG") + return Song( + title=name, + source_list=source_list, + main_artist_list=[ + Artist( + name=data["band_name"], + source_list=[ + Source(self.SOURCE_TYPE, data["item_url_root"]) + ] + ) + ] + ) def general_search(self, search_query: str, filter_string: str = "") -> List[DatabaseObject]: results = [] @@ -113,16 +124,16 @@ class Bandcamp(Page): return results def label_search(self, label: Label) -> List[Label]: - return self.general_search(artist.name, filter_string="b") + return self.general_search(label.name, filter_string="b") def artist_search(self, artist: Artist) -> List[Artist]: return self.general_search(artist.name, filter_string="b") def album_search(self, album: Album) -> List[Album]: - return self.general_search(artist.name, filter_string="a") + return self.general_search(album.title, filter_string="a") def song_search(self, song: Song) -> List[Song]: - return self.general_search(artist.name, filter_string="t") + return self.general_search(song.title, filter_string="t") def fetch_song(self, source: Source, stop_at_level: int = 1) -> Song: return Song()