diff --git a/app/src/main/java/com/shabinder/spotiflyer/models/gaana/GaanaTrack.kt b/app/src/main/java/com/shabinder/spotiflyer/models/gaana/GaanaTrack.kt index fe5f98cc..f4a0b94d 100644 --- a/app/src/main/java/com/shabinder/spotiflyer/models/gaana/GaanaTrack.kt +++ b/app/src/main/java/com/shabinder/spotiflyer/models/gaana/GaanaTrack.kt @@ -23,19 +23,19 @@ import com.squareup.moshi.Json data class GaanaTrack ( val tags : List?, val seokey : String, - val albumseokey : String, + val albumseokey : String?, val track_title : String, - val album_title : String, - val language : String, + val album_title : String?, + val language : String?, val duration: Int, @Json(name = "artwork_large") val artworkLink : String, - val artist : List, - @Json(name = "gener") val genre : List, - val lyrics_url : String, - val youtube_id : String, - val total_favourite_count : Int, - val release_date : String, - val play_ct : String, + val artist : List, + @Json(name = "gener") val genre : List?, + val lyrics_url : String?, + val youtube_id : String?, + val total_favourite_count : Int?, + val release_date : String?, + val play_ct : String?, val secondary_language : String?, var downloaded: DownloadStatus? = DownloadStatus.NotDownloaded ) \ No newline at end of file diff --git a/app/src/main/java/com/shabinder/spotiflyer/ui/gaana/GaanaViewModel.kt b/app/src/main/java/com/shabinder/spotiflyer/ui/gaana/GaanaViewModel.kt index 22c463ce..a7717422 100644 --- a/app/src/main/java/com/shabinder/spotiflyer/ui/gaana/GaanaViewModel.kt +++ b/app/src/main/java/com/shabinder/spotiflyer/ui/gaana/GaanaViewModel.kt @@ -159,14 +159,14 @@ class GaanaViewModel @ViewModelInject constructor(val databaseDAO: DatabaseDAO) private fun List.toTrackDetailsList() = this.map { TrackDetails( title = it.track_title, - artists = it.artist.map { artist -> artist.name }, + artists = it.artist.map { artist -> artist?.name.toString() }, durationSec = it.duration, albumArt = File( Environment.getExternalStorageDirectory(), Provider.defaultDir +".Images/" + (it.artworkLink.substringBeforeLast('/').substringAfterLast('/')) + ".jpeg"), albumName = it.album_title, year = it.release_date, - comment = "Genres:${it.genre.map { genre -> genre.name }.reduceOrNull { acc, s -> acc + s }}", + comment = "Genres:${it.genre?.map { genre -> genre?.name }?.reduceOrNull { acc, s -> acc + s }}", trackUrl = it.lyrics_url, downloaded = it.downloaded ?: DownloadStatus.NotDownloaded, source = Source.Gaana,