This commit is contained in:
Hellow2 2023-02-01 14:26:54 +01:00
parent 18eef1234d
commit 611fbe575d
2 changed files with 25 additions and 1 deletions

View File

@ -363,7 +363,11 @@ class Artist(DatabaseObject, SourceAttribute, MetadataAttribute):
feature_songs: List[Song] = None,
main_albums: List[Album] = None,
album_type: str = None,
notes: str = None
notes: str = None,
lyrical_themes: List[str] = None,
general_genre: str = "",
country: pycountry.Country = None,
formed_in: ID3Timestamp = None
):
DatabaseObject.__init__(self, id_=id_)
@ -371,7 +375,17 @@ class Artist(DatabaseObject, SourceAttribute, MetadataAttribute):
TODO implement album type and notes
"""
self.album_type = album_type
self.country: pycountry.Country = country
"""
notes, generall genre, lyrics themes are attributes
which are meant to only use in outputs to describe the object
i mean do as you want but there aint no strict rule about em so good luck
"""
self.notes = notes
self.lyrical_themes: List[str] = lyrical_themes
if self.lyrical_themes is None:
self.lyrical_themes = []
self.general_genre = general_genre
if main_albums is None:
main_albums = []

View File

@ -334,6 +334,7 @@ class EncyclopaediaMetallum(Page):
if "Country of origin:" == title_text:
href = data.find('a').get('href')
country = pycountry.countries.get(alpha_2=href.split("/")[-1])
artist.country = country
continue
# not needed: Location: Minot, North Dakota
@ -349,13 +350,20 @@ class EncyclopaediaMetallum(Page):
continue
if "Genre:" == title_text:
genre = data.text
artist.general_genre = genre
continue
if "Lyrical themes:" == title_text:
lyrical_themes = data.text.split(", ")
artist.lyrical_themes = lyrical_themes
continue
if "Current label:" == title_text:
label_name = data.text
label_url = data.find("a").get("href")
for album in artist.main_albums:
if album.label is not None:
continue
album.label = label_name
continue
"""
@ -372,6 +380,8 @@ class EncyclopaediaMetallum(Page):
print("lyrical themes", lyrical_themes)
print("label", label_name, label_url)
return artist
@classmethod