feat: added artwork to the song

This commit is contained in:
Hazel 2024-04-10 17:06:29 +02:00
parent 50be8215ab
commit fcbe727329
3 changed files with 7 additions and 4 deletions

View File

@ -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)

View File

@ -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:

View File

@ -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,