From 5e5988e874b4a43cb2a77bd41f45d68a7c16d25a Mon Sep 17 00:00:00 2001 From: Mike <51273546+SnakeDoc83@users.noreply.github.com> Date: Sun, 3 Nov 2019 08:58:37 -0500 Subject: [PATCH] Madara - genre search, add 3 sources (#1735) Madara - genre search, add 3 sources --- src/all/madara/build.gradle | 2 +- .../tachiyomi/extension/all/madara/Madara.kt | 82 ++++++++++++++++++- .../extension/all/madara/MadaraFactory.kt | 20 ++++- 3 files changed, 101 insertions(+), 3 deletions(-) diff --git a/src/all/madara/build.gradle b/src/all/madara/build.gradle index f4a610553..0dbc6b4a8 100644 --- a/src/all/madara/build.gradle +++ b/src/all/madara/build.gradle @@ -5,7 +5,7 @@ ext { appName = 'Tachiyomi: Madara (multiple sources)' pkgNameSuffix = "all.madara" extClass = '.MadaraFactory' - extVersionCode = 24 + extVersionCode = 25 libVersion = '1.2' } diff --git a/src/all/madara/src/eu/kanade/tachiyomi/extension/all/madara/Madara.kt b/src/all/madara/src/eu/kanade/tachiyomi/extension/all/madara/Madara.kt index 0834f2c0b..940179566 100644 --- a/src/all/madara/src/eu/kanade/tachiyomi/extension/all/madara/Madara.kt +++ b/src/all/madara/src/eu/kanade/tachiyomi/extension/all/madara/Madara.kt @@ -167,6 +167,19 @@ abstract class Madara( url.addQueryParameter("m_orderby", filter.toUriPart()) } } + is GenreList -> { + val genreInclude = mutableListOf() + filter.state.forEach { + if (it.state) { + genreInclude.add(it.id) + } + } + if(genreInclude.isNotEmpty()){ + genreInclude.forEach{ genre -> + url.addQueryParameter("genre[]", genre) + } + } + } } } return GET(url.build().toString(), headers) @@ -185,13 +198,80 @@ abstract class Madara( Pair("Most Views", "views"), Pair("New", "new-manga") )) + private class GenreList(genres: List) : Filter.Group("Genres", genres) + class Genre(name: String, val id: String = name) : Filter.CheckBox(name) + + open fun getGenreList() = listOf( + Genre("Adventure", "Adventure"), + Genre( "Action", "action"), + Genre( "Adventure", "adventure"), + Genre( "Cars", "cars"), + Genre( "4-Koma", "4-koma"), + Genre( "Comedy", "comedy"), + Genre( "Completed", "completed"), + Genre( "Cooking", "cooking"), + Genre( "Dementia", "dementia"), + Genre( "Demons", "demons"), + Genre( "Doujinshi", "doujinshi"), + Genre( "Drama", "drama"), + Genre( "Ecchi", "ecchi"), + Genre( "Fantasy", "fantasy"), + Genre( "Game", "game"), + Genre( "Gender Bender", "gender-bender"), + Genre( "Harem", "harem"), + Genre( "Historical", "historical"), + Genre( "Horror", "horror"), + Genre( "Isekai", "isekai"), + Genre( "Josei", "josei"), + Genre( "Kids", "kids"), + Genre( "Magic", "magic"), + Genre( "Manga", "manga"), + Genre( "Manhua", "manhua"), + Genre( "Manhwa", "manhwa"), + Genre( "Martial Arts", "martial-arts"), + Genre( "Mature", "mature"), + Genre( "Mecha", "mecha"), + Genre( "Military", "military"), + Genre( "Music", "music"), + Genre( "Mystery", "mystery"), + Genre( "Old Comic", "old-comic"), + Genre( "One Shot", "one-shot"), + Genre( "Oneshot", "oneshot"), + Genre( "Parodi", "parodi"), + Genre( "Parody", "parody"), + Genre( "Police", "police"), + Genre( "Psychological", "psychological"), + Genre( "Romance", "romance"), + Genre( "Samurai", "samurai"), + Genre( "School", "school"), + Genre( "School Life", "school-life"), + Genre( "Sci-Fi", "sci-fi"), + Genre( "Seinen", "seinen"), + Genre( "Shoujo", "shoujo"), + Genre( "Shoujo Ai", "shoujo-ai"), + Genre( "Shounen", "shounen"), + Genre( "Shounen ai", "shounen-ai"), + Genre( "Slice of Life", "slice-of-life"), + Genre( "Sports", "sports"), + Genre( "Super Power", "super-power"), + Genre( "Supernatural", "supernatural"), + Genre( "Thriller", "thriller"), + Genre( "Tragedy", "tragedy"), + Genre( "Vampire", "vampire"), + Genre( "Webtoons", "webtoons"), + Genre( "Yaoi", "yaoi"), + Genre( "Yuri", "yuri") + ) override fun getFilterList() = FilterList( AuthorFilter(), ArtistFilter(), YearFilter(), StatusFilter(getStatusList()), - OrderByFilter() + OrderByFilter(), + Filter.Separator(), + Filter.Header("Genres may not work for all sources"), + GenreList(getGenreList()) ) private fun getStatusList() = listOf( diff --git a/src/all/madara/src/eu/kanade/tachiyomi/extension/all/madara/MadaraFactory.kt b/src/all/madara/src/eu/kanade/tachiyomi/extension/all/madara/MadaraFactory.kt index 2e9fd02a4..4419f25a3 100644 --- a/src/all/madara/src/eu/kanade/tachiyomi/extension/all/madara/MadaraFactory.kt +++ b/src/all/madara/src/eu/kanade/tachiyomi/extension/all/madara/MadaraFactory.kt @@ -49,7 +49,10 @@ class MadaraFactory : SourceFactory { Manga3asq(), NManhwa(), Indiancomicsonline(), - AdonisFansub() + AdonisFansub(), + GetManhwa(), + AllPornComic(), + Milftoon() ) } @@ -216,3 +219,18 @@ class AdonisFansub : Madara("Adonis Fansub", "https://manga.adonisfansub.com", " override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/manga/page/$page/?m_orderby=views", headers) override fun latestUpdatesRequest(page: Int): Request = GET("$baseUrl/manga/page/$page/?m_orderby=latest", headers) } +class GetManhwa : Madara("GetManhwa", "https://getmanhwa.co", "en") { + override fun searchMangaNextPageSelector() = "nav.navigation-ajax" +} +class AllPornComic : Madara("AllPornComic", "https://allporncomic.com", "en") { + override fun searchMangaNextPageSelector() = "a[rel=next]" + override fun getGenreList() = listOf( + Genre("3D", "3d"), + Genre("Hentai", "hentai"), + Genre("Western", "western") + ) +} +class Milftoon : Madara("Milftoon", "https://milftoon.xxx", "en") { + override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/page/$page/?m_orderby=views", headers) + override fun latestUpdatesRequest(page: Int): Request = GET("$baseUrl/page/$page/?m_orderby=latest", headers) +}