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 { 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 title = img.attr("title")
val posterUrl = img.attr("data-src") val posterUrl = img.attr("data-src") ?: img.attr("src")
val href = fixUrl(this.select("a").attr("href")) val href = fixUrl(inner.select("a").attr("href"))
val isMovie = href.contains("/movie/") 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) { return if (isMovie) {
MovieSearchResponse( MovieSearchResponse(
title, title,
href, href,
this@SflixProvider.name, this@SflixProvider.name,
TvType.Movie, TvType.Movie,
posterUrl, posterUrl = posterUrl,
null year = year,
quality = quality,
) )
} else { } else {
TvSeriesSearchResponse( TvSeriesSearchResponse(
@ -385,8 +405,9 @@ open class SflixProvider : MainAPI() {
this@SflixProvider.name, this@SflixProvider.name,
TvType.Movie, TvType.Movie,
posterUrl, posterUrl,
null, year = year,
null episodes = null,
quality = quality,
) )
} }
} }

View file

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