From b51904d4385ac5bd855d522aad0a20034434a773 Mon Sep 17 00:00:00 2001 From: Hellow Date: Fri, 16 Dec 2022 18:26:05 +0100 Subject: [PATCH] finished???? --- src/goof.py | 38 +++++++++++++++++----- src/music_kraken/database/objects/song.py | 7 ++-- src/test.db | Bin 65536 -> 65536 bytes 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/goof.py b/src/goof.py index 93957c2..03b52f6 100644 --- a/src/goof.py +++ b/src/goof.py @@ -10,8 +10,8 @@ from music_kraken import ( import music_kraken.database.new_database as db -def div(): - print("-"*100) +def div(msg:str=""): + print("-"*50+msg+"-"*50) cache = music_kraken.database.new_database.Database("test.db") @@ -34,6 +34,10 @@ feature_artist = Artist( album_input = Album( title="One Final Action" ) +album_input.artists = [ + main_artist, + split_artist +] song_input = Song( title="Vein Deep in the Solution", @@ -56,6 +60,12 @@ song_input = Song( feature_artist_list = [feature_artist] ) +other_song = Song( + title="this is just another song", + main_artist_list=[feature_artist], + feature_artist_list=[main_artist] +) + print(song_input) additional_song = Song( @@ -68,7 +78,7 @@ print(song_ref) lyrics = Lyrics(text="these are some Lyrics that don't belong to any Song", language="en") -cache.push([album_input, song_input, lyrics, additional_song]) +cache.push([album_input, song_input, lyrics, additional_song, other_song]) # getting song by song ref div() @@ -84,12 +94,17 @@ for song in song_output_list: print(song, song.album) # getting album -div() +div("album") album_output_list = cache.pull_albums(album_ref=album_input.reference) album_output = album_output_list[0] print(album_output) +print(f"--tracklist-{len(album_output)}--") for track in album_output.tracklist: print(track.tracksort, track) +print("--artist--") +for artist in album_output.artists: + print(artist) + # getting album by song div() @@ -98,9 +113,16 @@ print(album_output_list) print("len of album ->", len(album_output_list[0]), album_output_list[0], sep=" | ") # get artist -div() +div("artist") artist_output = cache.pull_artists(artist_ref=artist_ref)[0] print(artist_output) -print(artist_output.main_albums) -print(artist_output.main_songs) -print(artist_output.feature_songs) + +print("---static---") +print("albums", artist_output.main_albums) +print("main_s", artist_output.main_songs) +print("feat_s", artist_output.feature_songs) + +print("---dynamic---") +print("discography", artist_output.discography) +print("songs", artist_output.songs, artist_output.songs.tracklist) +print("features", artist_output.features, artist_output.features.tracklist) diff --git a/src/music_kraken/database/objects/song.py b/src/music_kraken/database/objects/song.py index c424fe2..dae6071 100644 --- a/src/music_kraken/database/objects/song.py +++ b/src/music_kraken/database/objects/song.py @@ -298,6 +298,9 @@ class Album(DatabaseObject): def __str__(self) -> str: return f"Album: \"{self.title}\"" + def __repr__(self): + return self.__str__() + def __len__(self) -> int: return len(self.tracklist) @@ -335,7 +338,7 @@ class Artist(DatabaseObject): name: str = None, main_songs: List[Song] = None, feature_songs: List[Song] = None, - main_albums: List[Song] = None + main_albums: List[Album] = None ): DatabaseObject.__init__(self, id_=id_) @@ -389,7 +392,7 @@ class Artist(DatabaseObject): return song_release def get_discography(self) -> List[Album]: - flat_copy_discography = self.discography.copy() + flat_copy_discography = self.main_albums.copy() flat_copy_discography.append(self.get_features()) return flat_copy_discography diff --git a/src/test.db b/src/test.db index d1b46ae36c2401a34162fdee6d1edc2a8dc44adc..c1356e7fdbf8095d4e88ef582cafa995d538af81 100644 GIT binary patch literal 65536 zcmeI*%X8bt9S3lb)RVRa``~gsy=*22OJl7CfFK^pq=_8U9#yYeBAR+8t!4o%NZ1sp z0H7Pq^f6W%&-BtBa?7oMfoJM_&$;#L=|7QcZ|wpQB~h&$IBmyP^@S~h!ejB<&n`g$ z3oN!Dtc58j!64pcDQQYqrAkHmh!9DVvY)HsXEe-+Hxr{@#JFWnI0rSpUZ?txwGSVOE-s#cT`^fB*y_aIpoRekxBl-hH=n z@Y|HReZJgxhr7#h8Ybz9w^u*jYA<)%q_ccytxZnMsL$6)KCo=PozO3SyR&kCWuvn= znwKXxnmIo2-sV<&<^Bd)Z9kkJrLjP^+V|R9?TwGy+r`G_Lw{kE+SnSSl*d=er)KNa z7Y=UBO*h_or}D+G^XzR8qHdA9<9G5{=8mTy|k+1y##5X-N(H#+1eTPy3!TMx71EbohIcGO}#_q0>b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