diff --git a/src/tr/serimanga/build.gradle b/src/tr/serimanga/build.gradle new file mode 100644 index 000000000..f10e7bd73 --- /dev/null +++ b/src/tr/serimanga/build.gradle @@ -0,0 +1,12 @@ +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' + +ext { + appName = 'Tachiyomi: SeriManga' + pkgNameSuffix = 'tr.serimanga' + extClass = '.SeriManga' + extVersionCode = 1 + libVersion = '1.2' +} + +apply from: "$rootDir/common.gradle" diff --git a/src/tr/serimanga/res/mipmap-hdpi/ic_launcher.png b/src/tr/serimanga/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..aacabce94 Binary files /dev/null and b/src/tr/serimanga/res/mipmap-hdpi/ic_launcher.png differ diff --git a/src/tr/serimanga/res/mipmap-mdpi/ic_launcher.png b/src/tr/serimanga/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..a4c90279f Binary files /dev/null and b/src/tr/serimanga/res/mipmap-mdpi/ic_launcher.png differ diff --git a/src/tr/serimanga/res/mipmap-xhdpi/ic_launcher.png b/src/tr/serimanga/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..306b873a3 Binary files /dev/null and b/src/tr/serimanga/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/src/tr/serimanga/res/mipmap-xxhdpi/ic_launcher.png b/src/tr/serimanga/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..3d7b1ce11 Binary files /dev/null and b/src/tr/serimanga/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/src/tr/serimanga/res/mipmap-xxxhdpi/ic_launcher.png b/src/tr/serimanga/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..0818d8e75 Binary files /dev/null and b/src/tr/serimanga/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/src/tr/serimanga/res/web_hi_res_512.png b/src/tr/serimanga/res/web_hi_res_512.png new file mode 100644 index 000000000..eee3bf48c Binary files /dev/null and b/src/tr/serimanga/res/web_hi_res_512.png differ diff --git a/src/tr/serimanga/src/eu/kanade/tachiyomi/extension/tr/serimanga/SeriManga.kt b/src/tr/serimanga/src/eu/kanade/tachiyomi/extension/tr/serimanga/SeriManga.kt new file mode 100644 index 000000000..aa0267058 --- /dev/null +++ b/src/tr/serimanga/src/eu/kanade/tachiyomi/extension/tr/serimanga/SeriManga.kt @@ -0,0 +1,109 @@ +package eu.kanade.tachiyomi.extension.tr.serimanga + +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.source.model.FilterList +import eu.kanade.tachiyomi.source.model.Page +import eu.kanade.tachiyomi.source.model.SChapter +import eu.kanade.tachiyomi.source.model.SManga +import eu.kanade.tachiyomi.source.online.ParsedHttpSource +import java.text.SimpleDateFormat +import java.util.Calendar +import java.util.Locale +import okhttp3.OkHttpClient +import okhttp3.Request +import org.jsoup.nodes.Document +import org.jsoup.nodes.Element + +class SeriManga : ParsedHttpSource() { + override val name = "SeriManga" + + override val baseUrl = "https://serimanga.com" + + override val lang = "tr" + + override val supportsLatest = true + + override val client = network.cloudflareClient + + override fun popularMangaSelector() = "a.manga-list-bg" + + override fun popularMangaRequest(page: Int): Request { + if (page == 1) { + return GET("$baseUrl/mangalar", headers) + } else { + return GET("$baseUrl/mangalar?page=$page", headers) + } + } + + override fun popularMangaFromElement(element: Element) = SManga.create().apply { + setUrlWithoutDomain(element.attr("href")) + title = element.select("span.mlb-name").text() + thumbnail_url = styleToUrl(element).removeSurrounding("'") + } + + private fun styleToUrl(element: Element): String { + return element.attr("style").substringAfter("(").substringBefore(")") + } + + override fun popularMangaNextPageSelector() = "[rel=next]" + + override fun latestUpdatesSelector() = "a.sli2-img" + + override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/?a=a&page=$page", headers) + + override fun latestUpdatesFromElement(element: Element) = SManga.create().apply { + setUrlWithoutDomain(element.attr("href")) + title = element.attr("title") + thumbnail_url = styleToUrl(element) + } + + override fun latestUpdatesNextPageSelector() = popularMangaNextPageSelector() + + override fun searchMangaSelector() = popularMangaSelector() + + override fun searchMangaRequest(page: Int, query: String, filters: FilterList) = GET("$baseUrl/mangalar?search=Ab&page=$page", headers) + + override fun searchMangaFromElement(element: Element) = popularMangaFromElement(element) + + override fun searchMangaNextPageSelector() = popularMangaNextPageSelector() + + override fun mangaDetailsParse(document: Document) = SManga.create().apply { + description = document.select(".demo1").text() + genre = document.select("div.spc2rcrc-links > a").joinToString { it.text() } + status = document.select("div.is-status.is-status--green").text().let { + parseStatus(it) + } + thumbnail_url = document.select("[rel=image_src]").attr("href") + } + + private fun parseStatus(status: String) = when { + status.contains("CONTINUES") -> SManga.ONGOING + status.contains("Tamamlanmış") -> SManga.COMPLETED + else -> SManga.UNKNOWN + } + + override fun chapterListSelector() = "ul.spl-list > li" + + override fun chapterFromElement(element: Element) = SChapter.create().apply { + setUrlWithoutDomain(element.select("a").attr("href")) + name = "${element.select("span").first().text()}: ${element.select("span").get(1).text()}" + date_upload = dateFormat.parse(element.select("span").get(2).ownText()).time ?: 0 + } + + companion object { + val dateFormat by lazy { + SimpleDateFormat("dd MMMM yyyy", Locale("tr")) + } + } + + override fun pageListParse(document: Document): List { + return document.select("div.reader-manga > img").mapIndexed { i, element -> + val url = if (element.hasAttr("data-src"))element.attr("data-src") else element.attr("src") + Page(i, "", url) + } + } + + override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not Used") + + override fun getFilterList() = FilterList() +}