From ffcd626e5ef6d145d93baef8fccd776f0e6c5f03 Mon Sep 17 00:00:00 2001 From: Hellow Date: Fri, 13 Jan 2023 00:32:35 +0100 Subject: [PATCH] dafdsf --- src/music_kraken/database/objects/song.py | 19 +++++++++++++++---- src/test.db | Bin 69632 -> 69632 bytes 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/music_kraken/database/objects/song.py b/src/music_kraken/database/objects/song.py index b4030b5..720771f 100644 --- a/src/music_kraken/database/objects/song.py +++ b/src/music_kraken/database/objects/song.py @@ -112,6 +112,7 @@ class Song(DatabaseObject): self._isrc = None self._length = None self._sources: List[Source] = [] + self._album = None self.metadata = Metadata() @@ -124,8 +125,8 @@ class Song(DatabaseObject): self.artist_names = artist_names self.tracksort: int | None = tracksort - if sources is not None: - self.set_sources(source_list=sources) + self.sources = sources + self.album = album if target is None: target = Target() @@ -138,7 +139,7 @@ class Song(DatabaseObject): for lyrics_ in self.lyrics: lyrics_.add_song(self) - self.album: Album = album + self.album = album self.main_artist_list = main_artist_list self.feature_artist_list = feature_artist_list @@ -198,6 +199,8 @@ class Song(DatabaseObject): self.metadata[attribute_map[name].value] = [id3_value] def add_source(self, source_obj: Source): + if source_obj is None: + return source_obj.add_song(self) print(source_obj) @@ -212,6 +215,13 @@ class Song(DatabaseObject): # self.metadata[ID3_MAPPING.FILE_WEBPAGE_URL.value] = [s.url for s in self._sources] self.metadata.add_many_id3_metadata_obj(self._sources) + def set_album(self, album): + if album is None: + return + + self.metadata.add_many_id3_metadata_obj() + self._album = album + def get_metadata(self): return self.metadata.get_all_metadata() @@ -242,6 +252,7 @@ class Song(DatabaseObject): album_id: str = property(fget=get_album_id) sources: List[Source] = property(fget=lambda self: self._sources, fset=set_sources) + album = property(fget=lambda self: self._album, fset=set_album) """ @@ -249,7 +260,7 @@ All objects dependent on Album """ -class Album(DatabaseObject): +class Album(DatabaseObject, ID3Metadata): """ -------DB-FIELDS------- title TEXT, diff --git a/src/test.db b/src/test.db index 4e3ac469cf4df6079224720ba81404a15d2066ad..eb96257c37eace5acde4da55f5a8c88b3d3aeda7 100644 GIT binary patch delta 2350 zcmd5-J&Rpc6n*dAc`+kou2X0riW&520+S8r`=ii_SXd;3iriAj9E=Xw9z+=lIx`fDl|KZN1&r5K>Ch^|9c6Pl%?uBky zhQu`~&8-9P0|JW{WirkelZ(mPSglsNNest+mE z&;Ckvi4Ln&mu$FlwSc)?v049L9a*)U9{s%WZdQ>x#(L@}P99|&z|keF+DCeWsg3>G z@duqpt_9NwQ5c%zN`o7QqmD{?FS$v2o)6}Euf&~wGJSWmk(w$`lhq-bRd5~NSmeJ!>S87b3Z$}(HeF}j1hcW%winX1_~ zBId4Q`lIIc@M0EwPH+Yern#T0?!!X7hiwWzBMW{M**MI&r9J``nFM5vQiLve;R|P4%=6(q@7K6;y+1Rq_+H!lqPcOwK{1Ak zClp6@W*G=nAzQ&!#PreagTwi?Nz=Wai*(Ec4y-UzMxX{nj)2ZtZs=1>d3gWcow+&J zbUWN~R=7+ z32Acm;ltVD_n)`=n$D@Y{bsY#b?0l)P7U3kVZ_Y|!Bst2r{K;)8?VScZ!grTcbne7 hnpqc5?zVl+8&TuNjd9a;HDITiz4qLYiEqcR{0#wWT5