From 2d22a17f7e2c6e1ce34777481bcc1ab591b774b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Techeira=20Dami=C3=A1n?= Date: Mon, 10 Oct 2022 23:50:11 -0300 Subject: [PATCH] Add new madara source (#13808) * Add new madara source * Update Co-authored-by: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com> Co-authored-by: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com> --- .../src/ChunchunmaruTranslations.kt | 34 +++++++++++++++++++ .../multisrc/madara/MadaraGenerator.kt | 1 + 2 files changed, 35 insertions(+) create mode 100644 multisrc/overrides/madara/chunchunmarutranslations/src/ChunchunmaruTranslations.kt diff --git a/multisrc/overrides/madara/chunchunmarutranslations/src/ChunchunmaruTranslations.kt b/multisrc/overrides/madara/chunchunmarutranslations/src/ChunchunmaruTranslations.kt new file mode 100644 index 000000000..3b38fcc1c --- /dev/null +++ b/multisrc/overrides/madara/chunchunmarutranslations/src/ChunchunmaruTranslations.kt @@ -0,0 +1,34 @@ +package eu.kanade.tachiyomi.extension.es.chunchunmarutranslations + +import eu.kanade.tachiyomi.multisrc.madara.Madara +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.source.model.SChapter +import okhttp3.Request +import okhttp3.Response +import org.jsoup.nodes.Element +import java.text.SimpleDateFormat +import java.util.Locale + +class ChunchunmaruTranslations : Madara( + "Chunchunmaru Translations", + "https://chunchunmarutl.com", + "es", + SimpleDateFormat("dd 'de' MMMMM 'de' yyyy", Locale("es")) +) { + + 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) + + override fun chapterFromElement(element: Element): SChapter { + return super.chapterFromElement(element).apply { + chapter_number = name.split(" ").getOrNull(1)?.toFloatOrNull() ?: -1f + } + } + + override fun chapterListParse(response: Response): List { + // Sorting list because they are in packs + return super.chapterListParse(response).sortedBy { + it.chapter_number + } + } +} diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt index c4e615479..7d3baef5b 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt @@ -501,6 +501,7 @@ class MadaraGenerator : ThemeSourceGenerator { SingleLang("مانجا عرب تيم Manga Arab Team", "https://mangaarbteam.com", "ar", className = "MangaArabTeam", overrideVersionCode = 1), SingleLang("مانجا ليك", "https://mangalek.com", "ar", className = "Mangalek", overrideVersionCode = 1), SingleLang("مانجا لينك", "https://mangalink.io", "ar", className = "MangaLinkio", overrideVersionCode = 2), + SingleLang("Chunchunmaru Translations", "https://chunchunmarutl.com", "es", className = "ChunchunmaruTranslations"), ) companion object {