From e2165914193b421b41de25f52c082440fecfc317 Mon Sep 17 00:00:00 2001 From: Prathamesh More Date: Fri, 12 Nov 2021 21:14:18 +0530 Subject: [PATCH] Fixed order of songs in Playlist save --- .../main/java/code/name/monkey/retromusic/helper/M3UWriter.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/code/name/monkey/retromusic/helper/M3UWriter.kt b/app/src/main/java/code/name/monkey/retromusic/helper/M3UWriter.kt index 249cd778..293d3d38 100644 --- a/app/src/main/java/code/name/monkey/retromusic/helper/M3UWriter.kt +++ b/app/src/main/java/code/name/monkey/retromusic/helper/M3UWriter.kt @@ -53,7 +53,9 @@ object M3UWriter : M3UConstants { if (!dir.exists()) dir.mkdirs() val fileName = "${playlistWithSongs.playlistEntity.playlistName}.${M3UConstants.EXTENSION}" val file = File(dir, fileName) - val songs: List = playlistWithSongs.songs.toSongs() + val songs: List = playlistWithSongs.songs.sortedBy { + it.songPrimaryKey + }.toSongs() if (songs.isNotEmpty()) { val bufferedWriter = BufferedWriter(FileWriter(file)) bufferedWriter.write(M3UConstants.HEADER)