From 35e9106bccf9502d773320344af3adbc643d9bf3 Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 15 Jul 2019 15:30:14 +0800 Subject: [PATCH] up --- .../io/legado/app/data/entities/SearchBook.kt | 1 + .../io/legado/app/model/webbook/BookInfo.kt | 24 +++++++++++++++++++ .../io/legado/app/model/webbook/BookList.kt | 5 +++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/data/entities/SearchBook.kt b/app/src/main/java/io/legado/app/data/entities/SearchBook.kt index dd04cf238..8b76eea87 100644 --- a/app/src/main/java/io/legado/app/data/entities/SearchBook.kt +++ b/app/src/main/java/io/legado/app/data/entities/SearchBook.kt @@ -23,6 +23,7 @@ data class SearchBook( var kind: String? = null, var coverUrl: String? = null, var intro: String? = null, + var wordCount: String? = null, var latestChapterTitle: String? = null, var time: Long = 0L, var variable: String? = null, diff --git a/app/src/main/java/io/legado/app/model/webbook/BookInfo.kt b/app/src/main/java/io/legado/app/model/webbook/BookInfo.kt index 9bc05a2e0..edcb2e1ed 100644 --- a/app/src/main/java/io/legado/app/model/webbook/BookInfo.kt +++ b/app/src/main/java/io/legado/app/model/webbook/BookInfo.kt @@ -1,5 +1,29 @@ package io.legado.app.model.webbook +import io.legado.app.App +import io.legado.app.R +import io.legado.app.data.entities.Book +import io.legado.app.data.entities.BookSource +import io.legado.app.model.analyzeRule.AnalyzeUrl + object BookInfo { + @Throws(Exception::class) + fun analyzeBookInfo( + book: Book, + body: String?, + bookSource: BookSource, + analyzeUrl: AnalyzeUrl, + isSearch: Boolean = true + ) { + val baseUrl = analyzeUrl.url + body ?: throw Exception( + App.INSTANCE.getString( + R.string.get_web_content_error, + baseUrl + ) + ) + + } + } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/model/webbook/BookList.kt b/app/src/main/java/io/legado/app/model/webbook/BookList.kt index 72ed43060..3c71fd711 100644 --- a/app/src/main/java/io/legado/app/model/webbook/BookList.kt +++ b/app/src/main/java/io/legado/app/model/webbook/BookList.kt @@ -103,6 +103,8 @@ object BookList { searchBook.intro = analyzeRule.getString(intro ?: "") searchBook.latestChapterTitle = analyzeRule.getString(lastChapter ?: "") searchBook.kind = analyzeRule.getString(kind ?: "") + searchBook.wordCount = analyzeRule.getString(wordCount ?: "") + return searchBook } } @@ -126,7 +128,7 @@ object BookList { searchBook.coverUrl = nativeObject[bookListRule.coverUrl]?.toString() searchBook.intro = nativeObject[bookListRule.intro]?.toString() searchBook.kind = nativeObject[bookListRule.kind]?.toString() - + searchBook.wordCount = nativeObject[bookListRule.wordCount]?.toString() return searchBook } return null @@ -149,6 +151,7 @@ object BookList { searchBook.author = analyzeRule.getString(bookListRule.author ?: "") searchBook.kind = analyzeRule.getString(bookListRule.kind ?: "") searchBook.intro = analyzeRule.getString(bookListRule.intro ?: "") + searchBook.wordCount = analyzeRule.getString(bookListRule.wordCount ?: "") return searchBook }