Compare commits
2 Commits
49c3734526
...
1ef4b27f28
Author | SHA1 | Date | |
---|---|---|---|
1ef4b27f28 | |||
eb8fd5e580 |
@ -8,7 +8,7 @@ import copy
|
|||||||
import pycountry
|
import pycountry
|
||||||
|
|
||||||
from ..utils.enums.album import AlbumType, AlbumStatus
|
from ..utils.enums.album import AlbumType, AlbumStatus
|
||||||
from .collection import Collection
|
from .collection import Collection, AppendHookArguments
|
||||||
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
|
||||||
@ -144,6 +144,14 @@ class Song(Base):
|
|||||||
UPWARDS_COLLECTION_STRING_ATTRIBUTES = ("artist_collection", "feature_artist_collection", "album_collection")
|
UPWARDS_COLLECTION_STRING_ATTRIBUTES = ("artist_collection", "feature_artist_collection", "album_collection")
|
||||||
TITEL = "title"
|
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:
|
def __init_collections__(self) -> None:
|
||||||
self.feature_artist_collection.push_to = [self.artist_collection]
|
self.feature_artist_collection.push_to = [self.artist_collection]
|
||||||
self.artist_collection.pull_from = [self.feature_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 = {
|
self.feature_artist_collection.extend_object_to_attribute = {
|
||||||
"album_collection": self.album_collection
|
"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]):
|
def _add_other_db_objects(self, object_type: Type[OuterProxy], object_list: List[OuterProxy]):
|
||||||
if object_type is Song:
|
if object_type is Song:
|
||||||
@ -249,6 +258,7 @@ class Album(Base):
|
|||||||
albumsort: int
|
albumsort: int
|
||||||
notes: FormattedText
|
notes: FormattedText
|
||||||
|
|
||||||
|
artwork: Artwork
|
||||||
source_collection: SourceCollection
|
source_collection: SourceCollection
|
||||||
|
|
||||||
song_collection: Collection[Song]
|
song_collection: Collection[Song]
|
||||||
@ -268,6 +278,7 @@ class Album(Base):
|
|||||||
"date": ID3Timestamp,
|
"date": ID3Timestamp,
|
||||||
"notes": FormattedText,
|
"notes": FormattedText,
|
||||||
|
|
||||||
|
"artwork": lambda: Artwork(crop_images=False),
|
||||||
"source_collection": SourceCollection,
|
"source_collection": SourceCollection,
|
||||||
|
|
||||||
"song_collection": Collection,
|
"song_collection": Collection,
|
||||||
@ -290,6 +301,7 @@ class Album(Base):
|
|||||||
barcode: str = None,
|
barcode: str = None,
|
||||||
albumsort: int = None,
|
albumsort: int = None,
|
||||||
notes: FormattedText = None,
|
notes: FormattedText = None,
|
||||||
|
artwork: Artwork = None,
|
||||||
source_list: List[Source] = None,
|
source_list: List[Source] = None,
|
||||||
artist_list: List[Artist] = None,
|
artist_list: List[Artist] = None,
|
||||||
song_list: List[Song] = None,
|
song_list: List[Song] = None,
|
||||||
@ -304,6 +316,13 @@ class Album(Base):
|
|||||||
DOWNWARDS_COLLECTION_STRING_ATTRIBUTES = ("song_collection",)
|
DOWNWARDS_COLLECTION_STRING_ATTRIBUTES = ("song_collection",)
|
||||||
UPWARDS_COLLECTION_STRING_ATTRIBUTES = ("label_collection", "artist_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):
|
def __init_collections__(self):
|
||||||
self.feature_artist_collection.push_to = [self.artist_collection]
|
self.feature_artist_collection.push_to = [self.artist_collection]
|
||||||
self.artist_collection.pull_from = [self.feature_artist_collection]
|
self.artist_collection.pull_from = [self.feature_artist_collection]
|
||||||
@ -322,6 +341,8 @@ class Album(Base):
|
|||||||
"label_collection": self.label_collection
|
"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]):
|
def _add_other_db_objects(self, object_type: Type[OuterProxy], object_list: List[OuterProxy]):
|
||||||
if object_type is Song:
|
if object_type is Song:
|
||||||
self.song_collection.extend(object_list)
|
self.song_collection.extend(object_list)
|
||||||
@ -477,7 +498,7 @@ class Artist(Base):
|
|||||||
general_genre: str
|
general_genre: str
|
||||||
unformatted_location: str
|
unformatted_location: str
|
||||||
|
|
||||||
artwork: List[Artwork]
|
artwork: Artwork
|
||||||
|
|
||||||
source_collection: SourceCollection
|
source_collection: SourceCollection
|
||||||
contact_collection: Collection[Contact]
|
contact_collection: Collection[Contact]
|
||||||
@ -495,7 +516,7 @@ class Artist(Base):
|
|||||||
"lyrical_themes": list,
|
"lyrical_themes": list,
|
||||||
"general_genre": lambda: "",
|
"general_genre": lambda: "",
|
||||||
|
|
||||||
"artwork": list,
|
"artwork": Artwork,
|
||||||
|
|
||||||
"source_collection": SourceCollection,
|
"source_collection": SourceCollection,
|
||||||
"album_collection": Collection,
|
"album_collection": Collection,
|
||||||
@ -515,7 +536,7 @@ class Artist(Base):
|
|||||||
notes: FormattedText = None,
|
notes: FormattedText = None,
|
||||||
lyrical_themes: List[str] = None,
|
lyrical_themes: List[str] = None,
|
||||||
general_genre: str = None,
|
general_genre: str = None,
|
||||||
artwork: List[Artwork] = None,
|
artwork: Artwork = None,
|
||||||
unformatted_location: str = None,
|
unformatted_location: str = None,
|
||||||
source_list: List[Source] = None,
|
source_list: List[Source] = None,
|
||||||
contact_list: List[Contact] = None,
|
contact_list: List[Contact] = None,
|
||||||
|
Loading…
Reference in New Issue
Block a user