From 0ccb3f244cbb28a6c8754477525ab7882682acc1 Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Wed, 16 Nov 2022 14:50:56 +0100 Subject: [PATCH] implemented the source table of the db to the database querry --- src/music_kraken/utils/database.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/music_kraken/utils/database.py b/src/music_kraken/utils/database.py index d32a416..c5d7d6f 100644 --- a/src/music_kraken/utils/database.py +++ b/src/music_kraken/utils/database.py @@ -131,7 +131,8 @@ class Database: "track.release_id == release_.id", "release_group.id == release_.release_group_id", "artist_track.artist_id == artist.id", - "artist_track.track_id == track.id" + "artist_track.track_id == track.id", + "source.track_id == track.id" ] where_args.extend(custom_where) @@ -147,6 +148,15 @@ SELECT DISTINCT ) ) ), + 'source', json_group_array( + ( + SELECT DISTINCT json_object( + 'src', source.src, + 'url', source.url, + 'valid', source.valid + ) + ) + ), 'id', track.id, 'tracknumber', track.tracknumber, 'titlesort ', track.tracknumber, @@ -174,7 +184,7 @@ SELECT DISTINCT 'src', track.src, 'lyrics', track.lyrics ) -FROM track, release_, release_group,artist, artist_track +FROM track, release_, release_group, artist, artist_track, source WHERE {where_arg} GROUP BY track.id;