feat: renamed main album collection to album collection
This commit is contained in:
@@ -153,7 +153,12 @@ class Song(Base):
|
||||
"song_collection": self,
|
||||
}
|
||||
self.artist_collection.extend_object_to_attribute = {
|
||||
"main_album_collection": self.album_collection
|
||||
"album_collection": self.album_collection
|
||||
}
|
||||
|
||||
|
||||
self.album_collection.append_object_to_attribute = {
|
||||
"artist_collection": self
|
||||
}
|
||||
|
||||
self.feature_artist_collection.push_to = [self.artist_collection]
|
||||
@@ -314,7 +319,7 @@ class Album(Base):
|
||||
}
|
||||
|
||||
self.artist_collection.append_object_to_attribute = {
|
||||
"main_album_collection": self
|
||||
"album_collection": self
|
||||
}
|
||||
self.artist_collection.extend_object_to_attribute = {
|
||||
"label_collection": self.label_collection
|
||||
@@ -475,7 +480,7 @@ class Artist(Base):
|
||||
source_collection: SourceCollection
|
||||
contact_collection: Collection[Contact]
|
||||
|
||||
main_album_collection: Collection[Album]
|
||||
album_collection: Collection[Album]
|
||||
label_collection: Collection[Label]
|
||||
|
||||
_default_factories = {
|
||||
@@ -489,7 +494,7 @@ class Artist(Base):
|
||||
"general_genre": lambda: "",
|
||||
|
||||
"source_collection": SourceCollection,
|
||||
"main_album_collection": Collection,
|
||||
"album_collection": Collection,
|
||||
"contact_collection": Collection,
|
||||
"label_collection": Collection,
|
||||
}
|
||||
@@ -520,7 +525,7 @@ class Artist(Base):
|
||||
Base.__init__(**real_kwargs)
|
||||
|
||||
|
||||
DOWNWARDS_COLLECTION_STRING_ATTRIBUTES = ("main_album_collection",)
|
||||
DOWNWARDS_COLLECTION_STRING_ATTRIBUTES = ("album_collection",)
|
||||
UPWARDS_COLLECTION_STRING_ATTRIBUTES = ("label_collection",)
|
||||
|
||||
def __init_collections__(self):
|
||||
@@ -537,7 +542,7 @@ class Artist(Base):
|
||||
return
|
||||
|
||||
if object_type is Album:
|
||||
self.main_album_collection.extend(object_list)
|
||||
self.album_collection.extend(object_list)
|
||||
return
|
||||
|
||||
if object_type is Label:
|
||||
@@ -550,7 +555,7 @@ class Artist(Base):
|
||||
def update_albumsort(self):
|
||||
"""
|
||||
This updates the albumsort attributes, of the albums in
|
||||
`self.main_album_collection`, and sorts the albums, if possible.
|
||||
`self.album_collection`, and sorts the albums, if possible.
|
||||
|
||||
It is advised to only call this function, once all the albums are
|
||||
added to the artist.
|
||||
@@ -568,7 +573,7 @@ class Artist(Base):
|
||||
|
||||
# order albums in the previously defined section
|
||||
album: Album
|
||||
for album in self.main_album_collection:
|
||||
for album in self.album_collection:
|
||||
sections[type_section[album.album_type]].append(album)
|
||||
|
||||
def sort_section(_section: List[Album], last_albumsort: int) -> int:
|
||||
@@ -599,7 +604,7 @@ class Artist(Base):
|
||||
album_list.extend(sections[section_index])
|
||||
|
||||
# replace the old collection with the new one
|
||||
self.main_album_collection._data = album_list
|
||||
self.album_collection._data = album_list
|
||||
|
||||
INDEX_DEPENDS_ON = ("name", "source_collection", "contact_collection")
|
||||
@property
|
||||
@@ -625,8 +630,8 @@ class Artist(Base):
|
||||
r += get_collection_string(self.label_collection, " under {}")
|
||||
|
||||
r += OPTION_BACKGROUND.value
|
||||
if len(self.main_album_collection) > 0:
|
||||
r += f" with {len(self.main_album_collection)} albums"
|
||||
if len(self.album_collection) > 0:
|
||||
r += f" with {len(self.album_collection)} albums"
|
||||
|
||||
r += BColors.ENDC.value
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ class Bandcamp(Page):
|
||||
html_music_grid = soup.find("ol", {"id": "music-grid"})
|
||||
if html_music_grid is not None:
|
||||
for subsoup in html_music_grid.find_all("li"):
|
||||
artist.main_album_collection.append(self._parse_album(soup=subsoup, initial_source=source))
|
||||
artist.album_collection.append(self._parse_album(soup=subsoup, initial_source=source))
|
||||
|
||||
for i, data_blob_soup in enumerate(soup.find_all("div", {"id": ["pagedata", "collectors-data"]})):
|
||||
data_blob = data_blob_soup["data-blob"]
|
||||
@@ -246,7 +246,7 @@ class Bandcamp(Page):
|
||||
dump_to_file(f"bandcamp_artist_data_blob_{i}.json", data_blob, is_json=True, exit_after_dump=False)
|
||||
|
||||
if data_blob is not None:
|
||||
artist.main_album_collection.extend(
|
||||
artist.album_collection.extend(
|
||||
self._parse_artist_data_blob(json.loads(data_blob), source.url)
|
||||
)
|
||||
|
||||
|
||||
@@ -663,7 +663,7 @@ class EncyclopaediaMetallum(Page):
|
||||
artist.notes = band_notes
|
||||
|
||||
discography: List[Album] = self._fetch_artist_discography(artist_id)
|
||||
artist.main_album_collection.extend(discography)
|
||||
artist.album_collection.extend(discography)
|
||||
|
||||
return artist
|
||||
|
||||
|
||||
@@ -1054,7 +1054,7 @@ class Musify(Page):
|
||||
if not self.fetch_options.download_all and album.album_type in self.fetch_options.album_type_blacklist:
|
||||
continue
|
||||
|
||||
artist.main_album_collection.append(album)
|
||||
artist.album_collection.append(album)
|
||||
|
||||
def fetch_artist(self, source: Source, **kwargs) -> Artist:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user