Compare commits

...

2 Commits

Author SHA1 Message Date
1ef4b27f28 feat: added album.artwork to datastructure
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-06-04 10:31:23 +02:00
eb8fd5e580 feat: added artist.artwork to data structure 2024-06-04 10:13:34 +02:00

View File

@ -8,7 +8,7 @@ import copy
import pycountry
from ..utils.enums.album import AlbumType, AlbumStatus
from .collection import Collection
from .collection import Collection, AppendHookArguments
from .formatted_text import FormattedText
from .lyrics import Lyrics
from .contact import Contact
@ -144,6 +144,14 @@ class Song(Base):
UPWARDS_COLLECTION_STRING_ATTRIBUTES = ("artist_collection", "feature_artist_collection", "album_collection")
TITEL = "title"
@staticmethod
def register_artwork_parent(append_hook_arguments: AppendHookArguments):
album: Album = append_hook_arguments.new_object
song: Song
for song in append_hook_arguments.collection_root_objects:
song.artwork.parent_artworks.add(album.artwork)
def __init_collections__(self) -> None:
self.feature_artist_collection.push_to = [self.artist_collection]
self.artist_collection.pull_from = [self.feature_artist_collection]
@ -161,6 +169,7 @@ class Song(Base):
self.feature_artist_collection.extend_object_to_attribute = {
"album_collection": self.album_collection
}
self.album_collection.append_callbacks = set((Song.register_artwork_parent, ))
def _add_other_db_objects(self, object_type: Type[OuterProxy], object_list: List[OuterProxy]):
if object_type is Song:
@ -249,6 +258,7 @@ class Album(Base):
albumsort: int
notes: FormattedText
artwork: Artwork
source_collection: SourceCollection
song_collection: Collection[Song]
@ -268,6 +278,7 @@ class Album(Base):
"date": ID3Timestamp,
"notes": FormattedText,
"artwork": lambda: Artwork(crop_images=False),
"source_collection": SourceCollection,
"song_collection": Collection,
@ -290,6 +301,7 @@ class Album(Base):
barcode: str = None,
albumsort: int = None,
notes: FormattedText = None,
artwork: Artwork = None,
source_list: List[Source] = None,
artist_list: List[Artist] = None,
song_list: List[Song] = None,
@ -304,6 +316,13 @@ class Album(Base):
DOWNWARDS_COLLECTION_STRING_ATTRIBUTES = ("song_collection",)
UPWARDS_COLLECTION_STRING_ATTRIBUTES = ("label_collection", "artist_collection")
@staticmethod
def register_artwork_parent(append_hook_arguments: AppendHookArguments):
song: Song = append_hook_arguments.new_object
for root_object in append_hook_arguments.collection_root_objects:
song.artwork.parent_artworks.add(root_object.artwork)
def __init_collections__(self):
self.feature_artist_collection.push_to = [self.artist_collection]
self.artist_collection.pull_from = [self.feature_artist_collection]
@ -322,6 +341,8 @@ class Album(Base):
"label_collection": self.label_collection
}
self.song_collection.append_callbacks = set((Album.register_artwork_parent, ))
def _add_other_db_objects(self, object_type: Type[OuterProxy], object_list: List[OuterProxy]):
if object_type is Song:
self.song_collection.extend(object_list)
@ -477,7 +498,7 @@ class Artist(Base):
general_genre: str
unformatted_location: str
artwork: List[Artwork]
artwork: Artwork
source_collection: SourceCollection
contact_collection: Collection[Contact]
@ -495,7 +516,7 @@ class Artist(Base):
"lyrical_themes": list,
"general_genre": lambda: "",
"artwork": list,
"artwork": Artwork,
"source_collection": SourceCollection,
"album_collection": Collection,
@ -515,7 +536,7 @@ class Artist(Base):
notes: FormattedText = None,
lyrical_themes: List[str] = None,
general_genre: str = None,
artwork: List[Artwork] = None,
artwork: Artwork = None,
unformatted_location: str = None,
source_list: List[Source] = None,
contact_list: List[Contact] = None,