From b46b9f51496a279951efc52ad45c0f385bf97fc7 Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Mon, 30 Jan 2023 15:57:01 +0100 Subject: [PATCH] added stuff --- src/create_custom_objects.py | 7 ++----- src/music_kraken/database/new_database.py | 7 ++++++- src/music_kraken/database/objects/__init__.py | 1 + test.db | Bin 65536 -> 65536 bytes 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/create_custom_objects.py b/src/create_custom_objects.py index 1a280d3..cdd54ca 100644 --- a/src/create_custom_objects.py +++ b/src/create_custom_objects.py @@ -30,10 +30,6 @@ cache = music_kraken.database.new_database.Database("test.db") cache.reset() def print_song(song_: Song): - - - print("tracksort", song_.tracksort, sep=": ") - # print("ID3", song_.metadata) print(str(song_.metadata)) print("----src----") print("song:") @@ -81,11 +77,12 @@ song = Song( print_song(song) -exit() + song_ref = song.reference cache.push([song]) +exit() diff --git a/src/music_kraken/database/new_database.py b/src/music_kraken/database/new_database.py index 39e0054..e7d7d7f 100644 --- a/src/music_kraken/database/new_database.py +++ b/src/music_kraken/database/new_database.py @@ -16,7 +16,8 @@ from .objects import ( Album, ID3Timestamp, SourceTypes, - SourcePages + SourcePages, + SourceAttribute ) logger = logging.getLogger("database") @@ -118,6 +119,10 @@ class Database: if type(db_object) == Album: return self.push_album(album=db_object) + if issubclass(type(db_object), SourceAttribute): + for source in db_object.source_list: + self.push_source(source=source) + logger.warning(f"type {type(db_object)} isn't yet supported by the db") def push(self, db_object_list: List[Song | Lyrics | Target | Artist | Source | Album]): diff --git a/src/music_kraken/database/objects/__init__.py b/src/music_kraken/database/objects/__init__.py index a33e3e9..23f3fa4 100644 --- a/src/music_kraken/database/objects/__init__.py +++ b/src/music_kraken/database/objects/__init__.py @@ -12,6 +12,7 @@ ID3Timestamp = metadata.ID3Timestamp SourceTypes = source.SourceTypes SourcePages = source.SourcePages +SourceAttribute = source.SourceAttribute Song = song.Song Artist = song.Artist diff --git a/test.db b/test.db index 1a13b04e75131ef99fc0f15aeebc4ec299848e05..d16bfd80a972112424eeb4a124e2a33ec40e0800 100644 GIT binary patch delta 1412 zcmb7^v2WBc7{!zHpjQz1Iv|9~5UE3vDmQlGI585cL_2`mg3u`puwchFm+M_}T<$8B zO1(p32UbR4V5=xQb0_BhFDy7$Ayq|4Awwd|vETcCexIk)#&p_vzht*Q+}^NT-(GwH zmu+xhfrIahtyf_3#<82p`l@3uB@AKe2O7aBBpQ-H#8AW`f`V!+2=O`b@l%!M?xs=$ z*L+7E<+h97c$5`+(uQsP3^E3hd9d@*dC+z@ilK_bP;xh%gvRf;erV zkf)4Yu`J65rxrLhu6_ctGM6mWv2)F=bHKa>-hz3v^4ImrfzwQG+aaUYeIQa=cVM` zUT3%4DP z>CRHQe5l;gfIqL;n<=Wij^Zp;=R@_p3RRtAXQ4Xp^j}7+Cbq$e1x^gmAK*T<=aNI)E8=enW`qeeW-L%j;%P$=1EDCkDInzJ3z_HQ)3Lb6S PjU;K-fm3JqPp#H(aYb{P delta 57 ycmZo@U}