[ComicK] Improvements

master
Koitharu 1 year ago
parent d5a4cf68c6
commit b0de4c3b66
Signed by: Koitharu
GPG Key ID: 676DEE768C17A9D7

@ -182,15 +182,13 @@ internal class ComickFunParser(context: MangaLoaderContext) :
val alt = comic.getJSONArray("md_titles").asTypedList<JSONObject>().mapNotNullToSet {
it.getStringOrNull("title")
}
val author = jo.getJSONArray("artists").optJSONObject(0)?.getStringOrNull("name")
val authors = jo.getJSONArray("artists").mapJSONNotNullToSet { it.getStringOrNull("name") }
return manga.copy(
altTitles = alt,
contentRating = if (jo.getBooleanOrDefault("matureContent", false)
|| comic.getBooleanOrDefault("hentai", false)
) {
ContentRating.ADULT
} else {
ContentRating.SAFE
contentRating = when {
comic.getBooleanOrDefault("hentai", false) -> ContentRating.ADULT
jo.getBooleanOrDefault("matureContent", false) -> ContentRating.SUGGESTIVE
else -> ContentRating.SAFE
},
description = comic.getStringOrNull("parsed") ?: comic.getStringOrNull("desc"),
tags = manga.tags + comic.getJSONArray("md_comic_md_genres").mapJSONToSet {
@ -201,7 +199,7 @@ internal class ComickFunParser(context: MangaLoaderContext) :
source = source,
)
},
authors = setOfNotNull(author),
authors = authors,
chapters = getChapters(comic.getString("hid")),
)
}

@ -1,10 +1,12 @@
package org.koitharu.kotatsu.parsers.site.madara.pt
import org.koitharu.kotatsu.parsers.Broken
import org.koitharu.kotatsu.parsers.MangaLoaderContext
import org.koitharu.kotatsu.parsers.MangaSourceParser
import org.koitharu.kotatsu.parsers.model.MangaParserSource
import org.koitharu.kotatsu.parsers.site.madara.MadaraParser
@Broken
@MangaSourceParser("SUSSYSCAN", "SussyScan", "pt")
internal class SussyScan(context: MangaLoaderContext) :
MadaraParser(context, MangaParserSource.SUSSYSCAN, "oldi.sussytoons.site")

@ -48,7 +48,7 @@ public inline fun <T> JSONArray.mapJSON(block: (JSONObject) -> T): List<T> {
return mapJSONTo(ArrayList(length()), block)
}
public inline fun <T> JSONArray.mapJSONNotNull(block: (JSONObject) -> T?): List<T> {
public inline fun <T : Any> JSONArray.mapJSONNotNull(block: (JSONObject) -> T?): List<T> {
return mapJSONNotNullTo(ArrayList(length()), block)
}
@ -56,6 +56,10 @@ public inline fun <T> JSONArray.mapJSONToSet(mapper: (JSONObject) -> T): Set<T>
return mapJSONTo(ArraySet<T>(length()), mapper)
}
public inline fun <T : Any> JSONArray.mapJSONNotNullToSet(mapper: (JSONObject) -> T?): Set<T> {
return mapJSONNotNullTo(ArraySet<T>(length()), mapper)
}
public fun <T> JSONArray.mapJSONIndexed(block: (Int, JSONObject) -> T): List<T> {
val len = length()
val result = ArrayList<T>(len)

Loading…
Cancel
Save