MMRCMS: Fix chapter name cleaning logic (#951)

This commit is contained in:
beerpsi 2024-02-04 00:36:48 +07:00 committed by Draff
parent 46990a4d9f
commit 84453ebf50
3 changed files with 15 additions and 22 deletions

View File

@ -7,4 +7,5 @@ class ReadComicsOnline : MMRCMS(
"https://readcomicsonline.ru",
"en",
itemPath = "comic",
chapterString = "",
)

View File

@ -72,11 +72,6 @@ constructor(
override fun popularMangaRequest(page: Int) = GET("$baseUrl/filterList?page=$page&sortBy=views&asc=false")
override fun popularMangaParse(response: Response): MangasPage {
runCatching { fetchFilterOptions() }
return super.popularMangaParse(response)
}
override fun popularMangaSelector() = searchMangaSelector()
override fun popularMangaFromElement(element: Element) = searchMangaFromElement(element)
@ -91,8 +86,6 @@ constructor(
override fun latestUpdatesRequest(page: Int) = GET("$baseUrl/latest-release?page=$page", headers)
override fun latestUpdatesParse(response: Response): MangasPage {
runCatching { fetchFilterOptions() }
val document = response.asJsoup()
if (response.request.url.queryParameter("page") == "1") {
@ -169,8 +162,6 @@ constructor(
private val searchTokenRegex = Regex("""['"]_token['"]\s*:\s*['"]([0-9A-Za-z]+)['"]""")
override fun searchMangaParse(response: Response): MangasPage {
runCatching { fetchFilterOptions() }
val searchType = response.request.url.pathSegments.last()
if (searchType == "filterList") {
@ -303,7 +294,7 @@ constructor(
val splits = initialName.split(":", limit = 2).map { it.trim() }
return if (splits[0] == splits[1]) {
return if (splits.size < 2 || splits[0] == splits[1]) {
splits[0]
} else {
"${splits[0]}: ${splits[1]}"
@ -318,11 +309,13 @@ constructor(
override fun imageUrlParse(document: Document) = throw UnsupportedOperationException()
override fun getFilterList(): FilterList {
runCatching { fetchFilterOptions() }
val filters = buildList<Filter<*>> {
add(Filter.Header("Note: Ignored if using text search!"))
if (supportsAdvancedSearch) {
if (fetchFilterOptions && fetchFiltersAttempts > 0 && fetchFiltersFailed) {
if (fetchFilterOptions && (categories.isEmpty() || statuses.isEmpty())) {
add(Filter.Header("Press 'Reset' to attempt to show filter options"))
}
@ -361,7 +354,7 @@ constructor(
add(TextFilter("Year of release", "release"))
add(TextFilter("Author", "author"))
} else {
if (fetchFilterOptions && fetchFiltersAttempts > 0 && fetchFiltersFailed) {
if (fetchFilterOptions && categories.isEmpty()) {
add(Filter.Header("Press 'Reset' to attempt to show filter options"))
}

View File

@ -9,25 +9,24 @@ class MMRCMSGenerator : ThemeSourceGenerator {
override val themeClass = "MMRCMS"
override val baseVersionCode = 8
override val baseVersionCode = 9
override val sources = listOf(
SingleLang("Bentoscan", "https://bentoscan.com", "fr"),
SingleLang("Jpmangas", "https://jpmangas.xyz", "fr", overrideVersionCode = 2),
SingleLang("Komikid", "https://www.komikid.com", "id"),
SingleLang("Lelscan-VF", "https://lelscanvf.cc", "fr", className = "LelscanVF", overrideVersionCode = 2),
SingleLang("Mangadoor", "https://mangadoor.com", "es", overrideVersionCode = 1, isNsfw = true),
SingleLang("MangaID", "https://mangaid.click", "id", overrideVersionCode = 1),
SingleLang("Mangas.in", "https://mangas.in", "es", isNsfw = true, className = "MangasIn", overrideVersionCode = 2),
SingleLang("Manga-Scan", "https://mangascan-fr.com", "fr", className = "MangaScan", overrideVersionCode = 4),
SingleLang("Onma", "https://onma.top", "ar", sourceName = "مانجا اون لاين"),
SingleLang("Read Comics Online", "https://readcomicsonline.ru", "en"),
SingleLang("Scan VF", "https://www.scan-vf.net", "fr", overrideVersionCode = 1),
SingleLang("Komikid", "https://www.komikid.com", "id"),
SingleLang("Mangadoor", "https://mangadoor.com", "es", overrideVersionCode = 1, isNsfw = true),
SingleLang("Mangas.in", "https://mangas.in", "es", isNsfw = true, className = "MangasIn", overrideVersionCode = 2),
SingleLang("Utsukushii", "https://utsukushii-bg.com", "bg", overrideVersionCode = 1),
SingleLang("Lelscan-VF", "https://lelscanvf.cc", "fr", className = "LelscanVF", overrideVersionCode = 2),
SingleLang("MangaID", "https://mangaid.click", "id", overrideVersionCode = 1),
SingleLang("Jpmangas", "https://jpmangas.xyz", "fr", overrideVersionCode = 2),
SingleLang("Manga-Scan", "https://mangascan-fr.com", "fr", className = "MangaScan", overrideVersionCode = 4),
SingleLang("Bentoscan", "https://bentoscan.com", "fr"),
)
companion object {
@JvmStatic
fun main(args: Array<String>) {
MMRCMSGenerator().createAll()