musikr: add empty library check
This commit is contained in:
@@ -149,7 +149,7 @@ private class HomeGeneratorImpl(
|
||||
}
|
||||
|
||||
override fun empty() =
|
||||
musicRepository.library == null
|
||||
musicRepository.library?.empty() ?: true
|
||||
|
||||
override fun songs() =
|
||||
musicRepository.library?.let { listSettings.songSort.songs(it.songs) } ?: emptyList()
|
||||
|
||||
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user