Make RS into a MultiLang ext. (#8857)

This commit is contained in:
Alessandro Jean 2021-08-27 07:27:13 -03:00 committed by GitHub
parent b676bebbbf
commit 0e72abab89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 48 deletions

View File

@ -1,31 +0,0 @@
package eu.kanade.tachiyomi.extension.en.reaperscans
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.source.model.SChapter
import org.jsoup.nodes.Element
class ReaperScans : Madara("Reaper Scans", "https://reaperscans.com", "en") {
override val versionId = 2
override fun popularMangaSelector() = "div.page-item-detail.manga"
override fun chapterFromElement(element: Element): SChapter {
val chapter = SChapter.create()
with(element) {
select(chapterUrlSelector).first()?.let { urlElement ->
chapter.url = urlElement.attr("abs:href").let {
it.substringBefore("?style=paged") + if (!it.endsWith(chapterUrlSuffix)) chapterUrlSuffix else ""
}
chapter.name = urlElement.ownText()
}
// Dates can be part of a "new" graphic or plain text
// Added "title" alternative
chapter.date_upload = select("img").firstOrNull()?.attr("alt")?.let { parseRelativeDate(it) }
?: select("span a").firstOrNull()?.attr("title")?.let { parseRelativeDate(it) }
?: parseChapterDate(select("span.chapter-release-date i").firstOrNull()?.text())
}
return chapter
}
}

View File

@ -1,26 +1,24 @@
package eu.kanade.tachiyomi.extension.pt.reaperscansbr
package eu.kanade.tachiyomi.extension.all.reaperscans
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
import eu.kanade.tachiyomi.multisrc.madara.Madara
import eu.kanade.tachiyomi.source.SourceFactory
import eu.kanade.tachiyomi.source.model.SChapter
import okhttp3.OkHttpClient
import org.jsoup.nodes.Element
import java.text.SimpleDateFormat
import java.util.Locale
import java.util.concurrent.TimeUnit
class ReaperScansBr : Madara(
"Reaper Scans (BR)",
"https://reaperscans.com.br",
"pt-BR",
SimpleDateFormat("dd/MM/yyyy", Locale("pt", "BR"))
) {
class ReaperScansFactory : SourceFactory {
override fun createSources() = listOf(
ReaperScansEn(),
ReaperScansBr()
)
}
override val client: OkHttpClient = super.client.newBuilder()
.addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS))
.build()
override val altName: String = "Nome alternativo: "
abstract class ReaperScans(
override val baseUrl: String,
override val lang: String
) : Madara("Reaper Scans", baseUrl, lang) {
override fun popularMangaSelector() = "div.page-item-detail.manga"
@ -44,3 +42,17 @@ class ReaperScansBr : Madara(
return chapter
}
}
class ReaperScansEn : ReaperScans("https://reaperscans.com", "en") {
override val versionId = 2
}
class ReaperScansBr : ReaperScans("https://reaperscans.com.br", "pt-BR") {
override val id = 7767018058145795388
override val client: OkHttpClient = super.client.newBuilder()
.addInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS))
.build()
override val altName: String = "Nome alternativo: "
}

View File

@ -16,6 +16,7 @@ class MadaraGenerator : ThemeSourceGenerator {
MultiLang("Leviatan Scans", "https://leviatanscans.com", listOf("en", "es"), className = "LeviatanScansFactory", overrideVersionCode = 7),
MultiLang("MangaForFree.net", "https://mangaforfree.net", listOf("en", "ko", "all"), isNsfw = true, className = "MangaForFreeFactory", pkgName = "mangaforfree", overrideVersionCode = 1),
MultiLang("Manhwa18.cc", "https://manhwa18.cc", listOf("en", "ko", "all"), isNsfw = true, className = "Manhwa18CcFactory", pkgName = "manhwa18cc"),
MultiLang("Reaper Scans", "https://reaperscans.com", listOf("en", "pt-BR"), className = "ReaperScansFactory", pkgName = "reaperscans", overrideVersionCode = 2),
SingleLang("1st Kiss Manga.love", "https://1stkissmanga.love", "en", className = "FirstKissMangaLove"),
SingleLang("1st Kiss", "https://1stkissmanga.com", "en", className = "FirstKissManga", pkgName = "firstkissmanga", overrideVersionCode = 5),
SingleLang("1st Kiss Manhua", "https://1stkissmanhua.com", "en", className = "FirstKissManhua", overrideVersionCode = 2),
@ -327,8 +328,6 @@ class MadaraGenerator : ThemeSourceGenerator {
SingleLang("RawDEX", "https://rawdex.net", "ko", isNsfw = true, overrideVersionCode = 1),
SingleLang("ReadAdult", "https://readadult.net", "en", isNsfw = true),
SingleLang("ReadManhua", "https://readmanhua.net", "en", overrideVersionCode = 2),
SingleLang("Reaper Scans", "https://reaperscans.com", "en", overrideVersionCode = 1),
SingleLang("Reaper Scans (BR)", "https://reaperscans.com.br", "pt-BR", className = "ReaperScansBr"),
SingleLang("Red Ribbon Scanlator", "https://redribbon.site", "pt-BR", overrideVersionCode = 1),
SingleLang("Renascence Scans (Renascans)", "https://new.renascans.com", "en", className = "RenaScans", overrideVersionCode = 1),
SingleLang("Reset Scans", "https://reset-scans.com", "en", overrideVersionCode = 3),

View File

@ -13,7 +13,7 @@ fun main(args: Array<String>) {
// cleanup from past runs
File("$userDir/.run").apply {
if(exists())
if (exists())
deleteRecursively()
mkdirs()
}