-
Notifications
You must be signed in to change notification settings - Fork 136
/
HanimeDownloadEntity.kt
76 lines (70 loc) · 1.3 KB
/
HanimeDownloadEntity.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package com.yenaly.han1meviewer.logic.entity
import androidx.annotation.IntRange
import androidx.room.Entity
import androidx.room.PrimaryKey
/**
* @project Han1meViewer
* @author Yenaly Liew
* @time 2023/08/18 018 21:50
*/
@Entity
data class HanimeDownloadEntity(
/**
* 封面地址
*/
var coverUrl: String,
/**
* 影片标题
*/
var title: String,
/**
* 添加日期
*/
var addDate: Long,
/**
* 影片代码
*/
var videoCode: String,
/**
* 影片存储在本地的位置
*/
var videoUri: String,
/**
* 影片质量
*/
var quality: String,
/**
* 影片下载地址
*/
var videoUrl: String,
/**
* 影片长度
*/
var length: Long,
/**
* 影片已下载长度
*/
var downloadedLength: Long,
/**
* 是否正在下载
*/
var isDownloading: Boolean = false,
@PrimaryKey(autoGenerate = true)
var id: Int = 0,
) {
/**
* 下载进度
*/
@get:IntRange(from = 0, to = 100)
val progress get() = (downloadedLength * 100 / length).toInt()
/**
* 是否已下载完成
*/
val isDownloaded get() = downloadedLength == length
/**
* 排序方式
*/
enum class SortedBy {
ID, TITLE
}
}