use metadata.releaseDate or fileLastModified for chapter date (#4682)
This commit is contained in:
parent
8dbc444ec8
commit
89cea3e023
|
@ -1,3 +1,11 @@
|
|||
## 1.2.18
|
||||
|
||||
Minimum Komga version required: `0.63.2`
|
||||
|
||||
### Fix
|
||||
|
||||
* use metadata.releaseDate or fileLastModified for chapter date
|
||||
|
||||
## 1.2.17
|
||||
|
||||
Minimum Komga version required: `0.63.2`
|
||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'Komga'
|
||||
pkgNameSuffix = 'all.komga'
|
||||
extClass = '.KomgaFactory'
|
||||
extVersionCode = 17
|
||||
extVersionCode = 18
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
|
|
|
@ -168,7 +168,8 @@ open class Komga(suffix: String = "") : ConfigurableSource, HttpSource() {
|
|||
chapter_number = book.metadata.numberSort
|
||||
name = "${book.metadata.number} - ${book.metadata.title} (${book.size})"
|
||||
url = "$baseUrl/api/v1/books/${book.id}"
|
||||
date_upload = parseDate(book.lastModified)
|
||||
date_upload = book.metadata.releaseDate?.let { parseDate(it) }
|
||||
?: parseDateTime(book.fileLastModified)
|
||||
}
|
||||
}.sortedByDescending { it.chapter_number }
|
||||
}
|
||||
|
@ -219,6 +220,17 @@ open class Komga(suffix: String = "") : ConfigurableSource, HttpSource() {
|
|||
}
|
||||
|
||||
private fun parseDate(date: String?): Long =
|
||||
if (date == null)
|
||||
Date().time
|
||||
else {
|
||||
try {
|
||||
SimpleDateFormat("yyyy-MM-dd", Locale.US).parse(date).time
|
||||
} catch (ex: Exception) {
|
||||
Date().time
|
||||
}
|
||||
}
|
||||
|
||||
private fun parseDateTime(date: String?): Long =
|
||||
if (date == null)
|
||||
Date().time
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue