all: reformat
This commit is contained in:
parent
3ad2fd2fc0
commit
7e45812411
3 changed files with 19 additions and 16 deletions
|
@ -340,7 +340,11 @@ internal class GenreVertex(val preGenre: PreGenre) {
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class PlaylistVertex(val prePlaylist: PrePlaylist) {
|
internal class PlaylistVertex(val prePlaylist: PrePlaylist) {
|
||||||
val songVertices = Array<SongVertex?>(prePlaylist.songPointers.size) { null}
|
val songVertices = Array<SongVertex?>(prePlaylist.songPointers.size) { null }
|
||||||
val pointerMap = prePlaylist.songPointers.withIndex().associateBy { it.value }.mapValuesTo(mutableMapOf()) { it.value.index }
|
val pointerMap =
|
||||||
|
prePlaylist.songPointers
|
||||||
|
.withIndex()
|
||||||
|
.associateBy { it.value }
|
||||||
|
.mapValuesTo(mutableMapOf()) { it.value.index }
|
||||||
val tag: Any? = null
|
val tag: Any? = null
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.oxycblt.musikr.model
|
package org.oxycblt.musikr.model
|
||||||
|
|
||||||
import org.oxycblt.musikr.Music
|
import org.oxycblt.musikr.Music
|
||||||
|
@ -23,10 +23,8 @@ import org.oxycblt.musikr.MutableLibrary
|
||||||
import org.oxycblt.musikr.Playlist
|
import org.oxycblt.musikr.Playlist
|
||||||
import org.oxycblt.musikr.Song
|
import org.oxycblt.musikr.Song
|
||||||
import org.oxycblt.musikr.fs.Path
|
import org.oxycblt.musikr.fs.Path
|
||||||
import org.oxycblt.musikr.playlist.PlaylistHandle
|
|
||||||
import org.oxycblt.musikr.playlist.db.StoredPlaylists
|
import org.oxycblt.musikr.playlist.db.StoredPlaylists
|
||||||
import org.oxycblt.musikr.playlist.interpret.PlaylistInterpreter
|
import org.oxycblt.musikr.playlist.interpret.PlaylistInterpreter
|
||||||
import org.oxycblt.musikr.playlist.interpret.PostPlaylist
|
|
||||||
import org.oxycblt.musikr.playlist.interpret.PrePlaylistInfo
|
import org.oxycblt.musikr.playlist.interpret.PrePlaylistInfo
|
||||||
|
|
||||||
internal data class LibraryImpl(
|
internal data class LibraryImpl(
|
||||||
|
@ -67,9 +65,10 @@ internal data class LibraryImpl(
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun renamePlaylist(playlist: Playlist, name: String): MutableLibrary {
|
override suspend fun renamePlaylist(playlist: Playlist, name: String): MutableLibrary {
|
||||||
val playlistImpl = requireNotNull(playlistUidMap[playlist.uid]) {
|
val playlistImpl =
|
||||||
"Playlist to rename is not in this library"
|
requireNotNull(playlistUidMap[playlist.uid]) {
|
||||||
}
|
"Playlist to rename is not in this library"
|
||||||
|
}
|
||||||
val prePlaylist = playlistImpl.core.prePlaylist
|
val prePlaylist = playlistImpl.core.prePlaylist
|
||||||
prePlaylist.handle.rename(name)
|
prePlaylist.handle.rename(name)
|
||||||
val postPlaylist = playlistInterpreter.interpret(name, prePlaylist.handle)
|
val postPlaylist = playlistInterpreter.interpret(name, prePlaylist.handle)
|
||||||
|
@ -79,9 +78,10 @@ internal data class LibraryImpl(
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun addToPlaylist(playlist: Playlist, songs: List<Song>): MutableLibrary {
|
override suspend fun addToPlaylist(playlist: Playlist, songs: List<Song>): MutableLibrary {
|
||||||
val playlistImpl = requireNotNull(playlistUidMap[playlist.uid]) {
|
val playlistImpl =
|
||||||
"Playlist to add to is not in this library"
|
requireNotNull(playlistUidMap[playlist.uid]) {
|
||||||
}
|
"Playlist to add to is not in this library"
|
||||||
|
}
|
||||||
playlistImpl.core.prePlaylist.handle.add(songs)
|
playlistImpl.core.prePlaylist.handle.add(songs)
|
||||||
val core = NewPlaylistCore(playlistImpl.core.prePlaylist, playlistImpl.songs + songs)
|
val core = NewPlaylistCore(playlistImpl.core.prePlaylist, playlistImpl.songs + songs)
|
||||||
val newPlaylist = PlaylistImpl(core)
|
val newPlaylist = PlaylistImpl(core)
|
||||||
|
@ -89,9 +89,10 @@ internal data class LibraryImpl(
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun rewritePlaylist(playlist: Playlist, songs: List<Song>): MutableLibrary {
|
override suspend fun rewritePlaylist(playlist: Playlist, songs: List<Song>): MutableLibrary {
|
||||||
val playlistImpl = requireNotNull(playlistUidMap[playlist.uid]) {
|
val playlistImpl =
|
||||||
"Playlist to rewrite is not in this library"
|
requireNotNull(playlistUidMap[playlist.uid]) {
|
||||||
}
|
"Playlist to rewrite is not in this library"
|
||||||
|
}
|
||||||
playlistImpl.core.prePlaylist.handle.rewrite(songs)
|
playlistImpl.core.prePlaylist.handle.rewrite(songs)
|
||||||
val core = NewPlaylistCore(playlistImpl.core.prePlaylist, songs)
|
val core = NewPlaylistCore(playlistImpl.core.prePlaylist, songs)
|
||||||
val newPlaylist = PlaylistImpl(core)
|
val newPlaylist = PlaylistImpl(core)
|
||||||
|
|
|
@ -21,7 +21,6 @@ package org.oxycblt.musikr.model
|
||||||
import org.oxycblt.musikr.Playlist
|
import org.oxycblt.musikr.Playlist
|
||||||
import org.oxycblt.musikr.Song
|
import org.oxycblt.musikr.Song
|
||||||
import org.oxycblt.musikr.cover.Cover
|
import org.oxycblt.musikr.cover.Cover
|
||||||
import org.oxycblt.musikr.playlist.interpret.PlaylistInterpreter
|
|
||||||
import org.oxycblt.musikr.playlist.interpret.PrePlaylistInfo
|
import org.oxycblt.musikr.playlist.interpret.PrePlaylistInfo
|
||||||
import org.oxycblt.musikr.tag.Name
|
import org.oxycblt.musikr.tag.Name
|
||||||
|
|
||||||
|
@ -46,5 +45,4 @@ internal class PlaylistImpl(val core: PlaylistCore) : Playlist {
|
||||||
override fun hashCode() = hashCode
|
override fun hashCode() = hashCode
|
||||||
|
|
||||||
override fun toString() = "Playlist(uid=$uid, name=$name)"
|
override fun toString() = "Playlist(uid=$uid, name=$name)"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue