Merge remote-tracking branch 'origin/master'

pull/32/head
Administrator 5 years ago
commit 3328980791
  1. 16
      app/src/main/java/io/legado/app/model/webbook/BookInfo.kt

@ -29,27 +29,43 @@ object BookInfo {
analyzeRule.setContent(body) analyzeRule.setContent(body)
infoRule.init?.let { infoRule.init?.let {
if (it.isNotEmpty()) { if (it.isNotEmpty()) {
SourceDebug.printLog(bookSource.bookSourceUrl, 1, "执行详情页初始化规则")
analyzeRule.setContent(analyzeRule.getElement(it)) analyzeRule.setContent(analyzeRule.getElement(it))
} }
} }
SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取书名")
analyzeRule.getString(infoRule.name ?: "")?.let { analyzeRule.getString(infoRule.name ?: "")?.let {
if (it.isNotEmpty()) book.name = it if (it.isNotEmpty()) book.name = it
} }
SourceDebug.printLog(bookSource.bookSourceUrl, 1, book.name ?: "")
SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取作者")
analyzeRule.getString(infoRule.author ?: "")?.let { analyzeRule.getString(infoRule.author ?: "")?.let {
if (it.isNotEmpty()) book.author = it if (it.isNotEmpty()) book.author = it
} }
SourceDebug.printLog(bookSource.bookSourceUrl, 1, book.author ?: "")
SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取分类")
analyzeRule.getString(infoRule.kind ?: "")?.let { analyzeRule.getString(infoRule.kind ?: "")?.let {
if (it.isNotEmpty()) book.kind = it if (it.isNotEmpty()) book.kind = it
} }
SourceDebug.printLog(bookSource.bookSourceUrl, 1, book.kind ?: "")
SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取简介")
analyzeRule.getString(infoRule.intro ?: "")?.let { analyzeRule.getString(infoRule.intro ?: "")?.let {
if (it.isNotEmpty()) book.intro = it if (it.isNotEmpty()) book.intro = it
} }
SourceDebug.printLog(bookSource.bookSourceUrl, 1, book.intro ?: "", isHtml = true)
SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取字数")
analyzeRule.getString(infoRule.wordCount ?: "")?.let { analyzeRule.getString(infoRule.wordCount ?: "")?.let {
if (it.isNotEmpty()) book.wordCount = it if (it.isNotEmpty()) book.wordCount = it
} }
SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取最新章节")
analyzeRule.getString(infoRule.lastChapter ?: "")?.let { analyzeRule.getString(infoRule.lastChapter ?: "")?.let {
if (it.isNotEmpty()) book.latestChapterTitle = it if (it.isNotEmpty()) book.latestChapterTitle = it
} }
SourceDebug.printLog(bookSource.bookSourceUrl, 1, book.latestChapterTitle ?: "")
SourceDebug.printLog(bookSource.bookSourceUrl, 1, "获取目录Url")
book.tocUrl = analyzeRule.getString(infoRule.tocUrl ?: "", true) ?: baseUrl
if (book.tocUrl.isEmpty()) book.tocUrl = baseUrl
SourceDebug.printLog(bookSource.bookSourceUrl, 1, book.tocUrl)
} }
} }
Loading…
Cancel
Save