Make locale non-nullable

master
Koitharu 2 years ago
parent 3ff9e69585
commit 0b2bf607f7
Signed by: Koitharu
GPG Key ID: 676DEE768C17A9D7

@ -83,11 +83,11 @@ class ParserProcessor(
enum class MangaSource( enum class MangaSource(
val title: String, val title: String,
val locale: String?, val locale: String,
val contentType: ContentType, val contentType: ContentType,
val isBroken: Boolean, val isBroken: Boolean,
) { ) {
LOCAL("Local", null, ContentType.OTHER, false), LOCAL("Local", "", ContentType.OTHER, false),
""".trimIndent(), """.trimIndent(),
) )
@ -110,7 +110,7 @@ class ParserProcessor(
) )
sourcesWriter?.write( sourcesWriter?.write(
""" """
DUMMY("Dummy", null, ContentType.OTHER, false), DUMMY("Dummy", "", ContentType.OTHER, false),
; ;
} }
""".trimIndent(), """.trimIndent(),
@ -135,7 +135,7 @@ class ParserProcessor(
val title = annotation.arguments.single { it.name?.asString() == "title" }.value as String val title = annotation.arguments.single { it.name?.asString() == "title" }.value as String
val locale = annotation.arguments.single { it.name?.asString() == "locale" }.value as String val locale = annotation.arguments.single { it.name?.asString() == "locale" }.value as String
val type = annotation.arguments.single { it.name?.asString() == "type" }.value val type = annotation.arguments.single { it.name?.asString() == "type" }.value
val localeString = if (locale.isEmpty()) "null" else "\"$locale\"" val localeString = "\"$locale\""
val localeObj = if (locale.isEmpty()) null else Locale(locale) val localeObj = if (locale.isEmpty()) null else Locale(locale)
val localeTitle = localeObj?.getDisplayLanguage(localeObj) val localeTitle = localeObj?.getDisplayLanguage(localeObj)
if (localeObj != null && localeObj !in availableLocales) { if (localeObj != null && localeObj !in availableLocales) {

@ -3,6 +3,7 @@ package org.koitharu.kotatsu.parsers.site.be
import androidx.collection.ArraySet import androidx.collection.ArraySet
import org.json.JSONArray import org.json.JSONArray
import org.json.JSONObject import org.json.JSONObject
import org.koitharu.kotatsu.parsers.Broken
import org.koitharu.kotatsu.parsers.MangaLoaderContext import org.koitharu.kotatsu.parsers.MangaLoaderContext
import org.koitharu.kotatsu.parsers.MangaParser import org.koitharu.kotatsu.parsers.MangaParser
import org.koitharu.kotatsu.parsers.MangaSourceParser import org.koitharu.kotatsu.parsers.MangaSourceParser
@ -18,6 +19,7 @@ import org.koitharu.kotatsu.parsers.util.json.stringIterator
import org.koitharu.kotatsu.parsers.util.toAbsoluteUrl import org.koitharu.kotatsu.parsers.util.toAbsoluteUrl
import java.util.* import java.util.*
@Broken
@MangaSourceParser("ANIBEL", "Anibel", "be") @MangaSourceParser("ANIBEL", "Anibel", "be")
internal class AnibelParser(context: MangaLoaderContext) : MangaParser(context, MangaSource.ANIBEL) { internal class AnibelParser(context: MangaLoaderContext) : MangaParser(context, MangaSource.ANIBEL) {

Loading…
Cancel
Save