fix(Madara): preserve the capitalization of tags and genres (#10353)
Co-authored-by: stevenyomi <95685115+stevenyomi@users.noreply.github.com>
This commit is contained in:
parent
08cf9260e8
commit
0fae25ac43
@ -2,7 +2,7 @@ plugins {
|
|||||||
id("lib-multisrc")
|
id("lib-multisrc")
|
||||||
}
|
}
|
||||||
|
|
||||||
baseVersionCode = 42
|
baseVersionCode = 43
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project(":lib:cryptoaes"))
|
api(project(":lib:cryptoaes"))
|
||||||
|
@ -702,12 +702,11 @@ abstract class Madara(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
val genres = select(mangaDetailsSelectorGenre)
|
val genres = select(mangaDetailsSelectorGenre)
|
||||||
.map { element -> element.text().lowercase(Locale.ROOT) }
|
.mapTo(ArrayList()) { element -> element.text() }
|
||||||
.toMutableSet()
|
|
||||||
|
|
||||||
if (mangaDetailsSelectorTag.isNotEmpty()) {
|
if (mangaDetailsSelectorTag.isNotEmpty()) {
|
||||||
select(mangaDetailsSelectorTag).forEach { element ->
|
select(mangaDetailsSelectorTag).forEach { element ->
|
||||||
if (genres.contains(element.text()).not() &&
|
if (
|
||||||
element.text().length <= 25 &&
|
element.text().length <= 25 &&
|
||||||
element.text().contains("read", true).not() &&
|
element.text().contains("read", true).not() &&
|
||||||
element.text().contains(name, true).not() &&
|
element.text().contains(name, true).not() &&
|
||||||
@ -715,29 +714,19 @@ abstract class Madara(
|
|||||||
element.text().contains(manga.title, true).not() &&
|
element.text().contains(manga.title, true).not() &&
|
||||||
element.text().contains(altName, true).not()
|
element.text().contains(altName, true).not()
|
||||||
) {
|
) {
|
||||||
genres.add(element.text().lowercase(Locale.ROOT))
|
genres.add(element.text())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add manga/manhwa/manhua thinggy to genre
|
// add manga/manhwa/manhua thinggy to genre
|
||||||
document.selectFirst(seriesTypeSelector)?.ownText()?.let {
|
document.selectFirst(seriesTypeSelector)?.ownText()?.let {
|
||||||
if (it.isEmpty().not() && it.notUpdating() && it != "-" && genres.contains(it).not()) {
|
if (it.isEmpty().not() && it.notUpdating() && it != "-") {
|
||||||
genres.add(it.lowercase(Locale.ROOT))
|
genres.add(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
manga.genre = genres.toList().joinToString { genre ->
|
manga.genre = genres.distinctBy(String::lowercase).joinToString()
|
||||||
genre.replaceFirstChar {
|
|
||||||
if (it.isLowerCase()) {
|
|
||||||
it.titlecase(
|
|
||||||
Locale.ROOT,
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
it.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// add alternative name to manga description
|
// add alternative name to manga description
|
||||||
document.selectFirst(altNameSelector)?.ownText()?.let {
|
document.selectFirst(altNameSelector)?.ownText()?.let {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user