Skip to content

Commit 402f43e

Browse files
committed
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 ef4a623 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)
1 parent 77d62de commit 402f43e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

app/src/main/java/org/schabi/newpipe/database/playlist/dao/PlaylistStreamDAO.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ interface PlaylistStreamDAO : BasicDAO<PlaylistStreamEntity> {
6868
)
6969
fun getOrderedStreamsOf(playlistId: Long): Flowable<MutableList<PlaylistStreamEntry>>
7070

71+
// If a playlist has no streams, there won’t be any rows in the **playlist_stream_join** table
72+
// that have a foreign key to that playlist. Thus, the **playlist_id** will not have a
73+
// corresponding value in any rows of the join table. So, if you group by the **playlist_id**,
74+
// only playlists that contain videos are grouped and displayed. Look at #9642 #13055
75+
7176
@Transaction
7277
@Query(
7378
"""
@@ -103,6 +108,11 @@ interface PlaylistStreamDAO : BasicDAO<PlaylistStreamEntity> {
103108
)
104109
fun getStreamsWithoutDuplicates(playlistId: Long): Flowable<MutableList<PlaylistStreamEntry>>
105110

111+
// If a playlist has no streams, there won’t be any rows in the **playlist_stream_join** table
112+
// that have a foreign key to that playlist. Thus, the **playlist_id** will not have a
113+
// corresponding value in any rows of the join table. So, if you group by the **playlist_id**,
114+
// only playlists that contain videos are grouped and displayed. Look at #9642 #13055
115+
106116
@Transaction
107117
@Query(
108118
"""
@@ -118,7 +128,7 @@ interface PlaylistStreamDAO : BasicDAO<PlaylistStreamEntity> {
118128
LEFT JOIN streams
119129
ON streams.uid = stream_id AND :streamUrl = :streamUrl
120130
121-
GROUP BY playlist_id
131+
GROUP BY playlists.uid
122132
ORDER BY display_index, name
123133
"""
124134
)

0 commit comments

Comments
 (0)