From e7a30164390e2b007641063b1647b8960d6df5d6 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 13 Jul 2019 09:09:11 +0800 Subject: [PATCH] up --- .../io/legado/app/data/entities/SearchBook.kt | 21 ++++++++++--------- .../io/legado/app/model/webbook/BookList.kt | 16 +++++++++++++- 2 files changed, 26 insertions(+), 11 deletions(-) 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 fc71d6dd8..379b4dc85 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 @@ -14,17 +14,18 @@ import kotlinx.android.parcel.Parcelize @Parcelize @Entity(tableName = "searchBooks", indices = [(Index(value = ["descUrl"], unique = true))]) data class SearchBook( - @PrimaryKey + @PrimaryKey var descUrl: String = "", - var origin: String = "", // 书源规则id(默认-1,表示本地书籍) - var name: String? = null, - var author: String? = null, - var tag: String? = null, - var coverUrl: String? = null, - var description: String? = null, - var latestChapterTitle: String? = null, - var time: Long = 0L, - var variable: String? = null + var origin: String = "", // 书源规则id(默认-1,表示本地书籍) + var name: String? = null, + var author: String? = null, + var tag: String? = null, + var coverUrl: String? = null, + var description: String? = null, + var latestChapterTitle: String? = null, + var time: Long = 0L, + var variable: String? = null, + var bookInfoHtml: String? = null ) : Parcelable, BaseBook { @IgnoredOnParcel 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 90149e689..c75fe3abe 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 @@ -29,7 +29,21 @@ class BookList { ) val analyzer = AnalyzeRule(null) analyzer.setContent(body, baseUrl) - + bookSource.bookUrlPattern?.let { + if (baseUrl.matches(it.toRegex())) { + getItem()?.let { searchBook -> + searchBook.bookInfoHtml = body + bookList.add(searchBook) + } + return bookList + } + } return bookList } + + fun getItem(): SearchBook? { + val searchBook = SearchBook() + + return null + } } \ No newline at end of file