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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user