diff --git a/app/src/main/java/io/legado/app/data/entities/Rule.kt b/app/src/main/java/io/legado/app/data/entities/Rule.kt deleted file mode 100644 index e83807c87..000000000 --- a/app/src/main/java/io/legado/app/data/entities/Rule.kt +++ /dev/null @@ -1,5 +0,0 @@ -package io.legado.app.data.entities - -class Rule { - -} \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/Source.kt b/app/src/main/java/io/legado/app/data/entities/Source.kt index aa38236b5..30e68eac2 100644 --- a/app/src/main/java/io/legado/app/data/entities/Source.kt +++ b/app/src/main/java/io/legado/app/data/entities/Source.kt @@ -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 \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/rule/BaseRule.kt b/app/src/main/java/io/legado/app/data/entities/rule/BaseRule.kt new file mode 100644 index 000000000..6b820a2db --- /dev/null +++ b/app/src/main/java/io/legado/app/data/entities/rule/BaseRule.kt @@ -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 +) diff --git a/app/src/main/java/io/legado/app/data/entities/rule/BookInfoRule.kt b/app/src/main/java/io/legado/app/data/entities/rule/BookInfoRule.kt new file mode 100644 index 000000000..3dea36204 --- /dev/null +++ b/app/src/main/java/io/legado/app/data/entities/rule/BookInfoRule.kt @@ -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 +) \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/rule/ChapterRule.kt b/app/src/main/java/io/legado/app/data/entities/rule/ChapterRule.kt new file mode 100644 index 000000000..d4417ca92 --- /dev/null +++ b/app/src/main/java/io/legado/app/data/entities/rule/ChapterRule.kt @@ -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 +) \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/rule/ContentRule.kt b/app/src/main/java/io/legado/app/data/entities/rule/ContentRule.kt new file mode 100644 index 000000000..18e17eed0 --- /dev/null +++ b/app/src/main/java/io/legado/app/data/entities/rule/ContentRule.kt @@ -0,0 +1,6 @@ +package io.legado.app.data.entities.rule + +data class ContentRule ( + var fulltext: Rule, + var resourceUrl: Rule +) \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/rule/ExploreRule.kt b/app/src/main/java/io/legado/app/data/entities/rule/ExploreRule.kt new file mode 100644 index 000000000..dd444801f --- /dev/null +++ b/app/src/main/java/io/legado/app/data/entities/rule/ExploreRule.kt @@ -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 +) \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/rule/PutRule.kt b/app/src/main/java/io/legado/app/data/entities/rule/PutRule.kt new file mode 100644 index 000000000..1f59fad33 --- /dev/null +++ b/app/src/main/java/io/legado/app/data/entities/rule/PutRule.kt @@ -0,0 +1,7 @@ +package io.legado.app.data.entities.rule + +data class PutRule ( + var selector: BaseRule, + var type: RuleType, + var key: String +) \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/rule/Rule.kt b/app/src/main/java/io/legado/app/data/entities/rule/Rule.kt new file mode 100644 index 000000000..864be7509 --- /dev/null +++ b/app/src/main/java/io/legado/app/data/entities/rule/Rule.kt @@ -0,0 +1,19 @@ +package io.legado.app.data.entities.rule + +data class Rule ( + var selectors: List, + 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 +} \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/rule/SearchRule.kt b/app/src/main/java/io/legado/app/data/entities/rule/SearchRule.kt new file mode 100644 index 000000000..fbcb77da9 --- /dev/null +++ b/app/src/main/java/io/legado/app/data/entities/rule/SearchRule.kt @@ -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 +) \ No newline at end of file