From 54168b8aa5be39f731d3c5d49aee80dc25474266 Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 14 Nov 2019 20:54:30 +0800 Subject: [PATCH] up --- .../legado/app/model/analyzeRule/AnalyzeRule.kt | 4 ++-- .../legado/app/model/webbook/BookChapterList.kt | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt index 54c579d3f..75b026ab7 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt @@ -337,10 +337,10 @@ class AnalyzeRule(var book: BaseBook? = null) { * 分解规则生成规则列表 */ @Throws(Exception::class) - fun splitSourceRule(ruleStr: String, mode: Mode = Mode.Default): List { + fun splitSourceRule(ruleStr: String?, mode: Mode = Mode.Default): List { var vRuleStr = ruleStr val ruleList = ArrayList() - if (TextUtils.isEmpty(vRuleStr)) return ruleList + if (vRuleStr.isNullOrEmpty()) return ruleList //检测Mode var mMode: Mode = mode when { 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 76ab4278e..229a1266e 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 @@ -154,22 +154,30 @@ object BookChapterList { SourceDebug.printLog(bookSource.bookSourceUrl, "└列表大小:${elements.size}", printLog) if (elements.isNotEmpty()) { SourceDebug.printLog(bookSource.bookSourceUrl, "┌获取首章名称", printLog) - val nameRule = analyzeRule.splitSourceRule(tocRule.chapterName ?: "") - val urlRule = analyzeRule.splitSourceRule(tocRule.chapterUrl ?: "") + val nameRule = analyzeRule.splitSourceRule(tocRule.chapterName) + val urlRule = analyzeRule.splitSourceRule(tocRule.chapterUrl) + val vipRule = analyzeRule.splitSourceRule(tocRule.isVip) + val update = analyzeRule.splitSourceRule(tocRule.updateTime) + var isVip: 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) + isVip = analyzeRule.getString(vipRule) if (bookChapter.url.isEmpty()) bookChapter.url = baseUrl if (bookChapter.title.isNotEmpty()) { + if (isVip.isNotEmpty()) { + bookChapter.title = "\uD83D\uDD12" + bookChapter.title + } chapterList.add(bookChapter) } } SourceDebug.printLog(bookSource.bookSourceUrl, "└${chapterList[0].title}", printLog) - SourceDebug.printLog(bookSource.bookSourceUrl, "┌获取首章链接", printLog) - SourceDebug.printLog(bookSource.bookSourceUrl, "└${chapterList[0].url}", printLog) + SourceDebug.printLog(bookSource.bookSourceUrl, "┌获取首章链接", printLog) + SourceDebug.printLog(bookSource.bookSourceUrl, "└${chapterList[0].url}", printLog) } return ChapterData(chapterList, nextUrlList) }