musikr: refactor root module
This commit is contained in:
parent
3528392f95
commit
2592aca4bf
4 changed files with 40 additions and 36 deletions
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024 Auxio Project
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
38
app/src/main/java/org/oxycblt/musikr/Library.kt
Normal file
38
app/src/main/java/org/oxycblt/musikr/Library.kt
Normal 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
|
||||||
|
}
|
|
@ -40,40 +40,6 @@ import org.oxycblt.musikr.tag.Disc
|
||||||
import org.oxycblt.musikr.tag.Name
|
import org.oxycblt.musikr.tag.Name
|
||||||
import org.oxycblt.musikr.tag.ReleaseType
|
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
|
* Abstract music data. This contains universal information about all concrete music
|
||||||
* implementations, such as identification information and names.
|
* implementations, such as identification information and names.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024 Auxio Project
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
Loading…
Reference in a new issue