Komik Cast: remove extra string in title (#18326)
* Komik Cast: remove extra string in title - remove extra string in title * fix lint * fix lint 2
This commit is contained in:
parent
af1ad3293e
commit
080f5f910f
|
@ -7,6 +7,7 @@ import eu.kanade.tachiyomi.source.model.Filter
|
||||||
import eu.kanade.tachiyomi.source.model.FilterList
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
import eu.kanade.tachiyomi.source.model.Page
|
||||||
import eu.kanade.tachiyomi.source.model.SChapter
|
import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import kotlinx.serialization.json.jsonArray
|
import kotlinx.serialization.json.jsonArray
|
||||||
import kotlinx.serialization.json.jsonObject
|
import kotlinx.serialization.json.jsonObject
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
|
@ -17,13 +18,10 @@ import org.jsoup.Jsoup
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
|
class KomikCast : MangaThemesia("Komik Cast", "https://komikcast.vip", "id", "/daftar-komik") {
|
||||||
|
|
||||||
class KomikCast : MangaThemesia(
|
|
||||||
"Komik Cast",
|
|
||||||
baseUrl = "https://komikcast.vip",
|
|
||||||
"id",
|
|
||||||
mangaUrlDirectory = "/daftar-komik",
|
|
||||||
) {
|
|
||||||
// Formerly "Komik Cast (WP Manga Stream)"
|
// Formerly "Komik Cast (WP Manga Stream)"
|
||||||
override val id = 972717448578983812
|
override val id = 972717448578983812
|
||||||
|
|
||||||
|
@ -68,6 +66,37 @@ class KomikCast : MangaThemesia(
|
||||||
override val seriesThumbnailSelector = ".komik_info-content-thumbnail img"
|
override val seriesThumbnailSelector = ".komik_info-content-thumbnail img"
|
||||||
override val seriesStatusSelector = ".komik_info-content-info:contains(Status)"
|
override val seriesStatusSelector = ".komik_info-content-info:contains(Status)"
|
||||||
|
|
||||||
|
override fun mangaDetailsParse(document: Document) = SManga.create().apply {
|
||||||
|
document.selectFirst(seriesDetailsSelector)?.let { seriesDetails ->
|
||||||
|
title = seriesDetails.selectFirst(seriesTitleSelector)?.text()
|
||||||
|
?.replace("bahasa indonesia", "", ignoreCase = true)?.trim().orEmpty()
|
||||||
|
artist = seriesDetails.selectFirst(seriesArtistSelector)?.ownText().removeEmptyPlaceholder()
|
||||||
|
author = seriesDetails.selectFirst(seriesAuthorSelector)?.ownText().removeEmptyPlaceholder()
|
||||||
|
description = seriesDetails.select(seriesDescriptionSelector).joinToString("\n") { it.text() }.trim()
|
||||||
|
// Add alternative name to manga description
|
||||||
|
val altName = seriesDetails.selectFirst(seriesAltNameSelector)?.ownText().takeIf { it.isNullOrBlank().not() }
|
||||||
|
altName?.let {
|
||||||
|
description = "$description\n\n$altNamePrefix$altName".trim()
|
||||||
|
}
|
||||||
|
val genres = seriesDetails.select(seriesGenreSelector).map { it.text() }.toMutableList()
|
||||||
|
// Add series type (manga/manhwa/manhua/other) to genre
|
||||||
|
seriesDetails.selectFirst(seriesTypeSelector)?.ownText().takeIf { it.isNullOrBlank().not() }?.let { genres.add(it) }
|
||||||
|
genre = genres.map { genre ->
|
||||||
|
genre.lowercase(Locale.forLanguageTag(lang)).replaceFirstChar { char ->
|
||||||
|
if (char.isLowerCase()) {
|
||||||
|
char.titlecase(Locale.forLanguageTag(lang))
|
||||||
|
} else {
|
||||||
|
char.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.joinToString { it.trim() }
|
||||||
|
|
||||||
|
status = seriesDetails.selectFirst(seriesStatusSelector)?.text().parseStatus()
|
||||||
|
thumbnail_url = seriesDetails.select(seriesThumbnailSelector).imgAttr()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun chapterListSelector() = "div.komik_info-chapters li"
|
override fun chapterListSelector() = "div.komik_info-chapters li"
|
||||||
|
|
||||||
override fun chapterFromElement(element: Element) = SChapter.create().apply {
|
override fun chapterFromElement(element: Element) = SChapter.create().apply {
|
||||||
|
@ -215,17 +244,11 @@ class KomikCast : MangaThemesia(
|
||||||
OrderByFilter(),
|
OrderByFilter(),
|
||||||
Filter.Header("Genre exclusion is not available for all sources"),
|
Filter.Header("Genre exclusion is not available for all sources"),
|
||||||
GenreListFilter(getGenreList()),
|
GenreListFilter(getGenreList()),
|
||||||
)
|
|
||||||
if (hasProjectPage) {
|
|
||||||
filters.addAll(
|
|
||||||
mutableListOf<Filter<*>>(
|
|
||||||
Filter.Separator(),
|
Filter.Separator(),
|
||||||
Filter.Header("NOTE: Can't be used with other filter!"),
|
Filter.Header("NOTE: Can't be used with other filter!"),
|
||||||
Filter.Header("$name Project List page"),
|
Filter.Header("$name Project List page"),
|
||||||
ProjectFilter(),
|
ProjectFilter(),
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}
|
|
||||||
return FilterList(filters)
|
return FilterList(filters)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,4 @@ class SoulScans : MangaThemesia("Soul Scans", "https://soulscans.my.id", "id") {
|
||||||
seriesDetails.select(seriesThumbnailSelector).firstOrNull()?.let { thumbnail_url = it.imgAttr() }
|
seriesDetails.select(seriesThumbnailSelector).firstOrNull()?.let { thumbnail_url = it.imgAttr() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun String?.removeEmptyPlaceholder(): String? {
|
|
||||||
return if (this.isNullOrBlank() || this == "-" || this == "N/A") null else this
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,7 +205,7 @@ abstract class MangaThemesia(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun String?.removeEmptyPlaceholder(): String? {
|
protected fun String?.removeEmptyPlaceholder(): String? {
|
||||||
return if (this.isNullOrBlank() || this == "-" || this == "N/A") null else this
|
return if (this.isNullOrBlank() || this == "-" || this == "N/A") null else this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
|
||||||
SingleLang("Komiksan", "https://komiksan.link", "id", overrideVersionCode = 2),
|
SingleLang("Komiksan", "https://komiksan.link", "id", overrideVersionCode = 2),
|
||||||
SingleLang("Kiryuu", "https://kiryuu.id", "id", overrideVersionCode = 6),
|
SingleLang("Kiryuu", "https://kiryuu.id", "id", overrideVersionCode = 6),
|
||||||
SingleLang("Komik AV", "https://komikav.com", "id", overrideVersionCode = 1),
|
SingleLang("Komik AV", "https://komikav.com", "id", overrideVersionCode = 1),
|
||||||
SingleLang("Komik Cast", "https://komikcast.vip", "id", overrideVersionCode = 21),
|
SingleLang("Komik Cast", "https://komikcast.vip", "id", overrideVersionCode = 22),
|
||||||
SingleLang("KomikDewasa", "https://komikdewasa.org", "id", isNsfw = true),
|
SingleLang("KomikDewasa", "https://komikdewasa.org", "id", isNsfw = true),
|
||||||
SingleLang("Komik Station", "https://komikstation.co", "id", overrideVersionCode = 4),
|
SingleLang("Komik Station", "https://komikstation.co", "id", overrideVersionCode = 4),
|
||||||
SingleLang("KomikIndo.co", "https://komikindo.co", "id", className = "KomikindoCo", overrideVersionCode = 3),
|
SingleLang("KomikIndo.co", "https://komikindo.co", "id", className = "KomikindoCo", overrideVersionCode = 3),
|
||||||
|
@ -123,7 +123,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
|
||||||
SingleLang("Silence Scan", "https://silencescan.com.br", "pt-BR", isNsfw = true, overrideVersionCode = 5),
|
SingleLang("Silence Scan", "https://silencescan.com.br", "pt-BR", isNsfw = true, overrideVersionCode = 5),
|
||||||
SingleLang("SkyMangas", "https://skymangas.com", "es"),
|
SingleLang("SkyMangas", "https://skymangas.com", "es"),
|
||||||
SingleLang("Snudae Scans", "https://snudaescans.com", "en", isNsfw = true, className = "BatotoScans", overrideVersionCode = 1),
|
SingleLang("Snudae Scans", "https://snudaescans.com", "en", isNsfw = true, className = "BatotoScans", overrideVersionCode = 1),
|
||||||
SingleLang("Soul Scans", "https://soulscans.my.id", "id"),
|
SingleLang("Soul Scans", "https://soulscans.my.id", "id", overrideVersionCode = 1),
|
||||||
SingleLang("SSSScanlator", "https://sssscanlator.com", "pt-BR"),
|
SingleLang("SSSScanlator", "https://sssscanlator.com", "pt-BR"),
|
||||||
SingleLang("SSS Hentais", "https://hentais.sssscanlator.com", "pt-BR", isNsfw = true, className = "SssHentais"),
|
SingleLang("SSS Hentais", "https://hentais.sssscanlator.com", "pt-BR", isNsfw = true, className = "SssHentais"),
|
||||||
SingleLang("Starlight Scan", "https://starligthscan.com", "pt-BR", isNsfw = true),
|
SingleLang("Starlight Scan", "https://starligthscan.com", "pt-BR", isNsfw = true),
|
||||||
|
|
Loading…
Reference in New Issue