diff --git a/multisrc/overrides/madara/ladyestelarscan/src/LadyEstelarScan.kt b/multisrc/overrides/madara/ladyestelarscan/src/LadyEstelarScan.kt new file mode 100644 index 000000000..af4b8153d --- /dev/null +++ b/multisrc/overrides/madara/ladyestelarscan/src/LadyEstelarScan.kt @@ -0,0 +1,63 @@ +package eu.kanade.tachiyomi.extension.pt.ladyestelarscan + +import eu.kanade.tachiyomi.multisrc.madara.Madara +import eu.kanade.tachiyomi.network.asObservable +import eu.kanade.tachiyomi.network.interceptor.rateLimit +import eu.kanade.tachiyomi.source.model.FilterList +import eu.kanade.tachiyomi.source.model.MangasPage +import okhttp3.Call +import okhttp3.OkHttpClient +import okhttp3.Response +import rx.Observable +import java.lang.IllegalStateException +import java.text.SimpleDateFormat +import java.util.Locale +import java.util.concurrent.TimeUnit + +class LadyEstelarScan : Madara( + "Lady Estelar Scan", + "https://ladyestelarscan.com.br", + "pt-BR", + SimpleDateFormat("dd/MM/yyyy", Locale("pt", "BR")), +) { + + override val client: OkHttpClient = super.client.newBuilder() + .rateLimit(1, 2, TimeUnit.SECONDS) + .build() + + override val useNewChapterEndpoint = true + + override fun fetchPopularManga(page: Int): Observable { + return client.newCall(popularMangaRequest(page)) + .asObservableSuccessIgnoreCode(404) + .map(::popularMangaParse) + } + + override fun fetchLatestUpdates(page: Int): Observable { + return client.newCall(latestUpdatesRequest(page)) + .asObservableSuccessIgnoreCode(404) + .map(::latestUpdatesParse) + } + + override fun fetchSearchManga( + page: Int, + query: String, + filters: FilterList, + ): Observable { + return client.newCall(searchMangaRequest(page, query, filters)) + .asObservableSuccessIgnoreCode(404) + .map(::searchMangaParse) + } + + /** + * Their site have some issues and is returning 404 in some pages even if they exist. + */ + private fun Call.asObservableSuccessIgnoreCode(code: Int): Observable { + return asObservable().doOnNext { response -> + if (!response.isSuccessful && response.code != code) { + response.close() + throw IllegalStateException("HTTP error ${response.code}") + } + } + } +} diff --git a/multisrc/overrides/madara/passamaoscan/src/PassaMaoScan.kt b/multisrc/overrides/madara/passamaoscan/src/PassaMaoScan.kt new file mode 100644 index 000000000..7eb437fb9 --- /dev/null +++ b/multisrc/overrides/madara/passamaoscan/src/PassaMaoScan.kt @@ -0,0 +1,22 @@ +package eu.kanade.tachiyomi.extension.pt.passamaoscan + +import eu.kanade.tachiyomi.multisrc.madara.Madara +import eu.kanade.tachiyomi.network.interceptor.rateLimit +import okhttp3.OkHttpClient +import java.text.SimpleDateFormat +import java.util.Locale +import java.util.concurrent.TimeUnit + +class PassaMaoScan : Madara( + "Passa Mão Scan", + "https://passamaoscan.com", + "pt-BR", + SimpleDateFormat("dd/MM/yyyy", Locale("pt", "BR")), +) { + + override val client: OkHttpClient = super.client.newBuilder() + .rateLimit(1, 2, TimeUnit.SECONDS) + .build() + + override val useNewChapterEndpoint = true +} 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 4b20e2ea0..fe6f51455 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 @@ -183,6 +183,7 @@ class MadaraGenerator : ThemeSourceGenerator { SingleLang("KomikRame", "https://komikra.me", "id"), SingleLang("KSGroupScans", "https://ksgroupscans.com", "en"), SingleLang("Kun Manga", "https://kunmanga.com", "en", overrideVersionCode = 1), + SingleLang("Lady Estelar Scan", "https://ladyestelarscan.com.br", "pt-BR"), SingleLang("Lady Manga", "https://ladymanga.com", "en"), SingleLang("Lala Manga", "https://lalamanga.com", "en", isNsfw = true), SingleLang("Lara Manga", "https://laramanga.love", "en", overrideVersionCode = 1), @@ -387,6 +388,7 @@ class MadaraGenerator : ThemeSourceGenerator { SingleLang("Painful Nightz Scan", "https://painfulnightz.com", "en", overrideVersionCode = 1), SingleLang("Pantheon Scan", "https://pantheon-scan.com", "fr", overrideVersionCode = 1), SingleLang("Paragon Scans", "https://paragonscans.com", "en", isNsfw = true), + SingleLang("Passa Mão Scan", "https://passamaoscan.com", "pt-BR", isNsfw = true, className = "PassaMaoScan"), SingleLang("Paw Manga", "https://pawmanga.com", "en", isNsfw = true), SingleLang("Petrotechsociety", "https://www.petrotechsociety.org", "en", isNsfw = true), SingleLang("Pian Manga", "https://pianmanga.me", "en", isNsfw = true, overrideVersionCode = 1),