From 4956581cbce67f329346749d413d063880b99377 Mon Sep 17 00:00:00 2001 From: Jace <54625750+Jacekun@users.noreply.github.com> Date: Sat, 1 Oct 2022 17:31:35 +0800 Subject: [PATCH] Minor cleanups --- .../kotlin/com/lagradost/PinoyMoviePediaProvider.kt | 10 ++++------ .../kotlin/com/lagradost/PinoyMoviesEsProvider.kt | 12 +++++------- .../src/main/kotlin/com/lagradost/PinoyMoviesHub.kt | 6 ++---- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/PinoyMovies/src/main/kotlin/com/lagradost/PinoyMoviePediaProvider.kt b/PinoyMovies/src/main/kotlin/com/lagradost/PinoyMoviePediaProvider.kt index 33e0a30..8ad3e72 100644 --- a/PinoyMovies/src/main/kotlin/com/lagradost/PinoyMoviePediaProvider.kt +++ b/PinoyMovies/src/main/kotlin/com/lagradost/PinoyMoviePediaProvider.kt @@ -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") diff --git a/PinoyMovies/src/main/kotlin/com/lagradost/PinoyMoviesEsProvider.kt b/PinoyMovies/src/main/kotlin/com/lagradost/PinoyMoviesEsProvider.kt index 5b7ad69..0644d69 100644 --- a/PinoyMovies/src/main/kotlin/com/lagradost/PinoyMoviesEsProvider.kt +++ b/PinoyMovies/src/main/kotlin/com/lagradost/PinoyMoviesEsProvider.kt @@ -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, diff --git a/PinoyMoviesHub/src/main/kotlin/com/lagradost/PinoyMoviesHub.kt b/PinoyMoviesHub/src/main/kotlin/com/lagradost/PinoyMoviesHub.kt index cc12dda..c1a8e2e 100644 --- a/PinoyMoviesHub/src/main/kotlin/com/lagradost/PinoyMoviesHub.kt +++ b/PinoyMoviesHub/src/main/kotlin/com/lagradost/PinoyMoviesHub.kt @@ -25,7 +25,7 @@ class PinoyMoviesHub : MainAPI() { ): HomePageResponse { val all = ArrayList() 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")