finished fetching of tracklist

This commit is contained in:
Hellow2
2023-02-08 17:14:51 +01:00
parent 42852fbd32
commit 9efc806bec
4 changed files with 60 additions and 60 deletions

View File

@@ -73,3 +73,12 @@ class Collection:
def __str__(self) -> str:
return "\n".join([f"{str(j).zfill(2)}: {i}" for j, i in enumerate(self._data)])
def __len__(self) -> int:
return len(self._data)
def copy(self) -> List:
"""
returns a shallow copy of the data list
"""
return self._data.copy()

View File

@@ -264,9 +264,17 @@ class Album(DatabaseObject, SourceAttribute, MetadataAttribute):
dynamic: bool = False,
source_list: List[Source] = None,
artists: list = None,
tracklist: List[Song] = None
tracklist: List[Song] = None,
album_type: str = None
) -> None:
DatabaseObject.__init__(self, id_=id_, dynamic=dynamic)
"""
TODO
add to db
"""
self.album_type = album_type
self.title: str = title
self.album_status: str = album_status
self.label = label
@@ -413,9 +421,18 @@ class Artist(DatabaseObject, SourceAttribute, MetadataAttribute):
self.name: str | None = name
self.main_songs = main_songs
self.feature_songs = feature_songs
self.main_albums = main_albums
self.feature_songs = Collection(
data=feature_songs,
map_attributes=["title"],
element_type=Song
)
self.main_albums = Collection(
data=main_albums,
map_attributes=["title"],
element_type=Album
)
if source_list is not None:
self.source_list = source_list
@@ -467,10 +484,6 @@ class Artist(DatabaseObject, SourceAttribute, MetadataAttribute):
return flat_copy_discography
def get_metadata(self) -> MetadataAttribute.Metadata:
"""
TODO refactor
:return:
"""
metadata = MetadataAttribute.Metadata({
id3Mapping.ARTIST: [self.name]
})