Fix Alternative name handling null (#8544)

* Fix Alternative name handling null

fix Alternative name causing issue when manga description is null
filter/dont add alternative name if only contains spaces by using isBlank()

* fix typo
This commit is contained in:
Riztard Lanthorn 2021-08-14 16:46:53 +07:00 committed by GitHub
parent 24b583ac6a
commit f4a3bdd739
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 64 additions and 63 deletions

View File

@ -84,10 +84,10 @@ class MidnightMessScans : Madara("Midnight Mess Scans", "https://midnightmess.or
// add alternative name to manga description
document.select(altNameSelector).firstOrNull()?.ownText()?.let {
if (it.isEmpty().not() && it.notUpdating()) {
manga.description += when {
manga.description.isNullOrEmpty() -> altName + it
else -> "\n\n$altName" + it
if (it.isBlank().not() && it.notUpdating()) {
manga.description = when {
manga.description.isNullOrBlank() -> altName + it
else -> manga.description + "\n\n$altName" + it
}
}
}
@ -95,7 +95,7 @@ class MidnightMessScans : Madara("Midnight Mess Scans", "https://midnightmess.or
return manga
}
override fun getGenreList() = listOf(
Genre("Bilibili", "bilibili"),
Genre("Complete", "complete"),

View File

@ -50,10 +50,10 @@ class ReaperScansFR : WPMangaReader("ReaperScans.fr (GS)", "https://reaperscans.
// add alternative name to manga description
document.select(altNameSelector).firstOrNull()?.ownText()?.let {
if (it.isEmpty().not()) {
description += when {
description!!.isEmpty() -> altName + it
else -> "\n\n$altName" + it
if (it.isBlank().not()) {
description = when {
description.isNullOrBlank() -> altName + it
else -> description + "\n\n$altName" + it
}
}
}

View File

@ -126,10 +126,10 @@ class KomikCast : WPMangaStream("Komik Cast", "https://komikcast.com", "id") {
// 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
if (it.isBlank().not() && it != "N/A" && it != "-") {
description = when {
description.isNullOrBlank() -> altName + it
else -> description + "\n\n$altName" + it
}
}
}

View File

@ -38,10 +38,10 @@ class WestManga : WPMangaStream("West Manga", "https://westmanga.info", "id") {
// 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
if (it.isBlank().not() && it !="N/A" && it != "-") {
description = when {
description.isNullOrBlank() -> altName + it
else -> description + "\n\n$altName" + it
}
}
}

View File

@ -169,10 +169,10 @@ abstract class FMReader(
// add alternative name to manga description
infoElement.select(altNameSelector).firstOrNull()?.ownText()?.let {
if (it.isEmpty().not() && it.contains("Updating", true).not()) {
description += when {
description!!.isEmpty() -> altName + it
else -> "\n\n$altName" + it
if (it.isBlank().not() && it.contains("Updating", true).not()) {
description = when {
description.isNullOrBlank() -> altName + it
else -> description + "\n\n$altName" + it
}
}
}

View File

@ -10,7 +10,7 @@ class FMReaderGenerator : ThemeSourceGenerator {
override val themeClass = "FMReader"
override val baseVersionCode: Int = 5
override val baseVersionCode: Int = 6
/** For future sources: when testing and popularMangaRequest() returns a Jsoup error instead of results
* most likely the fix is to override popularMangaNextPageSelector() */

View File

@ -370,10 +370,10 @@ abstract class Madara(
// add alternative name to manga description
document.select(altNameSelector).firstOrNull()?.ownText()?.let {
if (it.isEmpty().not() && it.notUpdating()) {
manga.description += when {
manga.description.isNullOrEmpty() -> altName + it
else -> "\n\n$altName" + it
if (it.isBlank().not() && it.notUpdating()) {
manga.description = when {
manga.description.isNullOrBlank() -> altName + it
else -> manga.description + "\n\n$altName" + it
}
}
}

View File

@ -10,7 +10,7 @@ class MadaraGenerator : ThemeSourceGenerator {
override val themeClass = "Madara"
override val baseVersionCode: Int = 8
override val baseVersionCode: Int = 9
override val sources = listOf(
MultiLang("Leviatan Scans", "https://leviatanscans.com", listOf("en", "es"), className = "LeviatanScansFactory", overrideVersionCode = 6),

View File

@ -157,10 +157,10 @@ abstract class MangaBox(
// add alternative name to manga description
document.select(altNameSelector).firstOrNull()?.ownText()?.let {
if (it.isEmpty().not()) {
description += when {
description!!.isEmpty() -> altName + it
else -> "\n\n$altName" + it
if (it.isBlank().not()) {
description = when {
description.isNullOrBlank() -> altName + it
else -> description + "\n\n$altName" + it
}
}
}

View File

@ -9,7 +9,7 @@ class MangaBoxGenerator : ThemeSourceGenerator {
override val themeClass = "MangaBox"
override val baseVersionCode: Int = 3
override val baseVersionCode: Int = 4
override val sources = listOf(
SingleLang("Mangakakalot", "https://mangakakalot.com", "en", overrideVersionCode = 3),

View File

@ -232,10 +232,10 @@ abstract class NepNep(
// add alternative name to manga description
val altName = "Alternative Name: "
info.select("li.list-group-item:has(span:contains(Alter))").firstOrNull()?.ownText()?.let {
if (it.isEmpty().not() && it != "N/A") {
description += when {
description!!.isEmpty() -> altName + it
else -> "\n\n$altName" + it
if (it.isBlank().not() && it != "N/A") {
description = when {
description.isNullOrBlank() -> altName + it
else -> description + "\n\n$altName" + it
}
}
}
@ -392,4 +392,4 @@ abstract class NepNep(
Genre("Yaoi"),
Genre("Yuri")
)
}
}

View File

@ -9,7 +9,7 @@ class NepNepGenerator : ThemeSourceGenerator {
override val themeClass = "NepNep"
override val baseVersionCode: Int = 5
override val baseVersionCode: Int = 6
override val sources = listOf(
SingleLang("MangaSee", "https://mangasee123.com", "en", overrideVersionCode = 20),

View File

@ -182,10 +182,10 @@ abstract class WPMangaReader(
// add alternative name to manga description
document.select(altNameSelector).firstOrNull()?.ownText()?.let {
if (it.isEmpty().not()) {
description += when {
description!!.isEmpty() -> altName + it
else -> "\n\n$altName" + it
if (it.isBlank().not()) {
description = when {
description.isNullOrBlank() -> altName + it
else -> description + "\n\n$altName" + it
}
}
}

View File

@ -9,7 +9,7 @@ class WPMangaReaderGenerator : ThemeSourceGenerator {
override val themeClass = "WPMangaReader"
override val baseVersionCode: Int = 8
override val baseVersionCode: Int = 9
override val sources = listOf(
SingleLang("Anitation Arts", "https://anitationarts.org", "en", overrideVersionCode = 1),

View File

@ -177,10 +177,10 @@ abstract class WPMangaStream(
// 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
if (it.isBlank().not() && it != "N/A" && it != "-") {
description = when {
description.isNullOrBlank() -> altName + it
else -> description + "\n\n$altName" + it
}
}
}

View File

@ -9,7 +9,7 @@ class WPMangaStreamGenerator : ThemeSourceGenerator {
override val themeClass = "WPMangaStream"
override val baseVersionCode: Int = 9
override val baseVersionCode: Int = 10
override val sources = listOf(
SingleLang("Asura Scans", "https://www.asurascans.com", "en", overrideVersionCode = 5),

View File

@ -5,7 +5,7 @@ ext {
extName = 'Mangahub'
pkgNameSuffix = 'en.mangahub'
extClass = '.Mangahub'
extVersionCode = 8
extVersionCode = 9
libVersion = '1.2'
}

View File

@ -89,11 +89,12 @@ class Mangahub : ParsedHttpSource() {
}
// add alternative name to manga description
val altName = "Alternative Name: "
document.select("h1 small").firstOrNull()?.ownText()?.let {
if (it.isEmpty().not()) {
manga.description += when {
manga.description!!.isEmpty() -> "Alternative Name: $it"
else -> "\n\nAlternative Name: $it"
if (it.isBlank().not()) {
manga.description = when {
manga.description.isNullOrBlank() -> altName + it
else -> manga.description + "\n\n$altName" + it
}
}
}

View File

@ -6,7 +6,7 @@ ext {
extName = 'MangaPark'
pkgNameSuffix = 'en.mangapark'
extClass = '.MangaPark'
extVersionCode = 21
extVersionCode = 22
libVersion = '1.2'
}

View File

@ -121,10 +121,10 @@ class MangaPark : ConfigurableSource, ParsedHttpSource() {
// add alternative name to manga description
val altName = "Alternative Name: "
document.select(".attr > tbody > tr:contains(Alter) td").firstOrNull()?.ownText()?.let {
if (it.isEmpty().not()) {
description += when {
description!!.isEmpty() -> altName + it
else -> "\n\n$altName" + it
if (it.isBlank().not()) {
description = when {
description.isNullOrBlank() -> altName + it
else -> description + "\n\n$altName" + it
}
}
}

View File

@ -5,7 +5,7 @@ ext {
extName = 'Maid - Manga'
pkgNameSuffix = 'id.maidmanga'
extClass = '.MaidManga'
extVersionCode = 8
extVersionCode = 9
libVersion = '1.2'
}

View File

@ -119,10 +119,10 @@ class MaidManga : ParsedHttpSource() {
// add alternative name to manga description
val altName = "Alternative Name: "
document.select(".series-title span").firstOrNull()?.ownText()?.let {
if (it.isEmpty().not()) {
description += when {
description!!.isEmpty() -> altName + it
else -> "\n\n$altName" + it
if (it.isBlank().not()) {
description = when {
description.isNullOrBlank() -> altName + it
else -> description + "\n\n$altName" + it
}
}
}