diff --git a/app/src/main/java/io/legado/app/data/entities/Book.kt b/app/src/main/java/io/legado/app/data/entities/Book.kt index e207f8c03..2be672dd2 100644 --- a/app/src/main/java/io/legado/app/data/entities/Book.kt +++ b/app/src/main/java/io/legado/app/data/entities/Book.kt @@ -5,16 +5,20 @@ import androidx.room.* import kotlinx.android.parcel.Parcelize @Parcelize -@Entity(tableName = "books", indices = [(Index(value = ["descUrl"]))]) +@Entity(tableName = "books", indices = [(Index(value = ["descUrl"], unique = true))]) data class Book(@PrimaryKey var descUrl: String = "", // 详情页Url(本地书源存储完整文件路径) var sourceId: Int = -1, // 书源规则id(默认-1,表示本地书籍) - var name: String = "", // 书籍名称(允许用户修改,适用于本地书籍) - var author: String? = null, // 作者名称(允许用户修改,适用于本地书籍) - var tag: String? = null, // 分类信息(允许用户修改,适用于本地书籍) - var coverUrl: String? = null, // 封面Url - var customCoverUrl: String? = null, // 自定义封面Url(允许用户修改,适用于网络和本地书籍) - var description: String? = null, // 简介内容(允许用户修改,适用于网络和本地书籍) + var name: String = "", // 书籍名称(书源获取) + var customName: String = "", // 书籍名称(用户修改) + var author: String? = null, // 作者名称(书源获取) + var customAuthor: String? = null, // 作者名称(用户修改) + var tag: String? = null, // 分类信息(书源获取) + var customTag: String? = null, // 分类信息(用户修改) + var coverUrl: String? = null, // 封面Url(书源获取) + var customCoverUrl: String? = null, // 封面Url(用户修改) + var description: String? = null, // 简介内容(书源获取) + var customDescription: String? = null, // 简介内容(用户修改) var charset: String? = null, // 自定义字符集名称(仅适用于本地书籍) var type: Int = 0, // 0: 文本读物, 1: 有声读物 var group: Int = 0, // 自定义分组索引号 diff --git a/app/src/main/java/io/legado/app/data/entities/ReplaceRule.kt b/app/src/main/java/io/legado/app/data/entities/ReplaceRule.kt index fdfa41d3f..2436fb641 100644 --- a/app/src/main/java/io/legado/app/data/entities/ReplaceRule.kt +++ b/app/src/main/java/io/legado/app/data/entities/ReplaceRule.kt @@ -16,8 +16,8 @@ data class ReplaceRule( val pattern: String? = null, val replacement: String? = null, val scope: String? = null, - val isEnabled: Boolean? = null, - val isRegex: Boolean? = null, + val isEnabled: Boolean = true, + val isRegex: Boolean = true, val order: Int = 0 ) : Parcelable 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 1c6cfcf18..aa38236b5 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 @@ -14,14 +14,14 @@ data class Source(@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "sourceId") var id: Int = 0, // 编号 var name: String = "", // 名称 - var origin: String = "", // 地址,包括 http/https + var origin: String = "", // 地址,包括 http/https var type: Int = 0, // 类型,0 文本,1 音频 var group: String? = null, // 分组 var header: String? = null, // header var loginUrl: String? = null, // 登录地址 var isEnabled: Boolean = true, // 是否启用 var lastUpdateTime: Long = 0, // 最后更新时间,用于排序 - var serialNumber: Int = 0, // 手动排序编号 + var customOrder: Int = 0, // 手动排序编号 var weight: Int = 0, // 智能排序的权重 var exploreRule: String? = null, // 发现规则 var searchRule: String? = null, // 搜索规则