Created the first draft.

This commit is contained in:
Jared Fantaye 2023-01-10 20:55:18 +01:00
parent 1bb166a9e8
commit eb3363d4dd
5 changed files with 44 additions and 0 deletions

View file

@ -83,4 +83,15 @@ public interface PlaylistStreamDAO extends BasicDAO<PlaylistStreamEntity> {
+ " GROUP BY " + JOIN_PLAYLIST_ID
+ " ORDER BY " + PLAYLIST_NAME + " COLLATE NOCASE ASC")
Flowable<List<PlaylistMetadataEntry>> getPlaylistMetadata();
@Transaction
@Query("DELETE FROM " + PLAYLIST_STREAM_JOIN_TABLE
+ " WHERE " + JOIN_PLAYLIST_ID + "=:playlistId"
+ " AND " + JOIN_STREAM_ID + " IN ("
+ " SELECT " + JOIN_STREAM_ID
+ " FROM " + PLAYLIST_STREAM_JOIN_TABLE
+ " WHERE " + JOIN_PLAYLIST_ID + "=:playlistId"
+ " GROUP BY " + JOIN_STREAM_ID
+ " HAVING COUNT(*) > 1 )" )
Flowable<List<PlaylistMetadataEntry>> removeDuplicates(long playlistId);
}