From 87bf0374fff4e2786b0f50002e451591b0af25e1 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 14 Jul 2019 11:44:02 +0800 Subject: [PATCH] up --- .../io/legado/app/model/webbook/BookList.kt | 43 +++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) 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 c1212aed7..8a2e3806d 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 @@ -4,6 +4,7 @@ import io.legado.app.App import io.legado.app.R import io.legado.app.data.entities.BookSource import io.legado.app.data.entities.SearchBook +import io.legado.app.data.entities.rule.BookListRule import io.legado.app.model.analyzeRule.AnalyzeRule import io.legado.app.model.analyzeRule.AnalyzeUrl import io.legado.app.utils.NetworkUtils @@ -31,7 +32,7 @@ class BookList { analyzer.setContent(body, baseUrl) bookSource.bookUrlPattern?.let { if (baseUrl.matches(it.toRegex())) { - getItem(analyzer, bookSource, baseUrl)?.let { searchBook -> + getInfoItem(analyzer, bookSource, baseUrl)?.let { searchBook -> searchBook.bookInfoHtml = body bookList.add(searchBook) } @@ -56,17 +57,27 @@ class BookList { } collections = analyzer.getElements(ruleList) if (collections.isEmpty() && bookSource.bookUrlPattern.isNullOrEmpty()) { - getItem(analyzer, bookSource, baseUrl)?.let { searchBook -> + getInfoItem(analyzer, bookSource, baseUrl)?.let { searchBook -> searchBook.bookInfoHtml = body bookList.add(searchBook) } } else { + if (allInOne) { + for (item in collections) { + getAllInOneItem(analyzer, bookListRule, bookSource)?.let { + } + } + } else { + for (item in collections) { + + } + } } return bookList } - private fun getItem(analyzeRule: AnalyzeRule, bookSource: BookSource, baseUrl: String): SearchBook? { + private fun getInfoItem(analyzeRule: AnalyzeRule, bookSource: BookSource, baseUrl: String): SearchBook? { val searchBook = SearchBook() searchBook.bookUrl = baseUrl searchBook.origin = bookSource.bookSourceUrl @@ -88,4 +99,30 @@ class BookList { } return null } + + private fun getAllInOneItem( + analyzeRule: AnalyzeRule, + bookListRule: BookListRule, + bookSource: BookSource + ): SearchBook? { + val searchBook = SearchBook() + searchBook.origin = bookSource.bookSourceUrl + searchBook.originName = bookSource.bookSourceName + + + return null + } + + private fun getSearchItem( + analyzeRule: AnalyzeRule, + bookListRule: BookListRule, + bookSource: BookSource + ): SearchBook? { + val searchBook = SearchBook() + searchBook.origin = bookSource.bookSourceUrl + searchBook.originName = bookSource.bookSourceName + + + return null + } } \ No newline at end of file