diff --git a/app/src/main/java/io/legado/app/data/entities/rule/TocRule.kt b/app/src/main/java/io/legado/app/data/entities/rule/TocRule.kt index c484e7226..0d084508f 100644 --- a/app/src/main/java/io/legado/app/data/entities/rule/TocRule.kt +++ b/app/src/main/java/io/legado/app/data/entities/rule/TocRule.kt @@ -6,5 +6,6 @@ data class TocRule( var chapterUrl: String? = null, var isVip: String? = null, var updateTime: String? = null, + var timeFormat: String? = null, var nextTocUrl: String? = null ) \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/model/webbook/BookChapterList.kt b/app/src/main/java/io/legado/app/model/webbook/BookChapterList.kt index 37cfd690c..6fecdb4f9 100644 --- a/app/src/main/java/io/legado/app/model/webbook/BookChapterList.kt +++ b/app/src/main/java/io/legado/app/model/webbook/BookChapterList.kt @@ -11,6 +11,7 @@ import io.legado.app.model.analyzeRule.AnalyzeRule import io.legado.app.model.analyzeRule.AnalyzeUrl import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.withContext +import org.apache.commons.lang3.time.DateUtils object BookChapterList { @@ -159,19 +160,27 @@ object BookChapterList { val vipRule = analyzeRule.splitSourceRule(tocRule.isVip) val update = analyzeRule.splitSourceRule(tocRule.updateTime) var isVip: String? + var timeStr: String for (item in elements) { analyzeRule.setContent(item) val bookChapter = BookChapter(bookUrl = book.bookUrl) analyzeRule.chapter = bookChapter bookChapter.title = analyzeRule.getString(nameRule) bookChapter.url = analyzeRule.getString(urlRule, true) - bookChapter.tag = analyzeRule.getString(update) + timeStr = analyzeRule.getString(update) isVip = analyzeRule.getString(vipRule) if (bookChapter.url.isEmpty()) bookChapter.url = baseUrl if (bookChapter.title.isNotEmpty()) { if (isVip.isNotEmpty() && isVip != "null" && isVip != "false" && isVip != "0") { bookChapter.title = "\uD83D\uDD12" + bookChapter.title } + tocRule.timeFormat?.let { + if (it.isNotEmpty()) { + kotlin.runCatching { + bookChapter.start = DateUtils.parseDate(timeStr, it).time + } + } + } chapterList.add(bookChapter) } }