Minor cleanups

This commit is contained in:
Jace 2022-10-01 17:31:35 +08:00
parent 6876d871e2
commit 4956581cbc
3 changed files with 11 additions and 17 deletions

View file

@ -21,18 +21,16 @@ class PinoyMoviePediaProvider : MainAPI() {
val document = app.get(mainUrl).document
val mainbody = document.getElementsByTag("body")
// All rows will be hardcoded bc of the nature of the site
val rows = listOf(
val rows = listOfNotNull(
Pair("Latest Movies", "featured-titles"),
Pair("Movies", "dt-movies"),
Pair("Digitally Restored", "genre_digitally-restored"),
Pair("Action", "genre_action"),
Pair("Romance", "genre_romance"),
Pair("Comedy", "genre_comedy"),
Pair("Family", "genre_family")
).toMutableList()
if (settingsForProvider.enableAdult) {
rows.add(Pair("Adult +18", "genre_pinay-sexy-movies"))
}
Pair("Family", "genre_family"),
if (settingsForProvider.enableAdult) Pair("Adult +18", "genre_pinay-sexy-movies") else null
)
rows.forEach { item ->
val title = item.first
val inner = mainbody?.select("div#${item.second} > article")

View file

@ -79,7 +79,7 @@ class PinoyMoviesEsProvider : MainAPI() {
)
}?.distinctBy { c -> c.url } ?: listOf()
//Add to list of homepages
if (!elements.isNullOrEmpty()) {
if (elements.isNotEmpty()) {
all.add(
HomePageList(
title, elements
@ -106,15 +106,13 @@ class PinoyMoviesEsProvider : MainAPI() {
all.addAll(homepage1)
}
//2nd rows
val listOfRows = listOf(
val listOfRows = listOfNotNull(
Pair("Action", "genre_action"),
Pair("Comedy", "genre_comedy"),
Pair("Romance", "genre_romance"),
Pair("Horror", "genre_horror")
).toMutableList()
if (settingsForProvider.enableAdult) {
listOfRows.add(Pair("Rated-R", "genre_rated-r"))
}
Pair("Horror", "genre_horror"),
if (settingsForProvider.enableAdult) Pair("Rated-R", "genre_rated-r") else null
)
val homepage2 = getRowElements(
mainbody = mainbody,
rows = listOfRows,

View file

@ -25,7 +25,7 @@ class PinoyMoviesHub : MainAPI() {
): HomePageResponse {
val all = ArrayList<HomePageList>()
val doc = app.get(mainUrl).document
val rows = mutableListOf(
val rows = listOfNotNull(
Pair("Suggestion", "div.items.featured"),
Pair("Pinoy Movies and TV", "div.items.full"),
//Pair("Pinoy Teleserye and TV Series", "tvload"),
@ -34,10 +34,8 @@ class PinoyMoviesHub : MainAPI() {
Pair("Romance", "div#genre_romance"),
Pair("Horror", "div#genre_horror"),
Pair("Drama", "div#genre_drama"),
if (settingsForProvider.enableAdult) Pair("Rated-R 18+", "genre_rated-r") else null
)
if (settingsForProvider.enableAdult) {
rows.add(Pair("Rated-R 18+", "genre_rated-r"))
}
//Log.i(TAG, "Parsing page..")
val maindoc = doc.selectFirst("div.module")
?.select("div.content.full_width_layout.full")