added stuff

This commit is contained in:
Lars Noack 2023-01-30 15:57:01 +01:00
parent 39404dbbed
commit b46b9f5149
4 changed files with 9 additions and 6 deletions

View File

@ -30,10 +30,6 @@ cache = music_kraken.database.new_database.Database("test.db")
cache.reset() cache.reset()
def print_song(song_: Song): def print_song(song_: Song):
print("tracksort", song_.tracksort, sep=": ")
# print("ID3", song_.metadata)
print(str(song_.metadata)) print(str(song_.metadata))
print("----src----") print("----src----")
print("song:") print("song:")
@ -81,11 +77,12 @@ song = Song(
print_song(song) print_song(song)
exit()
song_ref = song.reference song_ref = song.reference
cache.push([song]) cache.push([song])
exit()

View File

@ -16,7 +16,8 @@ from .objects import (
Album, Album,
ID3Timestamp, ID3Timestamp,
SourceTypes, SourceTypes,
SourcePages SourcePages,
SourceAttribute
) )
logger = logging.getLogger("database") logger = logging.getLogger("database")
@ -118,6 +119,10 @@ class Database:
if type(db_object) == Album: if type(db_object) == Album:
return self.push_album(album=db_object) 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") 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]): def push(self, db_object_list: List[Song | Lyrics | Target | Artist | Source | Album]):

View File

@ -12,6 +12,7 @@ ID3Timestamp = metadata.ID3Timestamp
SourceTypes = source.SourceTypes SourceTypes = source.SourceTypes
SourcePages = source.SourcePages SourcePages = source.SourcePages
SourceAttribute = source.SourceAttribute
Song = song.Song Song = song.Song
Artist = song.Artist Artist = song.Artist

BIN
test.db

Binary file not shown.