From 369e48f362a1444e545e92387f769a8742aa8064 Mon Sep 17 00:00:00 2001 From: Alessandro Jean <14254807+alessandrojean@users.noreply.github.com> Date: Mon, 24 Jul 2023 18:19:43 -0300 Subject: [PATCH] Add migrate warning on chapter parsing in GM as well (#17249) Add migrate warning on chapter parsing in GM as well. --- src/pt/goldenmangas/build.gradle | 2 +- .../extension/pt/goldenmangas/GoldenMangas.kt | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pt/goldenmangas/build.gradle b/src/pt/goldenmangas/build.gradle index f243aed95..5f01c23f2 100644 --- a/src/pt/goldenmangas/build.gradle +++ b/src/pt/goldenmangas/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Golden Mangás' pkgNameSuffix = 'pt.goldenmangas' extClass = '.GoldenMangas' - extVersionCode = 18 + extVersionCode = 19 isNsfw = true } diff --git a/src/pt/goldenmangas/src/eu/kanade/tachiyomi/extension/pt/goldenmangas/GoldenMangas.kt b/src/pt/goldenmangas/src/eu/kanade/tachiyomi/extension/pt/goldenmangas/GoldenMangas.kt index eb606337a..d4235751b 100644 --- a/src/pt/goldenmangas/src/eu/kanade/tachiyomi/extension/pt/goldenmangas/GoldenMangas.kt +++ b/src/pt/goldenmangas/src/eu/kanade/tachiyomi/extension/pt/goldenmangas/GoldenMangas.kt @@ -163,7 +163,11 @@ class GoldenMangas : ParsedHttpSource() { throw Exception(CHAPTER_IS_NOVEL_ERROR) } - return chapterImages!!.select("img[pag]") + if (chapterImages == null) { + throw Exception(MIGRATE_WARNING) + } + + return chapterImages.select("img[pag]") .mapIndexed { i, element -> Page(i, document.location(), element.attr("abs:src")) } @@ -181,7 +185,7 @@ class GoldenMangas : ParsedHttpSource() { } private fun String.toDate(): Long { - return runCatching { DATE_FORMATTER.parse(trim())?. time } + return runCatching { DATE_FORMATTER.parse(trim())?.time } .getOrNull() ?: 0L } @@ -210,7 +214,7 @@ class GoldenMangas : ParsedHttpSource() { private const val MIGRATE_WARNING = "Migre o item da Golden Mangás para Golden Mangás para atualizar a URL." private val DATE_FORMATTER by lazy { - SimpleDateFormat("(dd/MM/yyyy)", Locale.ENGLISH) + SimpleDateFormat("(dd/MM/yyyy)", Locale("pt", "BR")) } } }