diff --git a/src/actual_donwload.py b/src/actual_donwload.py index 3b575cc..5070293 100644 --- a/src/actual_donwload.py +++ b/src/actual_donwload.py @@ -43,8 +43,9 @@ if __name__ == "__main__": bandcamp_test = [ "s: #a Ghost Bath", + "3", "d: 0" ] - music_kraken.cli.download(genre="test", command_list=cross_download, process_metadata_anyway=True) \ No newline at end of file + music_kraken.cli.download(genre="test", command_list=bandcamp_test, process_metadata_anyway=True) \ No newline at end of file diff --git a/src/music_kraken/pages/abstract.py b/src/music_kraken/pages/abstract.py index 99d56e9..c8c3973 100644 --- a/src/music_kraken/pages/abstract.py +++ b/src/music_kraken/pages/abstract.py @@ -24,6 +24,7 @@ from ..utils.enums.album import AlbumType from ..audio import write_metadata_to_target, correct_codec from ..utils.config import main_settings from ..utils.support_classes import Query, DownloadResult +from ..utils.string_processing import fit_to_file_system INDEPENDENT_DB_OBJECTS = Union[Label, Album, Artist, Song] @@ -53,17 +54,12 @@ class NamingDict(dict): return type(self)(super().copy(), self.object_mappings.copy()) def __getitem__(self, key: str) -> str: - return super().__getitem__(key) + return fit_to_file_system(super().__getitem__(key)) def default_value_for_name(self, name: str) -> str: return f'Various {name.replace("_", " ").title()}' def __missing__(self, key: str) -> str: - """ - TODO - add proper logging - """ - if "." not in key: if key not in self.CUSTOM_KEYS: return self.default_value_for_name(key) @@ -331,10 +327,6 @@ class Page: return Label() def download(self, music_object: DatabaseObject, genre: str, download_all: bool = False, process_metadata_anyway: bool = False) -> DownloadResult: - # print("downloading") - - # self.fetch_details(music_object, stop_at_level=1) - naming_dict: NamingDict = NamingDict({"genre": genre}) def fill_naming_objects(naming_music_object: DatabaseObject): diff --git a/src/music_kraken/pages/bandcamp.py b/src/music_kraken/pages/bandcamp.py index a179489..24eb37b 100644 --- a/src/music_kraken/pages/bandcamp.py +++ b/src/music_kraken/pages/bandcamp.py @@ -223,7 +223,7 @@ class Bandcamp(Page): def fetch_artist(self, source: Source, stop_at_level: int = 1) -> Artist: artist = Artist() - r = self.connection.get(source.url) + r = self.connection.get(_parse_artist_url(source.url)) if r is None: return artist diff --git a/src/music_kraken/pages/encyclopaedia_metallum.py b/src/music_kraken/pages/encyclopaedia_metallum.py index 2025af6..41fbb22 100644 --- a/src/music_kraken/pages/encyclopaedia_metallum.py +++ b/src/music_kraken/pages/encyclopaedia_metallum.py @@ -92,7 +92,7 @@ def _album_from_json(album_html=None, release_type=None, artist_html=None) -> Al # Self Loather' soup = BeautifulSoup(album_html, 'html.parser') anchor = soup.find('a') - album_name = anchor.text + album_name = anchor.text.strip() album_url = anchor.get('href') album_id = album_url.split("/")[-1] @@ -304,9 +304,7 @@ class EncyclopaediaMetallum(Page): continue source_list.append(Source.match_url(url, referer_page=self.SOURCE_TYPE)) - - print(source_list) - + return source_list def _parse_artist_attributes(self, artist_soup: BeautifulSoup) -> Artist: diff --git a/src/music_kraken/utils/shared.py b/src/music_kraken/utils/shared.py index 2c2013c..bfe483e 100644 --- a/src/music_kraken/utils/shared.py +++ b/src/music_kraken/utils/shared.py @@ -2,7 +2,7 @@ import random from .config import main_settings -DEBUG = True +DEBUG = False DEBUG_LOGGIN = DEBUG and False DEBUG_YOUTUBE_INITIALIZING = DEBUG and False DEBUG_PAGES = DEBUG and False