feat: added extend
This commit is contained in:
parent
eef3ea7f07
commit
346d273201
@ -89,6 +89,7 @@ class ArtworkCollection:
|
|||||||
self.crop_images: bool = crop_images
|
self.crop_images: bool = crop_images
|
||||||
|
|
||||||
self._data = []
|
self._data = []
|
||||||
|
self.extend(data)
|
||||||
|
|
||||||
def search_artwork(self, url: str) -> Optional[ArtworkVariant]:
|
def search_artwork(self, url: str) -> Optional[ArtworkVariant]:
|
||||||
for artwork in self._data:
|
for artwork in self._data:
|
||||||
@ -128,6 +129,10 @@ class ArtworkCollection:
|
|||||||
if isinstance(value, Artwork):
|
if isinstance(value, Artwork):
|
||||||
self._data.append(value)
|
self._data.append(value)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def extend(self, values: List[Union[Artwork, ArtworkVariant, dict]], **kwargs):
|
||||||
|
for value in values:
|
||||||
|
self.append(value, **kwargs)
|
||||||
|
|
||||||
def __merge__(self, other: ArtworkCollection, **kwargs) -> None:
|
def __merge__(self, other: ArtworkCollection, **kwargs) -> None:
|
||||||
self.parent_artworks.update(other.parent_artworks)
|
self.parent_artworks.update(other.parent_artworks)
|
||||||
|
Loading…
Reference in New Issue
Block a user