From 0d9ba162bbdf143991dd42220997eccfafea5915 Mon Sep 17 00:00:00 2001 From: atbest Date: Wed, 22 May 2019 23:37:08 -0400 Subject: [PATCH 1/4] Added source entity --- .../io/legado/app/data/entities/Source.kt | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) 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 feecd7295..5bac00ac0 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 @@ -1,2 +1,29 @@ package io.legado.app.data.entities +import android.os.Parcelable +import androidx.room.Entity +import androidx.room.Index +import androidx.room.PrimaryKey +import kotlinx.android.parcel.Parcelize + +@Parcelize +@Entity(tableName = "sources", + indices = [(Index(value = ["id"]))]) +data class Source(@PrimaryKey + var id: Int = 0, // 编号 + var host: String = "", // 地址,包括 http/https + var name: String = "", // 名称 + 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 weight: Int = 0, // 智能排序的权重 + var exploreRule: String? = null, // 发现规则 + var searchRule: String? = null, // 搜索规则 + var bookInfoRule: String? = null, // 书籍信息页规则 + var tocRule: String? = null, // 目录页规则 + var contentRule: String? = null // 正文页规则 + ) : Parcelable \ No newline at end of file From 10736d66d457ba3a7fc6f4860178c66fd606f263 Mon Sep 17 00:00:00 2001 From: GKF Date: Thu, 23 May 2019 12:16:18 +0800 Subject: [PATCH 2/4] descUrl --- app/src/main/java/io/legado/app/data/dao/BookDao.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/data/dao/BookDao.kt b/app/src/main/java/io/legado/app/data/dao/BookDao.kt index b6ad0ba40..6e71ae680 100644 --- a/app/src/main/java/io/legado/app/data/dao/BookDao.kt +++ b/app/src/main/java/io/legado/app/data/dao/BookDao.kt @@ -13,7 +13,7 @@ interface BookDao { @Query("SELECT * FROM books WHERE `group` = :group") fun observeByGroup(group: Int): DataSource.Factory - @Query("SELECT url FROM books WHERE `group` = :group") + @Query("SELECT descUrl FROM books WHERE `group` = :group") fun observeUrlsByGroup(group: Int): LiveData> } \ No newline at end of file From 8addb9a6875a0d9ba3c32bd3d7299f219a5995d1 Mon Sep 17 00:00:00 2001 From: atbest Date: Thu, 23 May 2019 00:50:27 -0400 Subject: [PATCH 3/4] Updated Chapter class --- app/src/main/java/io/legado/app/data/entities/Chapter.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/data/entities/Chapter.kt b/app/src/main/java/io/legado/app/data/entities/Chapter.kt index b5ba5bf93..f69bb4ac0 100644 --- a/app/src/main/java/io/legado/app/data/entities/Chapter.kt +++ b/app/src/main/java/io/legado/app/data/entities/Chapter.kt @@ -2,6 +2,7 @@ package io.legado.app.data.entities import android.os.Parcelable import androidx.room.Entity +import androidx.room.ForeignKey import androidx.room.Index import androidx.room.PrimaryKey import kotlinx.android.parcel.Parcelize @@ -9,9 +10,8 @@ import kotlinx.android.parcel.Parcelize @Parcelize @Entity(tableName = "chapters", - indices = [(Index(value = ["url"]))]) + indices = [(Index(value = ["feedId", "feedLink"], unique = true))]) data class Chapter(@PrimaryKey - var url: String = "", var name: String = "", var bookUrl: String = "", var index: Int = 0, From 2b11ac66647774b202d93dd9b7dc9ac608ce2577 Mon Sep 17 00:00:00 2001 From: Antecer Date: Thu, 23 May 2019 13:02:46 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0Book=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/data/entities/Book.kt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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 543bd5101..d9879a223 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 @@ -13,23 +13,23 @@ data class Book(@PrimaryKey var author: String? = null, // 作者名称(允许用户修改,适用于本地书籍) var tag: String? = null, // 分类信息(允许用户修改,适用于本地书籍) var coverUrl: String? = null, // 封面Url - var customCoverUrl: String? = null, // 自定义封面Url - var description: String? = null, // 简介内容 + var customCoverUrl: String? = null, // 自定义封面Url(允许用户修改,适用于网络和本地书籍) + var description: String? = null, // 简介内容(允许用户修改,适用于网络和本地书籍) var charset: String? = null, // 自定义字符集名称(仅适用于本地书籍) var type: Int = 0, // 0: 文本读物, 1: 有声读物 var group: Int = 0, // 自定义分组索引号 var tocUrl: String = "", // 目录页Url (toc=table of Contents) var latestChapterName: String? = null, // 最新章节 var lastCheckTime: Long? = null, // 最近一次更新书籍信息的时间 + var hasNewChapter: Boolean = false, // 最近一次更新书籍信息时是否发现新章节 var latestChapterTime: Long? = null, // 最近一次发现新章节的时间 - var lastUpdateChapters: Int = 0, // 最近一次发现新章节的数量 - var durChapterName: String = "", // 当前阅读的章节名称 - var durChapterIndex: Int = 0, // 当前阅读的章节分页索引 - var durChapterPage: Int = 0, // 当前阅读的章节总分页数 - var durChapterTime: Long = 0, // 最后一次阅读书籍的时间(打开正文的时间) + var latestCheckCount: Int = 0, // 最近一次发现新章节的数量 var totalChapterNum: Int = 0, // 书籍目录总数 - var hasNewChapter: Boolean = false, // 是否在最后一次更新书籍信息时找到新章节 - var allowUpdate: Boolean = true, // 是否允许阅读自动管理更新书籍信息 + var durChapterName: String = "", // 当前章节名称 + var durChapterIndex: Int = 0, // 当前章节索引 + var durChapterMark: Int = 0, // 当前阅读的进度(首行字符的索引位置) + var durChapterTime: Long = 0, // 最近一次阅读书籍的时间(打开正文的时间) + var canUpdate: Boolean = true, // 刷新书架时更新书籍信息 var variable: String? = null // 自定义书籍变量信息(用于书源规则检索书籍信息) ) : Parcelable {