Fix horizontal images

This commit is contained in:
Blatzar 2022-10-16 20:45:17 +02:00
parent 4ff296dea5
commit 94ac0a3b57
2 changed files with 4 additions and 2 deletions

View File

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 3 version = 4
cloudstream { cloudstream {

View File

@ -113,6 +113,7 @@ class Ask4MovieProvider : MainAPI() {
val posterRegex = Regex("""url\((.*?)\)""") val posterRegex = Regex("""url\((.*?)\)""")
val mappedRows = rows.mapNotNull { val mappedRows = rows.mapNotNull {
var isHorizontal = true
val items = it.select("div.slide-item").map { element -> val items = it.select("div.slide-item").map { element ->
val thumb = element.select("div.item-thumb") val thumb = element.select("div.item-thumb")
val poster = posterRegex.find(thumb.attr("style"))?.groupValues?.get(1) val poster = posterRegex.find(thumb.attr("style"))?.groupValues?.get(1)
@ -122,6 +123,7 @@ class Ask4MovieProvider : MainAPI() {
Regex("""\((\d{4})\)$""").find(title)?.groupValues?.getOrNull(1)?.toIntOrNull() Regex("""\((\d{4})\)$""").find(title)?.groupValues?.getOrNull(1)?.toIntOrNull()
MovieSearchResponse(title, href, this.name, TvType.Movie, poster, year) MovieSearchResponse(title, href, this.name, TvType.Movie, poster, year)
}.ifEmpty { }.ifEmpty {
isHorizontal = false
it.select("div.channel-content.clearfix").map { searchElement -> it.select("div.channel-content.clearfix").map { searchElement ->
searchElement.articleToSearchResponse() searchElement.articleToSearchResponse()
} }
@ -129,7 +131,7 @@ class Ask4MovieProvider : MainAPI() {
val title = it.select("div.title").text() val title = it.select("div.title").text()
if (title.contains("porn", true) && !settingsForProvider.enableAdult) return@mapNotNull null if (title.contains("porn", true) && !settingsForProvider.enableAdult) return@mapNotNull null
HomePageList(title, items) HomePageList(title, items, isHorizontal)
} }
return HomePageResponse(mappedRows) return HomePageResponse(mappedRows)
} }