mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-11-25 02:14:32 +01:00
Gaana Response Null Issue Fix
This commit is contained in:
parent
d97536ee50
commit
e62abca957
@ -23,19 +23,19 @@ import com.squareup.moshi.Json
|
|||||||
data class GaanaTrack (
|
data class GaanaTrack (
|
||||||
val tags : List<Tags?>?,
|
val tags : List<Tags?>?,
|
||||||
val seokey : String,
|
val seokey : String,
|
||||||
val albumseokey : String,
|
val albumseokey : String?,
|
||||||
val track_title : String,
|
val track_title : String,
|
||||||
val album_title : String,
|
val album_title : String?,
|
||||||
val language : String,
|
val language : String?,
|
||||||
val duration: Int,
|
val duration: Int,
|
||||||
@Json(name = "artwork_large") val artworkLink : String,
|
@Json(name = "artwork_large") val artworkLink : String,
|
||||||
val artist : List<Artist>,
|
val artist : List<Artist?>,
|
||||||
@Json(name = "gener") val genre : List<Genre>,
|
@Json(name = "gener") val genre : List<Genre?>?,
|
||||||
val lyrics_url : String,
|
val lyrics_url : String?,
|
||||||
val youtube_id : String,
|
val youtube_id : String?,
|
||||||
val total_favourite_count : Int,
|
val total_favourite_count : Int?,
|
||||||
val release_date : String,
|
val release_date : String?,
|
||||||
val play_ct : String,
|
val play_ct : String?,
|
||||||
val secondary_language : String?,
|
val secondary_language : String?,
|
||||||
var downloaded: DownloadStatus? = DownloadStatus.NotDownloaded
|
var downloaded: DownloadStatus? = DownloadStatus.NotDownloaded
|
||||||
)
|
)
|
@ -159,14 +159,14 @@ class GaanaViewModel @ViewModelInject constructor(val databaseDAO: DatabaseDAO)
|
|||||||
private fun List<GaanaTrack>.toTrackDetailsList() = this.map {
|
private fun List<GaanaTrack>.toTrackDetailsList() = this.map {
|
||||||
TrackDetails(
|
TrackDetails(
|
||||||
title = it.track_title,
|
title = it.track_title,
|
||||||
artists = it.artist.map { artist -> artist.name },
|
artists = it.artist.map { artist -> artist?.name.toString() },
|
||||||
durationSec = it.duration,
|
durationSec = it.duration,
|
||||||
albumArt = File(
|
albumArt = File(
|
||||||
Environment.getExternalStorageDirectory(),
|
Environment.getExternalStorageDirectory(),
|
||||||
Provider.defaultDir +".Images/" + (it.artworkLink.substringBeforeLast('/').substringAfterLast('/')) + ".jpeg"),
|
Provider.defaultDir +".Images/" + (it.artworkLink.substringBeforeLast('/').substringAfterLast('/')) + ".jpeg"),
|
||||||
albumName = it.album_title,
|
albumName = it.album_title,
|
||||||
year = it.release_date,
|
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,
|
trackUrl = it.lyrics_url,
|
||||||
downloaded = it.downloaded ?: DownloadStatus.NotDownloaded,
|
downloaded = it.downloaded ?: DownloadStatus.NotDownloaded,
|
||||||
source = Source.Gaana,
|
source = Source.Gaana,
|
||||||
|
Loading…
Reference in New Issue
Block a user