NewToki: Better Date handling, Fix popular request pagination (#791)

NewToki: Better Date handling, Fix popular request pagination
This commit is contained in:
DitFranXX 2019-02-09 02:00:30 +09:00 committed by Carlos
parent 2d83d597fb
commit 63e2099370
2 changed files with 16 additions and 3 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: NewToki' appName = 'Tachiyomi: NewToki'
pkgNameSuffix = 'ko.newtoki' pkgNameSuffix = 'ko.newtoki'
extClass = '.NewToki' extClass = '.NewToki'
extVersionCode = 1 extVersionCode = 2
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -40,7 +40,7 @@ class NewToki : ParsedHttpSource() {
override fun popularMangaNextPageSelector() = "ul.pagination > li:not(.disabled)" override fun popularMangaNextPageSelector() = "ul.pagination > li:not(.disabled)"
// Do not add page parameter if page is 1 to prevent tracking. // Do not add page parameter if page is 1 to prevent tracking.
override fun popularMangaRequest(page: Int) = GET("$baseUrl/comic" + if (page > 1) "p$page" else "") override fun popularMangaRequest(page: Int) = GET("$baseUrl/comic" + if (page > 1) "/p$page" else "")
override fun popularMangaParse(response: Response): MangasPage { override fun popularMangaParse(response: Response): MangasPage {
val document = response.asJsoup() val document = response.asJsoup()
@ -114,7 +114,20 @@ class NewToki : ParsedHttpSource() {
private fun parseChapterDate(date: String): Long { private fun parseChapterDate(date: String): Long {
return try { return try {
if (date.contains(":")) { if (date.contains(":")) {
Calendar.getInstance().time.time val calendar = Calendar.getInstance()
val splitDate = date.split(":")
val hours = splitDate.first().toInt()
val minutes = splitDate.last().toInt()
val calendarHours = calendar.get(Calendar.HOUR)
val calendarMinutes = calendar.get(Calendar.MINUTE)
if (calendarHours >= hours && calendarMinutes > minutes) {
calendar.add(Calendar.DATE, -1)
}
calendar.timeInMillis
} else { } else {
SimpleDateFormat("yyyy.MM.dd").parse(date).time SimpleDateFormat("yyyy.MM.dd").parse(date).time
} }