musikr: re-add playlist rewriting
This commit is contained in:
parent
744097694f
commit
b3a598c558
1 changed files with 7 additions and 1 deletions
|
@ -89,7 +89,13 @@ internal data class LibraryImpl(
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun rewritePlaylist(playlist: Playlist, songs: List<Song>): MutableLibrary {
|
override suspend fun rewritePlaylist(playlist: Playlist, songs: List<Song>): MutableLibrary {
|
||||||
return this
|
val playlistImpl = requireNotNull(playlistUidMap[playlist.uid]) {
|
||||||
|
"Playlist to rewrite is not in this library"
|
||||||
|
}
|
||||||
|
playlistImpl.core.prePlaylist.handle.rewrite(songs)
|
||||||
|
val core = NewPlaylistCore(playlistImpl.core.prePlaylist, songs)
|
||||||
|
val newPlaylist = PlaylistImpl(core)
|
||||||
|
return copy(playlists = playlists - playlistImpl + newPlaylist)
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun deletePlaylist(playlist: Playlist): MutableLibrary {
|
override suspend fun deletePlaylist(playlist: Playlist): MutableLibrary {
|
||||||
|
|
Loading…
Reference in a new issue