From fcbe727329a9fff51454772bd6addd581040554d Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Wed, 10 Apr 2024 17:06:29 +0200 Subject: [PATCH] feat: added artwork to the song --- music_kraken/objects/artwork.py | 5 ++++- music_kraken/objects/parents.py | 3 --- music_kraken/objects/song.py | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/music_kraken/objects/artwork.py b/music_kraken/objects/artwork.py index 93b159e..94e4b58 100644 --- a/music_kraken/objects/artwork.py +++ b/music_kraken/objects/artwork.py @@ -23,9 +23,12 @@ class ArtworkVariant(TypedDict): class Artwork: - def __init__(self, variants: List[ArtworkVariant] = None) -> None: + def __init__(self, *variants: List[ArtworkVariant]) -> None: self._variant_mapping: Dict[str, ArtworkVariant] = {} + for variant in variants: + self.append(**variant) + @staticmethod def _calculate_deviation(*dimensions: List[int]) -> float: return sum(abs(d - main_settings["preferred_artwork_resolution"]) for d in dimensions) / len(dimensions) diff --git a/music_kraken/objects/parents.py b/music_kraken/objects/parents.py index e07e6e1..80bd237 100644 --- a/music_kraken/objects/parents.py +++ b/music_kraken/objects/parents.py @@ -37,9 +37,6 @@ class InnerData: def __merge__(self, __other: InnerData, override: bool = False): """ - TODO - is default is totally ignored - :param __other: :param override: :return: diff --git a/music_kraken/objects/song.py b/music_kraken/objects/song.py index 0116616..3ec2975 100644 --- a/music_kraken/objects/song.py +++ b/music_kraken/objects/song.py @@ -11,6 +11,7 @@ from .collection import Collection from .formatted_text import FormattedText from .lyrics import Lyrics from .contact import Contact +from .artwork import Artwork from .metadata import ( Mapping as id3Mapping, ID3Timestamp, @@ -43,6 +44,7 @@ class Song(Base): genre: str note: FormattedText tracksort: int + artwork: Artwork source_collection: SourceCollection target_collection: Collection[Target] @@ -57,6 +59,7 @@ class Song(Base): "source_collection": SourceCollection, "target_collection": Collection, "lyrics_collection": Collection, + "artwork": Artwork, "main_artist_collection": Collection, "album_collection": Collection,