@get:{bookName}可以获取书名

pull/373/head^2
gedoor 4 years ago
parent c2cff4ce1a
commit 6b8e92ea8a
  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
interface BaseBook {
var name: String
var author: String
var bookUrl: String
val variableMap: HashMap<String, String>
var kind: String?

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

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

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

Loading…
Cancel
Save