all: reformat

This commit is contained in:
Alexander Capehart 2024-12-17 12:18:18 -05:00
parent 3ad2fd2fc0
commit 7e45812411
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
3 changed files with 19 additions and 16 deletions

View file

@ -340,7 +340,11 @@ internal class GenreVertex(val preGenre: PreGenre) {
}
internal class PlaylistVertex(val prePlaylist: PrePlaylist) {
val songVertices = Array<SongVertex?>(prePlaylist.songPointers.size) { null}
val pointerMap = prePlaylist.songPointers.withIndex().associateBy { it.value }.mapValuesTo(mutableMapOf()) { it.value.index }
val songVertices = Array<SongVertex?>(prePlaylist.songPointers.size) { null }
val pointerMap =
prePlaylist.songPointers
.withIndex()
.associateBy { it.value }
.mapValuesTo(mutableMapOf()) { it.value.index }
val tag: Any? = null
}

View file

@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.oxycblt.musikr.model
import org.oxycblt.musikr.Music
@ -23,10 +23,8 @@ import org.oxycblt.musikr.MutableLibrary
import org.oxycblt.musikr.Playlist
import org.oxycblt.musikr.Song
import org.oxycblt.musikr.fs.Path
import org.oxycblt.musikr.playlist.PlaylistHandle
import org.oxycblt.musikr.playlist.db.StoredPlaylists
import org.oxycblt.musikr.playlist.interpret.PlaylistInterpreter
import org.oxycblt.musikr.playlist.interpret.PostPlaylist
import org.oxycblt.musikr.playlist.interpret.PrePlaylistInfo
internal data class LibraryImpl(
@ -67,9 +65,10 @@ internal data class LibraryImpl(
}
override suspend fun renamePlaylist(playlist: Playlist, name: String): MutableLibrary {
val playlistImpl = requireNotNull(playlistUidMap[playlist.uid]) {
"Playlist to rename is not in this library"
}
val playlistImpl =
requireNotNull(playlistUidMap[playlist.uid]) {
"Playlist to rename is not in this library"
}
val prePlaylist = playlistImpl.core.prePlaylist
prePlaylist.handle.rename(name)
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 {
val playlistImpl = requireNotNull(playlistUidMap[playlist.uid]) {
"Playlist to add to is not in this library"
}
val playlistImpl =
requireNotNull(playlistUidMap[playlist.uid]) {
"Playlist to add to is not in this library"
}
playlistImpl.core.prePlaylist.handle.add(songs)
val core = NewPlaylistCore(playlistImpl.core.prePlaylist, playlistImpl.songs + songs)
val newPlaylist = PlaylistImpl(core)
@ -89,9 +89,10 @@ internal data class LibraryImpl(
}
override suspend fun rewritePlaylist(playlist: Playlist, songs: List<Song>): MutableLibrary {
val playlistImpl = requireNotNull(playlistUidMap[playlist.uid]) {
"Playlist to rewrite is not in this library"
}
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)

View file

@ -21,7 +21,6 @@ package org.oxycblt.musikr.model
import org.oxycblt.musikr.Playlist
import org.oxycblt.musikr.Song
import org.oxycblt.musikr.cover.Cover
import org.oxycblt.musikr.playlist.interpret.PlaylistInterpreter
import org.oxycblt.musikr.playlist.interpret.PrePlaylistInfo
import org.oxycblt.musikr.tag.Name
@ -46,5 +45,4 @@ internal class PlaylistImpl(val core: PlaylistCore) : Playlist {
override fun hashCode() = hashCode
override fun toString() = "Playlist(uid=$uid, name=$name)"
}