Flame Comics: add tags/genres (#6390)

* Flame Comics: add tags/genres

* also add genre, and make tags optional
This commit is contained in:
Vetle Ledaal 2024-11-30 18:56:03 +01:00 committed by Draff
parent 9ee5e17b37
commit f80a060670
No known key found for this signature in database
GPG Key ID: E8A89F3211677653
2 changed files with 22 additions and 0 deletions

View File

@ -199,6 +199,11 @@ class FlameComics : HttpSource() {
}.build().toString() + "&w=640&q=75", }.build().toString() + "&w=640&q=75",
) )
description = seriesData.description description = seriesData.description
genre = seriesData.tags?.let { tags ->
(listOf(seriesData.type) + tags).joinToString()
} ?: seriesData.type
author = seriesData.author author = seriesData.author
status = when (seriesData.status.lowercase()) { status = when (seriesData.status.lowercase()) {
"ongoing" -> SManga.ONGOING "ongoing" -> SManga.ONGOING

View File

@ -2,11 +2,14 @@ package eu.kanade.tachiyomi.extension.en.flamecomics
import kotlinx.serialization.KSerializer import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.builtins.MapSerializer import kotlinx.serialization.builtins.MapSerializer
import kotlinx.serialization.builtins.serializer import kotlinx.serialization.builtins.serializer
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder import kotlinx.serialization.encoding.Encoder
import kotlinx.serialization.json.Json
@Serializable @Serializable
class NewBuildID( class NewBuildID(
@ -70,6 +73,9 @@ class Series(
val altTitles: String?, val altTitles: String?,
val description: String, val description: String,
val cover: String, val cover: String,
val type: String,
@Serializable(with = TagsListSerializer::class)
val tags: List<String>?,
val author: String?, val author: String?,
val status: String, val status: String,
val series_id: Int, val series_id: Int,
@ -101,3 +107,14 @@ class KeysToListSerializer : KSerializer<List<Page>> {
override fun serialize(encoder: Encoder, value: 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>) {}
}