From 8b0e86726d9fb0ac92297b10d13887ff0fa964bb Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 15 Jul 2019 09:52:55 +0800 Subject: [PATCH] up --- .../main/java/io/legado/app/data/AppDatabase.kt | 3 ++- .../java/io/legado/app/model/webbook/BookList.kt | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/data/AppDatabase.kt b/app/src/main/java/io/legado/app/data/AppDatabase.kt index e54d6c663..5c62c01dc 100644 --- a/app/src/main/java/io/legado/app/data/AppDatabase.kt +++ b/app/src/main/java/io/legado/app/data/AppDatabase.kt @@ -11,7 +11,8 @@ import io.legado.app.data.entities.* @Database( - entities = [Book::class, BookGroup::class, BookSource::class, BookChapter::class, ReplaceRule::class, SearchBook::class, SearchKeyword::class, SourceCookie::class], + entities = [Book::class, BookGroup::class, BookSource::class, BookChapter::class, ReplaceRule::class, SearchBook::class, + SearchKeyword::class, SourceCookie::class], version = 1, exportSchema = true ) 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 480778959..14fd3001f 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 @@ -74,7 +74,7 @@ class BookList { } } else { for (item in collections) { - getSearchItem(analyzer, bookListRule, bookSource, baseUrl)?.let { searchBook -> + getSearchItem(item, analyzer, bookListRule, bookSource, baseUrl)?.let { searchBook -> if (baseUrl == searchBook.bookUrl) { searchBook.bookInfoHtml = body } @@ -126,11 +126,14 @@ class BookList { searchBook.coverUrl = nativeObject[bookListRule.coverUrl]?.toString() searchBook.intro = nativeObject[bookListRule.intro]?.toString() searchBook.kind = nativeObject[bookListRule.kind]?.toString() + + return searchBook } return null } private fun getSearchItem( + item: Any, analyzeRule: AnalyzeRule, bookListRule: BookListRule, bookSource: BookSource, @@ -139,8 +142,16 @@ class BookList { val searchBook = SearchBook() searchBook.origin = bookSource.bookSourceUrl searchBook.originName = bookSource.bookSourceName + analyzeRule.setBook(searchBook) + analyzeRule.setContent(item) + searchBook.name = analyzeRule.getString(bookListRule.name ?: "") + searchBook.name?.let { + searchBook.author = analyzeRule.getString(bookListRule.author ?: "") + searchBook.kind = analyzeRule.getString(bookListRule.kind ?: "") + searchBook.intro = analyzeRule.getString(bookListRule.intro ?: "") - + return searchBook + } return null } } \ No newline at end of file