fix: calling the proper artist page

This commit is contained in:
Hellow 2023-09-13 20:02:36 +02:00
parent 1794c0535e
commit a039643ba2
5 changed files with 8 additions and 17 deletions

View File

@ -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)
music_kraken.cli.download(genre="test", command_list=bandcamp_test, process_metadata_anyway=True)

View File

@ -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):

View File

@ -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

View File

@ -92,7 +92,7 @@ def _album_from_json(album_html=None, release_type=None, artist_html=None) -> Al
# <a href="https://www.metal-archives.com/albums/Ghost_Bath/Self_Loather/970834">Self Loather</a>'
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]
@ -305,8 +305,6 @@ class EncyclopaediaMetallum(Page):
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:

View File

@ -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