Fix empty chapter names in Kemono (#14903)
* Fix empty chapter names in Kemono. * Remove double Date creation.
This commit is contained in:
parent
ecdaaf98d0
commit
5dc59917af
@ -67,14 +67,24 @@ class KemonoPostDto(
|
||||
}.distinctBy { it.path }.map { it.toString() }
|
||||
|
||||
fun toSChapter() = SChapter.create().apply {
|
||||
val postDate = dateFormat.parse(edited ?: published ?: added)
|
||||
|
||||
url = "/$service/user/$user/post/$id"
|
||||
name = title
|
||||
date_upload = dateFormat.parse(edited ?: published ?: added)?.time ?: 0
|
||||
date_upload = postDate?.time ?: 0
|
||||
name = title.ifBlank {
|
||||
val postDateString = when {
|
||||
postDate != null && postDate.time != 0L -> chapterNameDateFormat.format(postDate)
|
||||
else -> "unknown date"
|
||||
}
|
||||
|
||||
"Post from $postDateString"
|
||||
}
|
||||
chapter_number = -2f
|
||||
}
|
||||
|
||||
companion object {
|
||||
val dateFormat by lazy { getApiDateFormat() }
|
||||
val chapterNameDateFormat by lazy { getChapterNameDateFormat() }
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,3 +98,6 @@ class KemonoAttachmentDto(val name: String, val path: String) {
|
||||
|
||||
private fun getApiDateFormat() =
|
||||
SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.ENGLISH)
|
||||
|
||||
private fun getChapterNameDateFormat() =
|
||||
SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss", Locale.ENGLISH)
|
||||
|
@ -4,9 +4,13 @@ import generator.ThemeSourceData.SingleLang
|
||||
import generator.ThemeSourceGenerator
|
||||
|
||||
class KemonoGenerator : ThemeSourceGenerator {
|
||||
|
||||
override val themeClass = "Kemono"
|
||||
|
||||
override val themePkg = "kemono"
|
||||
override val baseVersionCode = 4
|
||||
|
||||
override val baseVersionCode = 5
|
||||
|
||||
override val sources = listOf(
|
||||
SingleLang("Kemono", "https://kemono.party", "all", isNsfw = true),
|
||||
SingleLang("Coomer", "https://coomer.party", "all", isNsfw = true)
|
||||
|
Loading…
x
Reference in New Issue
Block a user