From c587db730a195f6f30a8ad63410d5d9f3081266d Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Thu, 1 Dec 2022 16:43:25 +0100 Subject: [PATCH] added src --- src/music_kraken/database/database.py | 9 +++++++++ .../static_files/temp_database_structure.sql | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/music_kraken/database/database.py b/src/music_kraken/database/database.py index 928237e..095da9f 100644 --- a/src/music_kraken/database/database.py +++ b/src/music_kraken/database/database.py @@ -315,11 +315,20 @@ WHERE '{track_id}' == id; for artist in artist_list: self.write_artist(song_id=song_id, artist=artist) + def write_source(self, song_id: str, source: Source): + pass + + def write_many_sources(self, song_id: str, source_list: List[Source]): + for source in source_list: + self.write_source(song_id=song_id, source=source) + def write_song(self, song: Song): song_id = song.id # write artists self.write_many_artists(song_id=song_id, artist_list=song.artists) + # write sources + self.write_many_sources(song_id=song_id, source_list=song.sources) # write target self.write_target(song_id=song_id, target=song.target) diff --git a/src/music_kraken/static_files/temp_database_structure.sql b/src/music_kraken/static_files/temp_database_structure.sql index 31c9c73..07eb59f 100644 --- a/src/music_kraken/static_files/temp_database_structure.sql +++ b/src/music_kraken/static_files/temp_database_structure.sql @@ -81,3 +81,6 @@ CREATE TABLE source ( certainty INT NOT NULL DEFAULT 0, -- certainty=0 -> it is definitly a valid source valid BOOLEAN NOT NULL DEFAULT 1 ); + +DROP TABLE IF EXISTS easy_id3; +CREATE TABLE easy_id3 ();