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

View file

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

View file

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