feat: added artwork to the song
This commit is contained in:
parent
50be8215ab
commit
fcbe727329
@ -23,9 +23,12 @@ class ArtworkVariant(TypedDict):
|
|||||||
|
|
||||||
|
|
||||||
class Artwork:
|
class Artwork:
|
||||||
def __init__(self, variants: List[ArtworkVariant] = None) -> None:
|
def __init__(self, *variants: List[ArtworkVariant]) -> None:
|
||||||
self._variant_mapping: Dict[str, ArtworkVariant] = {}
|
self._variant_mapping: Dict[str, ArtworkVariant] = {}
|
||||||
|
|
||||||
|
for variant in variants:
|
||||||
|
self.append(**variant)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _calculate_deviation(*dimensions: List[int]) -> float:
|
def _calculate_deviation(*dimensions: List[int]) -> float:
|
||||||
return sum(abs(d - main_settings["preferred_artwork_resolution"]) for d in dimensions) / len(dimensions)
|
return sum(abs(d - main_settings["preferred_artwork_resolution"]) for d in dimensions) / len(dimensions)
|
||||||
|
@ -37,9 +37,6 @@ class InnerData:
|
|||||||
|
|
||||||
def __merge__(self, __other: InnerData, override: bool = False):
|
def __merge__(self, __other: InnerData, override: bool = False):
|
||||||
"""
|
"""
|
||||||
TODO
|
|
||||||
is default is totally ignored
|
|
||||||
|
|
||||||
:param __other:
|
:param __other:
|
||||||
:param override:
|
:param override:
|
||||||
:return:
|
:return:
|
||||||
|
@ -11,6 +11,7 @@ from .collection import Collection
|
|||||||
from .formatted_text import FormattedText
|
from .formatted_text import FormattedText
|
||||||
from .lyrics import Lyrics
|
from .lyrics import Lyrics
|
||||||
from .contact import Contact
|
from .contact import Contact
|
||||||
|
from .artwork import Artwork
|
||||||
from .metadata import (
|
from .metadata import (
|
||||||
Mapping as id3Mapping,
|
Mapping as id3Mapping,
|
||||||
ID3Timestamp,
|
ID3Timestamp,
|
||||||
@ -43,6 +44,7 @@ class Song(Base):
|
|||||||
genre: str
|
genre: str
|
||||||
note: FormattedText
|
note: FormattedText
|
||||||
tracksort: int
|
tracksort: int
|
||||||
|
artwork: Artwork
|
||||||
|
|
||||||
source_collection: SourceCollection
|
source_collection: SourceCollection
|
||||||
target_collection: Collection[Target]
|
target_collection: Collection[Target]
|
||||||
@ -57,6 +59,7 @@ class Song(Base):
|
|||||||
"source_collection": SourceCollection,
|
"source_collection": SourceCollection,
|
||||||
"target_collection": Collection,
|
"target_collection": Collection,
|
||||||
"lyrics_collection": Collection,
|
"lyrics_collection": Collection,
|
||||||
|
"artwork": Artwork,
|
||||||
|
|
||||||
"main_artist_collection": Collection,
|
"main_artist_collection": Collection,
|
||||||
"album_collection": Collection,
|
"album_collection": Collection,
|
||||||
|
Loading…
Reference in New Issue
Block a user