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)