From 402f43e8952703fe10cd97a0341419e91151eeb2 Mon Sep 17 00:00:00 2001 From: "Yevhen Babiichuk (DustDFG)" Date: Tue, 13 Jan 2026 16:12:02 +0200 Subject: [PATCH] Fixed a bug that prevented the display of multiple empty playlists Turned out this bug was already fixed two years ago but unfortunately it made its way back again. It was solved in #9642 but back then another method was used for querying playlists from db (for add playlist dialog) then in ef4a6238c88f26e50ba794caa071432a08da66e7 was introduced another method which had the same problem as fixed in #9642 and which eventually replaced original method in code for querying playlists from db (for add playlist dialog) --- .../database/playlist/dao/PlaylistStreamDAO.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/database/playlist/dao/PlaylistStreamDAO.kt b/app/src/main/java/org/schabi/newpipe/database/playlist/dao/PlaylistStreamDAO.kt index 8bf26d754..c6b6e37a4 100644 --- a/app/src/main/java/org/schabi/newpipe/database/playlist/dao/PlaylistStreamDAO.kt +++ b/app/src/main/java/org/schabi/newpipe/database/playlist/dao/PlaylistStreamDAO.kt @@ -68,6 +68,11 @@ interface PlaylistStreamDAO : BasicDAO { ) fun getOrderedStreamsOf(playlistId: Long): Flowable> + // If a playlist has no streams, there won’t be any rows in the **playlist_stream_join** table + // that have a foreign key to that playlist. Thus, the **playlist_id** will not have a + // corresponding value in any rows of the join table. So, if you group by the **playlist_id**, + // only playlists that contain videos are grouped and displayed. Look at #9642 #13055 + @Transaction @Query( """ @@ -103,6 +108,11 @@ interface PlaylistStreamDAO : BasicDAO { ) fun getStreamsWithoutDuplicates(playlistId: Long): Flowable> + // If a playlist has no streams, there won’t be any rows in the **playlist_stream_join** table + // that have a foreign key to that playlist. Thus, the **playlist_id** will not have a + // corresponding value in any rows of the join table. So, if you group by the **playlist_id**, + // only playlists that contain videos are grouped and displayed. Look at #9642 #13055 + @Transaction @Query( """ @@ -118,7 +128,7 @@ interface PlaylistStreamDAO : BasicDAO { LEFT JOIN streams ON streams.uid = stream_id AND :streamUrl = :streamUrl - GROUP BY playlist_id + GROUP BY playlists.uid ORDER BY display_index, name """ )