Update url and Change theme for SinensisScan "pt-BR" (#2193)

* update url and change theme for SinensisScan "pt"

* Update SinensisScan.kt

* Update build.gradle

* remove  id

* peachscan

* Update build.gradle
This commit is contained in:
mohamedotaku 2024-03-31 07:13:58 +00:00 committed by Draff
parent 631272428e
commit 7217df6180
2 changed files with 8 additions and 52 deletions

View File

@ -1,9 +1,9 @@
ext { ext {
extName = 'Sinensis Scan' extName = 'Sinensis Scan'
extClass = '.SinensisScan' extClass = '.SinensisScan'
themePkg = 'madara' themePkg = 'peachscan'
baseUrl = 'https://sinensisscan.net' baseUrl = 'https://sinensistoon.com'
overrideVersionCode = 6 overrideVersionCode = 38
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -1,56 +1,12 @@
package eu.kanade.tachiyomi.extension.pt.sinensis package eu.kanade.tachiyomi.extension.pt.sinensis
import eu.kanade.tachiyomi.multisrc.madara.Madara import eu.kanade.tachiyomi.multisrc.peachscan.PeachScan
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.OkHttpClient
import org.jsoup.nodes.Element
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Locale import java.util.Locale
import java.util.concurrent.TimeUnit
class SinensisScan : Madara( class SinensisScan : PeachScan(
"Sinensis Scan", "Sinensis Scan",
"https://sinensisscan.net", "https://sinensistoon.com",
"pt-BR", "pt-BR",
SimpleDateFormat("dd/MM/yyyy", Locale("pt", "BR")), SimpleDateFormat("dd 'de' MMMM 'de' yyyy 'às' HH:mm", Locale("pt", "BR")),
) { )
// Name changed from Sinensis to Sinensis Scan
override val id: Long = 3891513807564817914
override val client: OkHttpClient = super.client.newBuilder()
.rateLimit(1, 2, TimeUnit.SECONDS)
.build()
override fun popularMangaFromElement(element: Element): SManga {
return super.popularMangaFromElement(element).apply {
setUrlWithoutDomain(url.removeBadPath("manga"))
}
}
override fun searchMangaFromElement(element: Element): SManga {
return super.searchMangaFromElement(element).apply {
setUrlWithoutDomain(url.removeBadPath("manga"))
}
}
override fun chapterFromElement(element: Element): SChapter {
return super.chapterFromElement(element).apply {
setUrlWithoutDomain(url.removeBadPath("manga"))
}
}
private fun String.removeBadPath(expectedFirstPath: String): String {
val fullUrl = if (contains(baseUrl)) this else (baseUrl + this)
val url = fullUrl.toHttpUrl()
if (url.pathSegments.firstOrNull() != expectedFirstPath) {
return url.newBuilder().removePathSegment(0).toString()
}
return url.toString()
}
}