From 9694301ab603a2b8cb519587068e6ddc27b4b414 Mon Sep 17 00:00:00 2001 From: Rahul Gill Date: Thu, 20 Oct 2022 22:55:18 +0530 Subject: [PATCH] fix: low quality album art --- .../com.shabinder.common.providers/spotify/SpotifyProvider.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/providers/src/commonMain/kotlin/com.shabinder.common.providers/spotify/SpotifyProvider.kt b/common/providers/src/commonMain/kotlin/com.shabinder.common.providers/spotify/SpotifyProvider.kt index 1973e890..027ac8c9 100644 --- a/common/providers/src/commonMain/kotlin/com.shabinder.common.providers/spotify/SpotifyProvider.kt +++ b/common/providers/src/commonMain/kotlin/com.shabinder.common.providers/spotify/SpotifyProvider.kt @@ -202,14 +202,14 @@ class SpotifyProvider( artists = it.artists?.map { artist -> artist?.name.toString() } ?: listOf(), albumArtists = it.album?.artists?.mapNotNull { artist -> artist?.name } ?: emptyList(), durationSec = (it.duration_ms / 1000).toInt(), - albumArtPath = fileManager.getImageCachePath(it.album?.images?.firstOrNull()?.url ?: ""), + albumArtPath = fileManager.getImageCachePath(it.album?.images?.maxByOrNull { img -> img?.width ?: 0 }?.url ?: ""), albumName = it.album?.name, year = it.album?.release_date, comment = "Genres:${it.album?.genres?.joinToString()}", trackUrl = it.href, downloaded = it.updateStatusIfPresent(type, subFolder), source = Source.Spotify, - albumArtURL = it.album?.images?.firstOrNull()?.url.toString(), + albumArtURL = it.album?.images?.maxByOrNull { img -> img?.width ?: 0 }?.url.toString(), outputFilePath = fileManager.finalOutputDir( it.name.toString(), type,