diff --git a/src/th/onemanga/build.gradle b/src/th/onemanga/build.gradle new file mode 100644 index 000000000..077b626a6 --- /dev/null +++ b/src/th/onemanga/build.gradle @@ -0,0 +1,10 @@ +ext { + extName = 'OneManga' + extClass = '.OneManga' + themePkg = 'mangathemesia' + baseUrl = 'https://one-manga.com' + overrideVersionCode = 0 + isNsfw = true +} + +apply from: "$rootDir/common.gradle" diff --git a/src/th/onemanga/res/mipmap-hdpi/ic_launcher.png b/src/th/onemanga/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..d6158f171 Binary files /dev/null and b/src/th/onemanga/res/mipmap-hdpi/ic_launcher.png differ diff --git a/src/th/onemanga/res/mipmap-mdpi/ic_launcher.png b/src/th/onemanga/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..32bd752df Binary files /dev/null and b/src/th/onemanga/res/mipmap-mdpi/ic_launcher.png differ diff --git a/src/th/onemanga/res/mipmap-xhdpi/ic_launcher.png b/src/th/onemanga/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..ac7b42a5e Binary files /dev/null and b/src/th/onemanga/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/src/th/onemanga/res/mipmap-xxhdpi/ic_launcher.png b/src/th/onemanga/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..eca9a5026 Binary files /dev/null and b/src/th/onemanga/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/src/th/onemanga/res/mipmap-xxxhdpi/ic_launcher.png b/src/th/onemanga/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..aac1e64da Binary files /dev/null and b/src/th/onemanga/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/src/th/onemanga/src/eu/kanade/tachiyomi/extension/th/onemanga/OneManga.kt b/src/th/onemanga/src/eu/kanade/tachiyomi/extension/th/onemanga/OneManga.kt new file mode 100644 index 000000000..75a51a3fc --- /dev/null +++ b/src/th/onemanga/src/eu/kanade/tachiyomi/extension/th/onemanga/OneManga.kt @@ -0,0 +1,75 @@ +package eu.kanade.tachiyomi.extension.th.onemanga + +import eu.kanade.tachiyomi.multisrc.mangathemesia.MangaThemesia +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.source.model.Filter +import eu.kanade.tachiyomi.source.model.FilterList +import eu.kanade.tachiyomi.source.model.SManga +import okhttp3.HttpUrl.Companion.toHttpUrl +import okhttp3.Request +import org.jsoup.nodes.Document +import java.text.SimpleDateFormat +import java.util.Locale +import java.util.TimeZone + +class OneManga : MangaThemesia( + "One-Manga", + "https://one-manga.com", + "th", + dateFormat = SimpleDateFormat("MMMM d, yyyy", Locale("th")).apply { + timeZone = TimeZone.getTimeZone("Asia/Bangkok") + }, +) { + override fun mangaDetailsParse(document: Document): SManga { + return super.mangaDetailsParse(document).apply { + // Add 'color' badge as a genre + if (document.selectFirst(".thumb .colored") != null) { + genre = genre?.plus(", Color") + } + } + } + + override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { + val url = baseUrl.toHttpUrl().newBuilder() + .addPathSegment(mangaUrlDirectory.substring(1)) + .addQueryParameter("s", query) + .addQueryParameter("page", page.toString()) + + filters.forEach { filter -> + when (filter) { + is AuthorFilter -> { + url.addQueryParameter("author", filter.state) + } + is YearFilter -> { + url.addQueryParameter("yearx", filter.state) + } + is StatusFilter -> { + url.addQueryParameter("status", filter.selectedValue()) + } + is TypeFilter -> { + url.addQueryParameter("type", filter.selectedValue()) + } + is OrderByFilter -> { + url.addQueryParameter("order", filter.selectedValue()) + } + is GenreListFilter -> { + filter.state + .filter { it.state != Filter.TriState.STATE_IGNORE } + .forEach { + val value = if (it.state == Filter.TriState.STATE_EXCLUDE) "-${it.value}" else it.value + url.addQueryParameter("genre[]", value) + } + } + // if site has project page, default value "hasProjectPage" = false + is ProjectFilter -> { + if (filter.selectedValue() == "project-filter-on") { + url.setPathSegment(0, projectPageString.substring(1)) + } + } + else -> { /* Do Nothing */ } + } + } + url.addPathSegment("") + return GET(url.build(), headers) + } +}