correcting the song migration
This commit is contained in:
parent
c6eee24ce1
commit
febeaf37c7
1 changed files with 3 additions and 2 deletions
|
@ -249,11 +249,12 @@ class MainActivity : SimpleActivity(), SongListListener {
|
|||
dbHelper.getAllPlaylists {
|
||||
it.forEach {
|
||||
val playlist = it
|
||||
val newPlaylistId = playlistDAO.insert(it).toInt()
|
||||
val newPlaylistId = if (playlist.id == ALL_SONGS_PLAYLIST_ID) ALL_SONGS_PLAYLIST_ID else playlistDAO.insert(playlist.copy(id = 0)).toInt()
|
||||
val playlistSongPaths = songs.filter { it.playListId == newPlaylistId }.map { it.path } as ArrayList<String>
|
||||
RoomHelper(applicationContext).addSongsToPlaylist(playlistSongPaths, playlist.id)
|
||||
RoomHelper(applicationContext).addSongsToPlaylist(playlistSongPaths, newPlaylistId)
|
||||
}
|
||||
|
||||
playlistChanged(ALL_SONGS_PLAYLIST_ID)
|
||||
config.wereSongsMigrated = true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue