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 1a13b04..d16bfd8 100644 Binary files a/test.db and b/test.db differ