diff --git a/src/en/myhentaigallery/build.gradle b/src/en/myhentaigallery/build.gradle new file mode 100644 index 000000000..2d0a9dd63 --- /dev/null +++ b/src/en/myhentaigallery/build.gradle @@ -0,0 +1,12 @@ +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' + +ext { + appName = 'Tachiyomi: MyHentaiGallery' + pkgNameSuffix = 'en.myhentaigallery' + extClass = '.MyHentaiGallery' + extVersionCode = 1 + libVersion = '1.2' +} + +apply from: "$rootDir/common.gradle" diff --git a/src/en/myhentaigallery/res/mipmap-hdpi/ic_launcher.png b/src/en/myhentaigallery/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..74a06a5a3 Binary files /dev/null and b/src/en/myhentaigallery/res/mipmap-hdpi/ic_launcher.png differ diff --git a/src/en/myhentaigallery/res/mipmap-mdpi/ic_launcher.png b/src/en/myhentaigallery/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..d5c02a06c Binary files /dev/null and b/src/en/myhentaigallery/res/mipmap-mdpi/ic_launcher.png differ diff --git a/src/en/myhentaigallery/res/mipmap-xhdpi/ic_launcher.png b/src/en/myhentaigallery/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..ca6ca7700 Binary files /dev/null and b/src/en/myhentaigallery/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/src/en/myhentaigallery/res/mipmap-xxhdpi/ic_launcher.png b/src/en/myhentaigallery/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..1ad787673 Binary files /dev/null and b/src/en/myhentaigallery/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/src/en/myhentaigallery/res/mipmap-xxxhdpi/ic_launcher.png b/src/en/myhentaigallery/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..0b20d3506 Binary files /dev/null and b/src/en/myhentaigallery/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/src/en/myhentaigallery/res/web_hi_res_512.png b/src/en/myhentaigallery/res/web_hi_res_512.png new file mode 100644 index 000000000..55964b494 Binary files /dev/null and b/src/en/myhentaigallery/res/web_hi_res_512.png differ diff --git a/src/en/myhentaigallery/src/eu/kanade/tachiyomi/extension/en/myhentaigallery/MyHentaiGallery.kt b/src/en/myhentaigallery/src/eu/kanade/tachiyomi/extension/en/myhentaigallery/MyHentaiGallery.kt new file mode 100644 index 000000000..0bc59970e --- /dev/null +++ b/src/en/myhentaigallery/src/eu/kanade/tachiyomi/extension/en/myhentaigallery/MyHentaiGallery.kt @@ -0,0 +1,215 @@ +package eu.kanade.tachiyomi.extension.en.myhentaigallery + +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.source.model.* +import eu.kanade.tachiyomi.source.online.ParsedHttpSource +import okhttp3.HttpUrl +import okhttp3.OkHttpClient +import okhttp3.Request +import okhttp3.Response +import org.jsoup.nodes.Document +import org.jsoup.nodes.Element + +class MyHentaiGallery : ParsedHttpSource() { + + override val name = "MyHentaiGallery" + + override val baseUrl = "https://myhentaigallery.com" + + override val lang = "en" + + override val supportsLatest = false + + override val client: OkHttpClient = network.cloudflareClient + + // Popular + + override fun popularMangaRequest(page: Int): Request { + return GET("$baseUrl/gallery/category/2/$page", headers) + } + + override fun popularMangaSelector() = "div.comic-inner" + + override fun popularMangaFromElement(element: Element): SManga { + return SManga.create().apply { + title = element.select("h2").text() + setUrlWithoutDomain(element.select("a").attr("href")) + thumbnail_url = element.select("img").attr("abs:src") + } + } + + override fun popularMangaNextPageSelector() = "li.next" + + // Latest + + override fun latestUpdatesRequest(page: Int): Request = throw UnsupportedOperationException("Not used") + + override fun latestUpdatesParse(response: Response): MangasPage = throw UnsupportedOperationException("Not used") + + override fun latestUpdatesSelector() = throw UnsupportedOperationException("Not used") + + override fun latestUpdatesFromElement(element: Element): SManga = throw UnsupportedOperationException("Not used") + + override fun latestUpdatesNextPageSelector() = throw UnsupportedOperationException("Not used") + + // Search + + override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { + return if (query.isNotBlank()) { + GET("$baseUrl/search/$page?query=$query", headers) + } else { + val url = HttpUrl.parse("$baseUrl/gallery/category")!!.newBuilder() + + filters.forEach { filter -> + when (filter) { + is GenreFilter -> { + url.addPathSegment(filter.toUriPart()) + } + } + } + url.addPathSegment("$page") + + GET(url.toString(), headers) + } + } + + override fun searchMangaSelector() = popularMangaSelector() + + override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element) + + override fun searchMangaNextPageSelector() = popularMangaNextPageSelector() + + // Details + + override fun mangaDetailsParse(document: Document): SManga { + return document.select("div.comic-header").let { info -> + SManga.create().apply { + title = info.select("h1").text() + genre = info.select("div:containsOwn(categories) a").joinToString { it.text() } + artist = info.select("div:containsOwn(artists) a").text() + thumbnail_url = info.select("div.comic-cover img").attr("abs:src") + description = info.select("div:containsOwn(groups) a").let { groups -> + if (groups.isNotEmpty()) "Groups: ${groups.joinToString { it.text() }}\n" else "" + } + description += info.select("div:containsOwn(parodies) a").let { groups -> + if (groups.isNotEmpty()) "Parodies: ${groups.joinToString { it.text() }}" else "" + } + } + } + } + + // Chapters + + override fun chapterListParse(response: Response): List { + return listOf(SChapter.create().apply { + name = "Chapter" + url = response.request().url().toString().substringAfter(baseUrl) + }) + } + + override fun chapterListSelector() = throw UnsupportedOperationException("Not used") + + override fun chapterFromElement(element: Element): SChapter = throw UnsupportedOperationException("Not used") + + // Pages + + override fun pageListParse(document: Document): List { + return document.select("div.comic-thumb img").mapIndexed { i, img -> + Page(i, "", img.attr("abs:src").replace("/thumbnail/", "/original/")) + } + } + + override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used") + + // Filters + + override fun getFilterList() = FilterList( + Filter.Header("NOTE: Ignored if using text search!"), + Filter.Separator(), + GenreFilter() + ) + + private class GenreFilter : UriPartFilter("Category", arrayOf( + Pair("