Merge remote-tracking branch 'origin/master'

pull/373/head
Celeter 4 years ago
commit 3586505f14
  1. 2
      app/src/main/java/io/legado/app/data/entities/BaseBook.kt
  2. 4
      app/src/main/java/io/legado/app/data/entities/Book.kt
  3. 4
      app/src/main/java/io/legado/app/data/entities/SearchBook.kt
  4. 10
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt

@ -3,6 +3,8 @@ package io.legado.app.data.entities
import io.legado.app.utils.splitNotBlank import io.legado.app.utils.splitNotBlank
interface BaseBook { interface BaseBook {
var name: String
var author: String
var bookUrl: String var bookUrl: String
val variableMap: HashMap<String, String> val variableMap: HashMap<String, String>
var kind: String? var kind: String?

@ -29,8 +29,8 @@ data class Book(
var tocUrl: String = "", // 目录页Url (toc=table of Contents) var tocUrl: String = "", // 目录页Url (toc=table of Contents)
var origin: String = BookType.local, // 书源URL(默认BookType.local) var origin: String = BookType.local, // 书源URL(默认BookType.local)
var originName: String = "", //书源名称 or 本地书籍文件名 var originName: String = "", //书源名称 or 本地书籍文件名
var name: String = "", // 书籍名称(书源获取) override var name: String = "", // 书籍名称(书源获取)
var author: String = "", // 作者名称(书源获取) override var author: String = "", // 作者名称(书源获取)
override var kind: String? = null, // 分类信息(书源获取) override var kind: String? = null, // 分类信息(书源获取)
var customTag: String? = null, // 分类信息(用户修改) var customTag: String? = null, // 分类信息(用户修改)
var coverUrl: String? = null, // 封面Url(书源获取) var coverUrl: String? = null, // 封面Url(书源获取)

@ -25,8 +25,8 @@ data class SearchBook(
var origin: String = "", // 书源规则 var origin: String = "", // 书源规则
var originName: String = "", var originName: String = "",
var type: Int = 0, // @BookType var type: Int = 0, // @BookType
var name: String = "", override var name: String = "",
var author: String = "", override var author: String = "",
override var kind: String? = null, override var kind: String? = null,
var coverUrl: String? = null, var coverUrl: String? = null,
var intro: String? = null, var intro: String? = null,

@ -580,9 +580,13 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions {
} }
fun get(key: String): String { fun get(key: String): String {
val chapter = chapter when (key) {
if (chapter != null && key == "title") { "bookName" -> book?.let {
return chapter.title return it.name
}
"title" -> chapter?.let {
return it.title
}
} }
return chapter?.variableMap?.get(key) return chapter?.variableMap?.get(key)
?: book?.variableMap?.get(key) ?: book?.variableMap?.get(key)

Loading…
Cancel
Save