feat: made the artwork mergable

This commit is contained in:
Hazel 2024-04-10 16:47:38 +02:00
parent 25c20a7ef3
commit 1bb9fd6d9c

View File

@ -41,3 +41,8 @@ class Artwork:
@property
def best_variant(self) -> ArtworkVariant:
return min(self._variant_mapping.values(), key=lambda x: x["deviation"])
def __merge__(self, other: Artwork, override: bool = False) -> None:
for key, value in other._variant_mapping.items():
if key not in self._variant_mapping or override:
self._variant_mapping[key] = value