removed non movies from MultiMovie

This commit is contained in:
LagradOst 2022-03-06 17:02:54 +01:00
parent b4ed8ce752
commit 705901f50d
2 changed files with 7 additions and 2 deletions

View file

@ -596,7 +596,7 @@ interface LoadResponse {
val tags: List<String>? val tags: List<String>?
var duration: Int? // in minutes var duration: Int? // in minutes
val trailerUrl: String? val trailerUrl: String?
val recommendations: List<SearchResponse>? var recommendations: List<SearchResponse>?
var actors: List<ActorData>? var actors: List<ActorData>?
companion object { companion object {

View file

@ -15,6 +15,7 @@ class CrossTmdbProvider : TmdbProvider() {
override val lang = "en" override val lang = "en"
override val useMetaLoadResponse = true override val useMetaLoadResponse = true
override val usesWebView = true override val usesWebView = true
override val supportedTypes = setOf(TvType.Movie)
private fun filterName(name: String): String { private fun filterName(name: String): String {
return Regex("""[^a-zA-Z0-9-]""").replace(name, "") return Regex("""[^a-zA-Z0-9-]""").replace(name, "")
@ -54,11 +55,12 @@ class CrossTmdbProvider : TmdbProvider() {
} }
override suspend fun search(query: String): List<SearchResponse>? { override suspend fun search(query: String): List<SearchResponse>? {
return super.search(query)?.filterIsInstance<MovieSearchResponse>() return super.search(query)?.filterIsInstance<MovieSearchResponse>() // TODO REMOVE
} }
override suspend fun load(url: String): LoadResponse? { override suspend fun load(url: String): LoadResponse? {
val base = super.load(url)?.apply { val base = super.load(url)?.apply {
this.recommendations = this.recommendations?.filterIsInstance<MovieSearchResponse>() // TODO REMOVE
val matchName = filterName(this.name) val matchName = filterName(this.name)
when (this) { when (this) {
is MovieLoadResponse -> { is MovieLoadResponse -> {
@ -96,6 +98,9 @@ class CrossTmdbProvider : TmdbProvider() {
this.dataUrl = this.dataUrl =
CrossMetaData(true, data.map { it.apiName to it.dataUrl }).toJson() CrossMetaData(true, data.map { it.apiName to it.dataUrl }).toJson()
} }
else -> {
throw ErrorLoadingException("Nothing besides movies are implemented for this provider")
}
} }
} }