Change SS from WpMangaStream to WpMangaReader. (#8412)

This commit is contained in:
Alessandro Jean 2021-08-06 07:10:32 -03:00 committed by GitHub
parent 20a5797f84
commit 83003a1f04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 40 additions and 122 deletions

View File

@ -0,0 +1,4 @@
dependencies {
implementation project(':lib-ratelimit')
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

View File

@ -0,0 +1,35 @@
package eu.kanade.tachiyomi.extension.pt.silencescan
import eu.kanade.tachiyomi.annotations.Nsfw
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
import eu.kanade.tachiyomi.multisrc.wpmangareader.WPMangaReader
import eu.kanade.tachiyomi.source.model.SManga
import okhttp3.OkHttpClient
import java.text.SimpleDateFormat
import java.util.Locale
import java.util.concurrent.TimeUnit
@Nsfw
class SilenceScan : WPMangaReader(
"Silence Scan",
"https://silencescan.com.br",
"pt-BR",
dateFormat = SimpleDateFormat("MMMMM dd, yyyy", Locale("pt", "BR"))
) {
override val versionId: Int = 2
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
.connectTimeout(10, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.addNetworkInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS))
.build()
override val altName = "Nome alternativo: "
override fun parseStatus(status: String) = when {
status.contains("Em Andamento") -> SManga.ONGOING
status.contains("Completo") -> SManga.COMPLETED
else -> SManga.UNKNOWN
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

View File

@ -1,121 +0,0 @@
package eu.kanade.tachiyomi.extension.pt.silencescan
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
import eu.kanade.tachiyomi.multisrc.wpmangastream.WPMangaStream
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import kotlinx.serialization.json.Json
import okhttp3.OkHttpClient
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import uy.kohesive.injekt.injectLazy
import java.text.SimpleDateFormat
import java.util.Locale
import java.util.concurrent.TimeUnit
class SilenceScan : WPMangaStream(
"Silence Scan",
"https://silencescan.net",
"pt-BR",
SimpleDateFormat("MMMM dd, yyyy", Locale("pt", "BR"))
) {
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
.connectTimeout(10, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.addNetworkInterceptor(RateLimitInterceptor(1, 2, TimeUnit.SECONDS))
.build()
private val json: Json by injectLazy()
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
val infoEl = document.select("div.bigcontent, div.animefull, div.main-info").first()
author = infoEl.select("div.imptdt:contains(Autor) i").text()
artist = infoEl.select("div.imptdt:contains(Artista) + i").text()
status = parseStatus(infoEl.select("div.imptdt:contains(Status) i").text())
description = infoEl.select("h2:contains(Sinopse) + div p:not([class])").joinToString("\n") { it.text() }
thumbnail_url = infoEl.select("div.thumb img").imgAttr()
val genres = infoEl.select("span.mgen a[rel]")
.map { element -> element.text() }
.toMutableSet()
// add series type(manga/manhwa/manhua/other) thinggy to genre
document.select(seriesTypeSelector).firstOrNull()?.ownText()?.let {
if (it.isEmpty().not() && genres.contains(it).not()) {
genres.add(it)
}
}
genre = genres.toList().joinToString()
// add alternative name to manga description
document.select(altNameSelector).firstOrNull()?.ownText()?.let {
if (it.isEmpty().not() && it != "N/A" && it != "-") {
description += when {
description!!.isEmpty() -> altName + it
else -> "\n\n$altName" + it
}
}
}
}
override val seriesTypeSelector = ".imptdt:contains(Tipo) a, a[href*=type\\=]"
override val altName: String = "Nome alternativo: "
override fun parseStatus(element: String?): Int = when {
element == null -> SManga.UNKNOWN
element.contains("em andamento", true) -> SManga.ONGOING
element.contains("completo", true) -> SManga.COMPLETED
else -> SManga.UNKNOWN
}
override fun chapterFromElement(element: Element): SChapter = SChapter.create().apply {
name = element.select("span.chapternum").text()
scanlator = this@SilenceScan.name
date_upload = element.select("span.chapterdate").firstOrNull()?.text()
?.let { parseChapterDate(it) } ?: 0
setUrlWithoutDomain(element.select("div.eph-num > a").attr("href"))
}
override fun getGenreList(): List<Genre> = listOf(
Genre("4-koma", "4-koma"),
Genre("Ação", "acao"),
Genre("Adulto", "adulto"),
Genre("Artes marciais", "artes-marciais"),
Genre("Comédia", "comedia"),
Genre("Comedy", "comedy"),
Genre("Culinária", "culinaria"),
Genre("Drama", "drama"),
Genre("Ecchi", "ecchi"),
Genre("Esporte", "esporte"),
Genre("Fantasia", "fantasia"),
Genre("Gore", "gore"),
Genre("Harém", "harem"),
Genre("Horror", "horror"),
Genre("Isekai", "isekai"),
Genre("Militar", "militar"),
Genre("Mistério", "misterio"),
Genre("Oneshot", "oneshot"),
Genre("Parcialmente Dropado", "parcialmente-dropado"),
Genre("Psicológico", "psicologico"),
Genre("Romance", "romance"),
Genre("School Life", "school-life"),
Genre("Sci-fi", "sci-fi"),
Genre("Seinen", "seinen"),
Genre("Shoujo Ai", "shoujo-ai"),
Genre("Shounen", "shounen"),
Genre("Slice of life", "slice-of-life"),
Genre("Sobrenatural", "sobrenatural"),
Genre("Supernatural", "supernatural"),
Genre("Tragédia", "tragedia"),
Genre("Vida Escolar", "vida-escolar"),
Genre("Violência sexual", "violencia-sexual"),
Genre("Yuri", "yuri")
)
companion object {
private val PORTUGUESE_LOCALE = Locale("pt", "BR")
}
}

View File

@ -34,6 +34,7 @@ class WPMangaReaderGenerator : ThemeSourceGenerator {
SingleLang("Patatescans", "https://patatescans.com", "fr", isNsfw = true, overrideVersionCode = 1),
SingleLang("Fusion Scanlation", "https://fusionscanlation.com", "es", className = "FusionScanlation", overrideVersionCode = 1),
SingleLang("Ace Scans", "https://acescans.xyz", "en", isNsfw = true, overrideVersionCode = 1),
SingleLang("Silence Scan", "https://silencescan.com.br", "pt-BR", isNsfw = true, overrideVersionCode = 5),
)
companion object {

View File

@ -36,7 +36,6 @@ class WPMangaStreamGenerator : ThemeSourceGenerator {
SingleLang("Manga Raw.org", "https://mangaraw.org", "ja", className = "MangaRawOrg", overrideVersionCode = 1),
SingleLang("Manga Pro Z", "https://mangaproz.com", "ar"),
SingleLang("Mihentai", "https://mihentai.com", "en", isNsfw = true),
SingleLang("Silence Scan", "https://silencescan.net", "pt-BR", overrideVersionCode = 3),
SingleLang("Kuma Scans (Kuma Translation)", "https://kumascans.com", "en", className = "KumaScans", overrideVersionCode = 1),
SingleLang("Tempest Manga", "https://manga.tempestfansub.com", "tr"),
SingleLang("xCaliBR Scans", "https://xcalibrscans.com", "en", overrideVersionCode = 2),