Use cached album art when available

This commit is contained in:
Naveen 2023-08-07 06:09:19 +05:30
parent caa3e549e7
commit dbf547f549
No known key found for this signature in database
GPG key ID: 0E155DAD31671DA3

View file

@ -224,8 +224,14 @@ fun Context.getAlbumCoverArt(album: Album, callback: (coverArt: Any?) -> Unit) {
fun Context.getGenreCoverArt(genre: Genre, callback: (coverArt: Any?) -> Unit) {
ensureBackgroundThread {
val track = audioHelper.getGenreTracks(genre.id).firstOrNull()
getTrackCoverArt(track, callback)
if (genre.albumArt.isEmpty()) {
val track = audioHelper.getGenreTracks(genre.id).firstOrNull()
getTrackCoverArt(track, callback)
} else {
Handler(Looper.getMainLooper()).post {
callback(genre.albumArt)
}
}
}
}