mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Remove manual isTvSeries check
This commit is contained in:
parent
97dedd6859
commit
dc010bf034
1 changed files with 9 additions and 9 deletions
|
@ -152,7 +152,7 @@ open class TmdbProvider : MainAPI() {
|
||||||
?: this@toLoadResponse.similar)?.results?.map { it.toSearchResponse() }
|
?: this@toLoadResponse.similar)?.results?.map { it.toSearchResponse() }
|
||||||
addActors(credits?.cast?.toList().toActors())
|
addActors(credits?.cast?.toList().toActors())
|
||||||
|
|
||||||
contentRating = fetchContentRating(id, "US", true)
|
contentRating = fetchContentRating(id, "US")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ open class TmdbProvider : MainAPI() {
|
||||||
?: this@toLoadResponse.similar)?.results?.map { it.toSearchResponse() }
|
?: this@toLoadResponse.similar)?.results?.map { it.toSearchResponse() }
|
||||||
addActors(credits?.cast?.toList().toActors())
|
addActors(credits?.cast?.toList().toActors())
|
||||||
|
|
||||||
contentRating = fetchContentRating(id, "US", false)
|
contentRating = fetchContentRating(id, "US")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,14 +268,14 @@ open class TmdbProvider : MainAPI() {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
open suspend fun fetchContentRating(id: Int?, country: String, isTvSeries: Boolean): String? {
|
open suspend fun fetchContentRating(id: Int?, country: String): String? {
|
||||||
id ?: return null
|
id ?: return null
|
||||||
return if (isTvSeries) {
|
|
||||||
val contentRatings = tmdb.tvService().content_ratings(id).awaitResponse().body()
|
val contentRatings = tmdb.tvService().content_ratings(id).awaitResponse().body()?.results
|
||||||
contentRatings?.results
|
return if (!contentRatings.isNullOrEmpty()) {
|
||||||
?.find { it: ContentRating ->
|
contentRatings.firstOrNull { it: ContentRating ->
|
||||||
it.iso_3166_1 == country
|
it.iso_3166_1 == country
|
||||||
}?.rating
|
}?.rating
|
||||||
} else {
|
} else {
|
||||||
val releaseDates = tmdb.moviesService().releaseDates(id).awaitResponse().body()?.results
|
val releaseDates = tmdb.moviesService().releaseDates(id).awaitResponse().body()?.results
|
||||||
val certification = releaseDates?.firstOrNull { it: ReleaseDatesResult ->
|
val certification = releaseDates?.firstOrNull { it: ReleaseDatesResult ->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue