pull/32/head
kunfei 5 years ago
parent d998c3d5a1
commit 8b0e86726d
  1. 3
      app/src/main/java/io/legado/app/data/AppDatabase.kt
  2. 15
      app/src/main/java/io/legado/app/model/webbook/BookList.kt

@ -11,7 +11,8 @@ import io.legado.app.data.entities.*
@Database( @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, version = 1,
exportSchema = true exportSchema = true
) )

@ -74,7 +74,7 @@ class BookList {
} }
} else { } else {
for (item in collections) { for (item in collections) {
getSearchItem(analyzer, bookListRule, bookSource, baseUrl)?.let { searchBook -> getSearchItem(item, analyzer, bookListRule, bookSource, baseUrl)?.let { searchBook ->
if (baseUrl == searchBook.bookUrl) { if (baseUrl == searchBook.bookUrl) {
searchBook.bookInfoHtml = body searchBook.bookInfoHtml = body
} }
@ -126,11 +126,14 @@ class BookList {
searchBook.coverUrl = nativeObject[bookListRule.coverUrl]?.toString() searchBook.coverUrl = nativeObject[bookListRule.coverUrl]?.toString()
searchBook.intro = nativeObject[bookListRule.intro]?.toString() searchBook.intro = nativeObject[bookListRule.intro]?.toString()
searchBook.kind = nativeObject[bookListRule.kind]?.toString() searchBook.kind = nativeObject[bookListRule.kind]?.toString()
return searchBook
} }
return null return null
} }
private fun getSearchItem( private fun getSearchItem(
item: Any,
analyzeRule: AnalyzeRule, analyzeRule: AnalyzeRule,
bookListRule: BookListRule, bookListRule: BookListRule,
bookSource: BookSource, bookSource: BookSource,
@ -139,8 +142,16 @@ class BookList {
val searchBook = SearchBook() val searchBook = SearchBook()
searchBook.origin = bookSource.bookSourceUrl searchBook.origin = bookSource.bookSourceUrl
searchBook.originName = bookSource.bookSourceName 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 return null
} }
} }
Loading…
Cancel
Save