readded HD marker

This commit is contained in:
LagradOst 2022-04-03 14:03:22 +02:00
parent becefe1edd
commit ac2760bacf
2 changed files with 29 additions and 8 deletions

View file

@ -364,19 +364,39 @@ open class SflixProvider : MainAPI() {
}
private fun Element.toSearchResult(): SearchResponse {
val img = this.select("img")
val inner = this.selectFirst("div.film-poster")
val img = inner.select("img")
val title = img.attr("title")
val posterUrl = img.attr("data-src")
val href = fixUrl(this.select("a").attr("href"))
val posterUrl = img.attr("data-src") ?: img.attr("src")
val href = fixUrl(inner.select("a").attr("href"))
val isMovie = href.contains("/movie/")
val otherInfo = this.selectFirst("div.film-detail > div.fd-infor")?.select("span")?.toList() ?: listOf()
//var rating: Int? = null
var year: Int? = null
var quality: SearchQuality? = null
when (otherInfo.size) {
1 -> {
year = otherInfo[0]?.text()?.trim()?.toIntOrNull()
}
2 -> {
year = otherInfo[0]?.text()?.trim()?.toIntOrNull()
}
3 -> {
//rating = otherInfo[0]?.text()?.toRatingInt()
quality = getQualityFromString(otherInfo[1]?.text())
year = otherInfo[2]?.text()?.trim()?.toIntOrNull()
}
}
return if (isMovie) {
MovieSearchResponse(
title,
href,
this@SflixProvider.name,
TvType.Movie,
posterUrl,
null
posterUrl = posterUrl,
year = year,
quality = quality,
)
} else {
TvSeriesSearchResponse(
@ -385,8 +405,9 @@ open class SflixProvider : MainAPI() {
this@SflixProvider.name,
TvType.Movie,
posterUrl,
null,
null
year = year,
episodes = null,
quality = quality,
)
}
}

View file

@ -64,7 +64,7 @@ object SearchResultBuilder {
SearchQuality.SDR -> R.string.quality_sdr
SearchQuality.HDR -> R.string.quality_hdr
SearchQuality.WebRip -> R.string.quality_webrip
else -> null
null -> null
}?.let { textRes ->
textQuality?.setText(textRes)
textQuality?.isVisible = true