Fix spanish date on webtoon (#13807)

This commit is contained in:
Techeira Damián 2022-10-10 23:50:01 -03:00 committed by GitHub
parent 49ddd302f3
commit f6c8f8135a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View File

@ -38,16 +38,15 @@ class WebtoonsID : Webtoons("Webtoons.com", "https://www.webtoons.com", "id") {
}
class WebtoonsTH : Webtoons("Webtoons.com", "https://www.webtoons.com", "th", dateFormat = SimpleDateFormat("d MMM yyyy", Locale("th")))
class WebtoonsES : Webtoons("Webtoons.com", "https://www.webtoons.com", "es") {
// Android seems to be unable to parse es dates like Indonesian; we'll use a short hard-coded table
// instead.
// Android seems to be unable to parse es dates like Indonesian; we'll use a short hard-coded table instead.
private val dateMap: Array<String> = arrayOf(
"Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"
"ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic"
)
override fun chapterParseDate(date: String): Long {
val expr = Regex("""(\d+)-([a-z]{3})-(\d{4})""").find(date) ?: return 0
val expr = Regex("""(\d+)-([A-Za-z]{3})-(\d{4})""").find(date) ?: return 0
val (_, day, monthString, year) = expr.groupValues
val monthIndex = dateMap.indexOf(monthString)
val monthIndex = dateMap.indexOf(monthString.lowercase(Locale("es")))
return GregorianCalendar(year.toInt(), monthIndex, day.toInt()).time.time
}
}

View File

@ -13,7 +13,7 @@ class WebtoonsGenerator : ThemeSourceGenerator {
override val baseVersionCode: Int = 2
override val sources = listOf(
MultiLang("Webtoons.com", "https://www.webtoons.com", listOf("en", "fr", "es", "id", "th", "zh-Hant", "de"), className = "WebtoonsFactory", pkgName = "webtoons", overrideVersionCode = 35),
MultiLang("Webtoons.com", "https://www.webtoons.com", listOf("en", "fr", "es", "id", "th", "zh-Hant", "de"), className = "WebtoonsFactory", pkgName = "webtoons", overrideVersionCode = 36),
SingleLang("Dongman Manhua", "https://www.dongmanmanhua.cn", "zh")
)