diff --git a/documentation/html/bandcamp/artist_page.html b/documentation/html/bandcamp/artist_page.html new file mode 100644 index 0000000..06504a2 --- /dev/null +++ b/documentation/html/bandcamp/artist_page.html @@ -0,0 +1,125 @@ + + + + + + + + Music | Only Smile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+ +
+ + + + +
+ + +
+

about

+ +

+ Only Smile + Russia +

+ + + +
+ +

+ + Contact Only Smile + +

+ + +

+ + Streaming and +
+ Download help +
+

+
+
+
+
+ + diff --git a/src/actual_donwload.py b/src/actual_donwload.py index bc587f6..59e7667 100644 --- a/src/actual_donwload.py +++ b/src/actual_donwload.py @@ -29,7 +29,8 @@ if __name__ == "__main__": ] youtube_music_test = [ - "s: #t Self Loather" + "s: #a Only Smile", + "0" ] 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 8c3459b..983053f 100644 --- a/src/music_kraken/pages/bandcamp.py +++ b/src/music_kraken/pages/bandcamp.py @@ -43,6 +43,15 @@ class Bandcamp(Page): super().__init__(*args, **kwargs) def get_source_type(self, source: Source) -> Optional[Type[DatabaseObject]]: + parsed_url = urlparse(source.url) + + if parsed_url.path == "": + return Artist + if parsed_url.path.startswith("/album/"): + return Album + if parsed_url.path.startswith("/track/"): + return Song + return super().get_source_type(source) def _parse_autocomplete_api_result(self, data: dict) -> DatabaseObject: @@ -135,15 +144,31 @@ class Bandcamp(Page): def song_search(self, song: Song) -> List[Song]: return self.general_search(song.title, filter_string="t") + + def fetch_artist(self, source: Source, stop_at_level: int = 1) -> Artist: + artist = Artist() + + r = self.connection.get(source.url) + if r is None: + return artist + + soup = self.get_soup_from_response(r) + data_container = soup.find("div", {"id": "pagedata"}) + data = data_container["data-blob"] + + if DEBUG: + dump_to_file("artist_page.html", r.text, exit_after_dump=False) + dump_to_file("bandcamp_artis.json", data, is_json=True, exit_after_dump=False) + + return artist + def fetch_song(self, source: Source, stop_at_level: int = 1) -> Song: + print(source) return Song() def fetch_album(self, source: Source, stop_at_level: int = 1) -> Album: return Album() - def fetch_artist(self, source: Source, stop_at_level: int = 1) -> Artist: - return Artist() - def fetch_label(self, source: Source, stop_at_level: int = 1) -> Label: return Label()