musikr: refactor root module

This commit is contained in:
Alexander Capehart 2024-12-09 09:55:44 -07:00
parent 3528392f95
commit 2592aca4bf
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
4 changed files with 40 additions and 36 deletions

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2024 Auxio Project
* StackModule.kt is part of Auxio.
* MusikrModule.kt is part of Auxio.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -0,0 +1,38 @@
package org.oxycblt.musikr
import org.oxycblt.musikr.fs.Path
interface Library {
val songs: Collection<Song>
val albums: Collection<Album>
val artists: Collection<Artist>
val genres: Collection<Genre>
val playlists: Collection<Playlist>
fun findSong(uid: Music.UID): Song?
fun findSongByPath(path: Path): Song?
fun findAlbum(uid: Music.UID): Album?
fun findArtist(uid: Music.UID): Artist?
fun findGenre(uid: Music.UID): Genre?
fun findPlaylist(uid: Music.UID): Playlist?
fun findPlaylistByName(name: String): Playlist?
}
interface MutableLibrary : Library {
suspend fun createPlaylist(name: String, songs: List<Song>): MutableLibrary
suspend fun renamePlaylist(playlist: Playlist, name: String): MutableLibrary
suspend fun addToPlaylist(playlist: Playlist, songs: List<Song>): MutableLibrary
suspend fun rewritePlaylist(playlist: Playlist, songs: List<Song>): MutableLibrary
suspend fun deletePlaylist(playlist: Playlist): MutableLibrary
}

View file

@ -40,40 +40,6 @@ import org.oxycblt.musikr.tag.Disc
import org.oxycblt.musikr.tag.Name
import org.oxycblt.musikr.tag.ReleaseType
interface Library {
val songs: Collection<Song>
val albums: Collection<Album>
val artists: Collection<Artist>
val genres: Collection<Genre>
val playlists: Collection<Playlist>
fun findSong(uid: Music.UID): Song?
fun findSongByPath(path: Path): Song?
fun findAlbum(uid: Music.UID): Album?
fun findArtist(uid: Music.UID): Artist?
fun findGenre(uid: Music.UID): Genre?
fun findPlaylist(uid: Music.UID): Playlist?
fun findPlaylistByName(name: String): Playlist?
}
interface MutableLibrary : Library {
suspend fun createPlaylist(name: String, songs: List<Song>): MutableLibrary
suspend fun renamePlaylist(playlist: Playlist, name: String): MutableLibrary
suspend fun addToPlaylist(playlist: Playlist, songs: List<Song>): MutableLibrary
suspend fun rewritePlaylist(playlist: Playlist, songs: List<Song>): MutableLibrary
suspend fun deletePlaylist(playlist: Playlist): MutableLibrary
}
/**
* Abstract music data. This contains universal information about all concrete music
* implementations, such as identification information and names.

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2024 Auxio Project
* StackModule.kt is part of Auxio.
* MusikrModule.kt is part of Auxio.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by