Merge branch 'antecer' of https://github.com/gedoor/legado into antecer

pull/23/head
Antecer 6 years ago
commit f073ebd428
  1. 2
      app/src/main/java/io/legado/app/data/dao/BookDao.kt
  2. 4
      app/src/main/java/io/legado/app/data/entities/Chapter.kt
  3. 27
      app/src/main/java/io/legado/app/data/entities/Source.kt

@ -13,7 +13,7 @@ interface BookDao {
@Query("SELECT * FROM books WHERE `group` = :group") @Query("SELECT * FROM books WHERE `group` = :group")
fun observeByGroup(group: Int): DataSource.Factory<Int, Book> fun observeByGroup(group: Int): DataSource.Factory<Int, Book>
@Query("SELECT url FROM books WHERE `group` = :group") @Query("SELECT descUrl FROM books WHERE `group` = :group")
fun observeUrlsByGroup(group: Int): LiveData<List<String>> fun observeUrlsByGroup(group: Int): LiveData<List<String>>
} }

@ -2,6 +2,7 @@ package io.legado.app.data.entities
import android.os.Parcelable import android.os.Parcelable
import androidx.room.Entity import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.Index import androidx.room.Index
import androidx.room.PrimaryKey import androidx.room.PrimaryKey
import kotlinx.android.parcel.Parcelize import kotlinx.android.parcel.Parcelize
@ -9,9 +10,8 @@ import kotlinx.android.parcel.Parcelize
@Parcelize @Parcelize
@Entity(tableName = "chapters", @Entity(tableName = "chapters",
indices = [(Index(value = ["url"]))]) indices = [(Index(value = ["feedId", "feedLink"], unique = true))])
data class Chapter(@PrimaryKey data class Chapter(@PrimaryKey
var url: String = "",
var name: String = "", var name: String = "",
var bookUrl: String = "", var bookUrl: String = "",
var index: Int = 0, var index: Int = 0,

@ -1,2 +1,29 @@
package io.legado.app.data.entities 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
Loading…
Cancel
Save