pull/32/head
kunfei 5 years ago
parent 6bcb3aed81
commit 41d2fafc66
  1. 14
      app/src/main/java/io/legado/app/data/entities/rule/BookListRule.kt
  2. 22
      app/src/main/java/io/legado/app/data/entities/rule/ExploreRule.kt
  3. 22
      app/src/main/java/io/legado/app/data/entities/rule/SearchRule.kt
  4. 25
      app/src/main/java/io/legado/app/model/webbook/BookList.kt

@ -0,0 +1,14 @@
package io.legado.app.data.entities.rule
interface BookListRule {
var bookList: String?
var name: String?
var author: String?
var intro: String?
var kind: String?
var lastChapter: String?
var updateTime: String?
var bookUrl: String?
var coverUrl: String?
var wordCount: String?
}

@ -2,14 +2,14 @@ package io.legado.app.data.entities.rule
data class ExploreRule(
var exploreUrl: String? = null,
var bookList: String? = null,
var name: String? = null,
var author: String? = null,
var intro: String? = null,
var kind: String? = null,
var lastChapter: String? = null,
var updateTime: String? = null,
var bookUrl: String? = null,
var coverUrl: String? = null,
var wordCount: String? = null
)
override var bookList: String? = null,
override var name: String? = null,
override var author: String? = null,
override var intro: String? = null,
override var kind: String? = null,
override var lastChapter: String? = null,
override var updateTime: String? = null,
override var bookUrl: String? = null,
override var coverUrl: String? = null,
override var wordCount: String? = null
) : BookListRule

@ -2,14 +2,14 @@ package io.legado.app.data.entities.rule
data class SearchRule(
var searchUrl: String? = null,
var bookList: String? = null,
var name: String? = null,
var author: String? = null,
var intro: String? = null,
var kind: String? = null,
var lastChapter: String? = null,
var updateTime: String? = null,
var bookUrl: String? = null,
var coverUrl: String? = null,
var wordCount: String? = null
)
override var bookList: String? = null,
override var name: String? = null,
override var author: String? = null,
override var intro: String? = null,
override var kind: String? = null,
override var lastChapter: String? = null,
override var updateTime: String? = null,
override var bookUrl: String? = null,
override var coverUrl: String? = null,
override var wordCount: String? = null
) : BookListRule

@ -37,6 +37,31 @@ class BookList {
}
return bookList
}
}
val collections: List<Any>
var reverse = false
var allInOne = false
val bookListRule = if (isSearch) bookSource.getSearchRule() else bookSource.getExploreRule()
var ruleList = bookListRule.bookList ?: ""
if (ruleList.startsWith("-")) {
reverse = true
ruleList = ruleList.substring(1)
}
if (ruleList.startsWith(":")) {
ruleList = ruleList.substring(1)
}
if (ruleList.startsWith("+")) {
allInOne = true
ruleList = ruleList.substring(1)
}
collections = analyzer.getElements(ruleList)
if (collections.isEmpty() && bookSource.bookUrlPattern.isNullOrEmpty()) {
getItem(analyzer, bookSource, baseUrl)?.let { searchBook ->
searchBook.bookInfoHtml = body
bookList.add(searchBook)
}
} else {
}
return bookList
}

Loading…
Cancel
Save