finished fetching of discography and merging those
This commit is contained in:
parent
2e6c58255c
commit
911ae0c25a
@ -51,6 +51,9 @@ else:
|
|||||||
print_song(song)
|
print_song(song)
|
||||||
|
|
||||||
artist = song.main_artist_list[0]
|
artist = song.main_artist_list[0]
|
||||||
|
|
||||||
|
print_artist(artist)
|
||||||
|
|
||||||
artist = EncyclopaediaMetallum.fetch_artist_details(artist)
|
artist = EncyclopaediaMetallum.fetch_artist_details(artist)
|
||||||
|
|
||||||
print_artist(artist)
|
print_artist(artist)
|
||||||
|
@ -201,6 +201,11 @@ class EncyclopaediaMetallum(Page):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def add_dicography(cls, artist: Artist, ma_artist_id: str) -> Artist:
|
def add_dicography(cls, artist: Artist, ma_artist_id: str) -> Artist:
|
||||||
|
"""
|
||||||
|
TODO
|
||||||
|
I'd guess this funktion has quite some posibility for otimizations
|
||||||
|
in form of performance and clean code
|
||||||
|
"""
|
||||||
discography_url = "https://www.metal-archives.com/band/discography/id/{}/tab/all"
|
discography_url = "https://www.metal-archives.com/band/discography/id/{}/tab/all"
|
||||||
|
|
||||||
# prepare tracklist
|
# prepare tracklist
|
||||||
@ -209,7 +214,7 @@ class EncyclopaediaMetallum(Page):
|
|||||||
for album in artist.main_albums:
|
for album in artist.main_albums:
|
||||||
album_by_name[string_processing.unify(album.title)] = album
|
album_by_name[string_processing.unify(album.title)] = album
|
||||||
for source in album.get_sources_from_page(cls.SOURCE_TYPE):
|
for source in album.get_sources_from_page(cls.SOURCE_TYPE):
|
||||||
album_by_url[source.url] = Album
|
album_by_url[source.url] = album
|
||||||
old_discography = artist.main_albums.copy()
|
old_discography = artist.main_albums.copy()
|
||||||
# save the ids of the albums, that are added to this set, so I can
|
# save the ids of the albums, that are added to this set, so I can
|
||||||
# efficiently add all leftover albums from the discograpy to the new one
|
# efficiently add all leftover albums from the discograpy to the new one
|
||||||
@ -238,9 +243,11 @@ class EncyclopaediaMetallum(Page):
|
|||||||
unified_name = string_processing.unify(album_name)
|
unified_name = string_processing.unify(album_name)
|
||||||
|
|
||||||
album_obj: Album = Album(id_=album_id)
|
album_obj: Album = Album(id_=album_id)
|
||||||
|
|
||||||
if album_url in album_by_url:
|
if album_url in album_by_url:
|
||||||
album_obj = album_by_url[album_url]
|
album_obj = album_by_url[album_url]
|
||||||
used_ids.add(album_obj.id)
|
used_ids.add(album_obj.id)
|
||||||
|
|
||||||
elif unified_name in album_by_name:
|
elif unified_name in album_by_name:
|
||||||
album_obj = album_by_name[unified_name]
|
album_obj = album_by_name[unified_name]
|
||||||
album_obj.add_source(Source(SourcePages.ENCYCLOPAEDIA_METALLUM, album_url))
|
album_obj.add_source(Source(SourcePages.ENCYCLOPAEDIA_METALLUM, album_url))
|
||||||
|
Loading…
Reference in New Issue
Block a user