feat:a lot of nonsences
This commit is contained in:
parent
2da7a48b72
commit
4ee6fd2137
@ -198,7 +198,12 @@ class Pages:
|
||||
|
||||
img.save(target.file_path, main_settings["image_format"])
|
||||
|
||||
|
||||
def remove_artwork_duplicates(self) -> None:
|
||||
"""
|
||||
This will eliminate duplicates within the given threshold
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
def _fetch_artist_artwork(self, artist: Artist, naming: dict):
|
||||
naming: Dict[str, List[str]] = defaultdict(list, naming)
|
||||
|
@ -80,9 +80,9 @@ class ArtworkCollection:
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*data: List[Union[Artwork, ArtworkVariant, dict]],
|
||||
*data: List[Artwork],
|
||||
parent_artworks: Set[ArtworkCollection] = None,
|
||||
crop_images: bool = True
|
||||
crop_images: bool = True,
|
||||
) -> None:
|
||||
# this is used for the song artwork, to fall back to the song artwork
|
||||
self.parent_artworks: Set[ArtworkCollection] = parent_artworks or set()
|
||||
@ -91,6 +91,8 @@ class ArtworkCollection:
|
||||
self._data = []
|
||||
self.extend(data)
|
||||
|
||||
|
||||
|
||||
def search_artwork(self, url: str) -> Optional[ArtworkVariant]:
|
||||
for artwork in self._data:
|
||||
if url in artwork:
|
||||
@ -104,7 +106,7 @@ class ArtworkCollection:
|
||||
def _create_new_artwork(self, **kwargs) -> Tuple[Artwork, dict]:
|
||||
kwargs["artwork_type"] = kwargs.get("artwork_type", self.artwork_type)
|
||||
|
||||
return create_dataclass_instance(Artwork, **kwargs)
|
||||
return create_dataclass_instance(ArtworkVariant, dict(**kwargs))
|
||||
|
||||
def add_data(self, url: str, **kwargs) -> None:
|
||||
kwargs["url"] = url
|
||||
@ -112,12 +114,16 @@ class ArtworkCollection:
|
||||
artwork = self.search_artwork(url)
|
||||
|
||||
if artwork is None:
|
||||
artwork, kwargs = self._create_new_artwork(url=url, **kwargs)
|
||||
artwork, kwargs = self._create_new_artwork(url=url)
|
||||
self._data.append(artwork)
|
||||
|
||||
artwork.add_data(url, **kwargs)
|
||||
|
||||
def append(self, value: Union[Artwork, ArtworkVariant, dict], **kwargs):
|
||||
"""
|
||||
You can append the types Artwork, ArtworkVariant or dict
|
||||
the best option would be to use Artwork and avoid the other options.
|
||||
"""
|
||||
if isinstance(value, dict):
|
||||
kwargs.update(value)
|
||||
value, kwargs = create_dataclass_instance(ArtworkVariant, kwargs)
|
||||
@ -135,6 +141,12 @@ class ArtworkCollection:
|
||||
self.append(value, **kwargs)
|
||||
|
||||
def compile(self) -> None:
|
||||
"""
|
||||
This will make the artworks ready for download
|
||||
"""
|
||||
for artwork in self._data:
|
||||
for variants in artwork.variants:
|
||||
pass
|
||||
pass
|
||||
|
||||
def __merge__(self, other: ArtworkCollection, **kwargs) -> None:
|
||||
|
Loading…
Reference in New Issue
Block a user