Fixed order of songs in Playlist save
This commit is contained in:
parent
5d39ac18dc
commit
e216591419
1 changed files with 3 additions and 1 deletions
|
@ -53,7 +53,9 @@ object M3UWriter : M3UConstants {
|
||||||
if (!dir.exists()) dir.mkdirs()
|
if (!dir.exists()) dir.mkdirs()
|
||||||
val fileName = "${playlistWithSongs.playlistEntity.playlistName}.${M3UConstants.EXTENSION}"
|
val fileName = "${playlistWithSongs.playlistEntity.playlistName}.${M3UConstants.EXTENSION}"
|
||||||
val file = File(dir, fileName)
|
val file = File(dir, fileName)
|
||||||
val songs: List<Song> = playlistWithSongs.songs.toSongs()
|
val songs: List<Song> = playlistWithSongs.songs.sortedBy {
|
||||||
|
it.songPrimaryKey
|
||||||
|
}.toSongs()
|
||||||
if (songs.isNotEmpty()) {
|
if (songs.isNotEmpty()) {
|
||||||
val bufferedWriter = BufferedWriter(FileWriter(file))
|
val bufferedWriter = BufferedWriter(FileWriter(file))
|
||||||
bufferedWriter.write(M3UConstants.HEADER)
|
bufferedWriter.write(M3UConstants.HEADER)
|
||||||
|
|
Loading…
Reference in a new issue