替换规则添加作用于标题和作用于正文

pull/1606/head
kunfei 3 years ago
parent edf5890cb1
commit b592d338ca
  1. 1557
      app/schemas/io.legado.app.data.AppDatabase/44.json
  2. 6
      app/src/main/java/io/legado/app/data/AppDatabase.kt
  3. 4
      app/src/main/java/io/legado/app/data/entities/Book.kt
  4. 21
      app/src/main/java/io/legado/app/data/entities/ReplaceRule.kt

File diff suppressed because it is too large Load Diff

@ -1,6 +1,7 @@
package io.legado.app.data package io.legado.app.data
import android.content.Context import android.content.Context
import androidx.room.AutoMigration
import androidx.room.Database import androidx.room.Database
import androidx.room.Room import androidx.room.Room
import androidx.room.RoomDatabase import androidx.room.RoomDatabase
@ -16,13 +17,14 @@ val appDb by lazy {
} }
@Database( @Database(
version = 43, version = 44,
exportSchema = true, exportSchema = true,
entities = [Book::class, BookGroup::class, BookSource::class, BookChapter::class, entities = [Book::class, BookGroup::class, BookSource::class, BookChapter::class,
ReplaceRule::class, SearchBook::class, SearchKeyword::class, Cookie::class, ReplaceRule::class, SearchBook::class, SearchKeyword::class, Cookie::class,
RssSource::class, Bookmark::class, RssArticle::class, RssReadRecord::class, RssSource::class, Bookmark::class, RssArticle::class, RssReadRecord::class,
RssStar::class, TxtTocRule::class, ReadRecord::class, HttpTTS::class, Cache::class, RssStar::class, TxtTocRule::class, ReadRecord::class, HttpTTS::class, Cache::class,
RuleSub::class] RuleSub::class],
autoMigrations = [AutoMigration(from = 43, to = 44)]
) )
abstract class AppDatabase : RoomDatabase() { abstract class AppDatabase : RoomDatabase() {

@ -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 本地书籍文件名
override var name: String = "", // 书籍名称(书源获取) override var name: String = "", // 书籍名称(书源获取)
override 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(书源获取)

@ -18,14 +18,33 @@ import java.util.regex.PatternSyntaxException
data class ReplaceRule( data class ReplaceRule(
@PrimaryKey(autoGenerate = true) @PrimaryKey(autoGenerate = true)
var id: Long = System.currentTimeMillis(), var id: Long = System.currentTimeMillis(),
//名称
@ColumnInfo(defaultValue = "")
var name: String = "", var name: String = "",
//分组
var group: String? = null, var group: String? = null,
//替换内容
@ColumnInfo(defaultValue = "")
var pattern: String = "", var pattern: String = "",
//替换为
@ColumnInfo(defaultValue = "")
var replacement: String = "", var replacement: String = "",
//作用范围
var scope: String? = null, var scope: String? = null,
//作用于标题
@ColumnInfo(defaultValue = "0")
var scopeTitle: Boolean = false,
//作用于正文
@ColumnInfo(defaultValue = "1")
var scopeContent: Boolean = true,
//是否启用
@ColumnInfo(defaultValue = "1")
var isEnabled: Boolean = true, var isEnabled: Boolean = true,
//是否正则
@ColumnInfo(defaultValue = "1")
var isRegex: Boolean = true, var isRegex: Boolean = true,
@ColumnInfo(name = "sortOrder") //排序
@ColumnInfo(name = "sortOrder", defaultValue = "0")
var order: Int = 0 var order: Int = 0
) : Parcelable { ) : Parcelable {

Loading…
Cancel
Save