musikr: add empty library check

This commit is contained in:
Alexander Capehart
2025-01-01 16:10:34 -07:00
parent 9161b8f777
commit c3ccb8519e
3 changed files with 5 additions and 1 deletions
@@ -27,6 +27,8 @@ interface Library {
val genres: Collection<Genre>
val playlists: Collection<Playlist>
fun empty(): Boolean
fun findSong(uid: Music.UID): Song?
fun findSongByPath(path: Path): Song?
@@ -42,6 +42,8 @@ internal data class LibraryImpl(
private val genreUidMap = genres.associateBy { it.uid }
private val playlistUidMap = playlists.associateBy { it.uid }
override fun empty() = songs.isEmpty()
override fun findSong(uid: Music.UID) = songUidMap[uid]
override fun findSongByPath(path: Path) = songs.find { it.path == path }