mirror of
https://github.com/hexated/cloudstream-extensions-hexated.git
synced 2024-08-15 00:03:22 +00:00
stremiox: fix detail page
This commit is contained in:
parent
3f97c0a253
commit
e58dbbb4f0
1 changed files with 28 additions and 8 deletions
|
@ -3,6 +3,8 @@ package com.hexated
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addActors
|
||||||
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
||||||
import com.lagradost.cloudstream3.utils.*
|
import com.lagradost.cloudstream3.utils.*
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
|
||||||
import com.lagradost.cloudstream3.utils.AppUtils.toJson
|
import com.lagradost.cloudstream3.utils.AppUtils.toJson
|
||||||
|
@ -178,15 +180,25 @@ class StremioC : MainAPI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private data class CatalogResponse(val metas: List<CatalogEntry>?, val meta: CatalogEntry?)
|
private data class CatalogResponse(val metas: List<CatalogEntry>?, val meta: CatalogEntry?)
|
||||||
|
|
||||||
|
private data class Trailer(
|
||||||
|
val source: String?,
|
||||||
|
val type: String?
|
||||||
|
)
|
||||||
private data class CatalogEntry(
|
private data class CatalogEntry(
|
||||||
val name: String,
|
@JsonProperty("name") val name: String,
|
||||||
val id: String,
|
@JsonProperty("id") val id: String,
|
||||||
val poster: String?,
|
@JsonProperty("poster") val poster: String?,
|
||||||
val background: String?,
|
@JsonProperty("background") val background: String?,
|
||||||
val description: String?,
|
@JsonProperty("description") val description: String?,
|
||||||
val imdbRating: String?,
|
@JsonProperty("imdbRating") val imdbRating: String?,
|
||||||
val type: String?,
|
@JsonProperty("type") val type: String?,
|
||||||
val videos: List<Video>?
|
@JsonProperty("videos") val videos: List<Video>?,
|
||||||
|
@JsonProperty("genre") val genre: List<String>?,
|
||||||
|
@JsonProperty("genres") val genres: List<String>?,
|
||||||
|
@JsonProperty("cast") val cast: List<String>?,
|
||||||
|
@JsonProperty("year") val yearNum: String? = null,
|
||||||
|
@JsonProperty("trailers") val trailersSources: ArrayList<Trailer>? = arrayListOf()
|
||||||
) {
|
) {
|
||||||
fun toSearchResponse(provider: StremioC): SearchResponse {
|
fun toSearchResponse(provider: StremioC): SearchResponse {
|
||||||
return provider.newMovieSearchResponse(
|
return provider.newMovieSearchResponse(
|
||||||
|
@ -210,6 +222,10 @@ class StremioC : MainAPI() {
|
||||||
backgroundPosterUrl = background
|
backgroundPosterUrl = background
|
||||||
rating = imdbRating.toRatingInt()
|
rating = imdbRating.toRatingInt()
|
||||||
plot = description
|
plot = description
|
||||||
|
year = yearNum?.toIntOrNull()
|
||||||
|
tags = genre ?: genres
|
||||||
|
addActors(cast)
|
||||||
|
addTrailer(trailersSources?.map { "https://www.youtube.com/watch?v=${it.source}" }?.randomOrNull())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return provider.newTvSeriesLoadResponse(
|
return provider.newTvSeriesLoadResponse(
|
||||||
|
@ -224,6 +240,10 @@ class StremioC : MainAPI() {
|
||||||
backgroundPosterUrl = background
|
backgroundPosterUrl = background
|
||||||
rating = imdbRating.toRatingInt()
|
rating = imdbRating.toRatingInt()
|
||||||
plot = description
|
plot = description
|
||||||
|
year = yearNum?.toIntOrNull()
|
||||||
|
tags = genre ?: genres
|
||||||
|
addActors(cast)
|
||||||
|
addTrailer(trailersSources?.map { "https://www.youtube.com/watch?v=${it.source}" }?.randomOrNull())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue