Flame Comics: add tags/genres (#6390)
* Flame Comics: add tags/genres * also add genre, and make tags optional
This commit is contained in:
parent
9ee5e17b37
commit
f80a060670
|
@ -199,6 +199,11 @@ class FlameComics : HttpSource() {
|
|||
}.build().toString() + "&w=640&q=75",
|
||||
)
|
||||
description = seriesData.description
|
||||
|
||||
genre = seriesData.tags?.let { tags ->
|
||||
(listOf(seriesData.type) + tags).joinToString()
|
||||
} ?: seriesData.type
|
||||
|
||||
author = seriesData.author
|
||||
status = when (seriesData.status.lowercase()) {
|
||||
"ongoing" -> SManga.ONGOING
|
||||
|
|
|
@ -2,11 +2,14 @@ package eu.kanade.tachiyomi.extension.en.flamecomics
|
|||
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.builtins.ListSerializer
|
||||
import kotlinx.serialization.builtins.MapSerializer
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
import kotlinx.serialization.decodeFromString
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
import kotlinx.serialization.json.Json
|
||||
|
||||
@Serializable
|
||||
class NewBuildID(
|
||||
|
@ -70,6 +73,9 @@ class Series(
|
|||
val altTitles: String?,
|
||||
val description: String,
|
||||
val cover: String,
|
||||
val type: String,
|
||||
@Serializable(with = TagsListSerializer::class)
|
||||
val tags: List<String>?,
|
||||
val author: String?,
|
||||
val status: String,
|
||||
val series_id: Int,
|
||||
|
@ -101,3 +107,14 @@ class KeysToListSerializer : KSerializer<List<Page>> {
|
|||
|
||||
override fun serialize(encoder: Encoder, value: List<Page>) {}
|
||||
}
|
||||
|
||||
class TagsListSerializer : KSerializer<List<String>> {
|
||||
private val listSer = ListSerializer(String.serializer())
|
||||
override val descriptor: SerialDescriptor = listSer.descriptor
|
||||
override fun deserialize(decoder: Decoder): List<String> {
|
||||
val jsonString = decoder.decodeString()
|
||||
return Json.decodeFromString(jsonString)
|
||||
}
|
||||
|
||||
override fun serialize(encoder: Encoder, value: List<String>) {}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue