Added rules

pull/32/head
atbest 6 years ago
parent 18c649c2ab
commit 70f872f074
  1. 5
      app/src/main/java/io/legado/app/data/entities/Rule.kt
  2. 2
      app/src/main/java/io/legado/app/data/entities/Source.kt
  3. 8
      app/src/main/java/io/legado/app/data/entities/rule/BaseRule.kt
  4. 11
      app/src/main/java/io/legado/app/data/entities/rule/BookInfoRule.kt
  5. 9
      app/src/main/java/io/legado/app/data/entities/rule/ChapterRule.kt
  6. 6
      app/src/main/java/io/legado/app/data/entities/rule/ContentRule.kt
  7. 11
      app/src/main/java/io/legado/app/data/entities/rule/ExploreRule.kt
  8. 7
      app/src/main/java/io/legado/app/data/entities/rule/PutRule.kt
  9. 19
      app/src/main/java/io/legado/app/data/entities/rule/Rule.kt
  10. 11
      app/src/main/java/io/legado/app/data/entities/rule/SearchRule.kt

@ -1,5 +0,0 @@
package io.legado.app.data.entities
class Rule {
}

@ -26,6 +26,6 @@ data class Source(@PrimaryKey(autoGenerate = true)
var exploreRule: String? = null, // 发现规则
var searchRule: String? = null, // 搜索规则
var bookInfoRule: String? = null, // 书籍信息页规则
var tocRule: String? = null, // 目录页规则
var chapterRule: String? = null, // 目录页规则
var contentRule: String? = null // 正文页规则
) : Parcelable

@ -0,0 +1,8 @@
package io.legado.app.data.entities.rule
data class BaseRule(
var selector: String,
var template: String?,
var attr: String?,
var type: RuleType
)

@ -0,0 +1,11 @@
package io.legado.app.data.entities.rule
data class BookInfoRule (
var name: Rule,
var author: Rule,
var desc: Rule,
var meta: Rule,
var updateTime: Rule,
var tocUrl: Rule,
var store: List<PutRule>
)

@ -0,0 +1,9 @@
package io.legado.app.data.entities.rule
data class ChapterRule (
var chapterList: Rule,
var title: Rule,
var contentUrl: Rule,
var resourceUrl: Rule,
var isAllInOne: Boolean = false
)

@ -0,0 +1,6 @@
package io.legado.app.data.entities.rule
data class ContentRule (
var fulltext: Rule,
var resourceUrl: Rule
)

@ -0,0 +1,11 @@
package io.legado.app.data.entities.rule
data class ExploreRule (
var bookList: Rule,
var name: Rule,
var author: Rule,
var desc: Rule,
var meta: Rule,
var bookUrl: Rule,
var store: PutRule
)

@ -0,0 +1,7 @@
package io.legado.app.data.entities.rule
data class PutRule (
var selector: BaseRule,
var type: RuleType,
var key: String
)

@ -0,0 +1,19 @@
package io.legado.app.data.entities.rule
data class Rule (
var selectors: List<BaseRule>,
var mode: RuleMode,
var type: RuleType,
var regex: String?,
var replacement: String?,
var javascript: String?,
var extra: String?
)
enum class RuleMode {
FIRST, ALL, CROSS
}
enum class RuleType {
CSS, XPATH, JSON, REGEX, CONST, JS, HYBRID
}

@ -0,0 +1,11 @@
package io.legado.app.data.entities.rule
data class SearchRule (
var bookList: Rule,
var name: Rule,
var author: Rule,
var desc: Rule,
var meta: Rule,
var bookUrl: Rule,
var store: List<PutRule>
)
Loading…
Cancel
Save