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;