mirror of https://github.com/TeamNewPipe/NewPipe
43 lines
1.3 KiB
Kotlin
43 lines
1.3 KiB
Kotlin
package org.schabi.newpipe.database.stream
|
|
|
|
import androidx.room.ColumnInfo
|
|
import androidx.room.Embedded
|
|
import org.schabi.newpipe.database.LocalItem
|
|
import org.schabi.newpipe.database.history.model.StreamHistoryEntity
|
|
import org.schabi.newpipe.database.stream.model.StreamEntity
|
|
import org.schabi.newpipe.extractor.stream.StreamInfoItem
|
|
import java.util.*
|
|
|
|
class StreamStatisticsEntry(
|
|
@Embedded
|
|
val streamEntity: StreamEntity,
|
|
|
|
@ColumnInfo(name = StreamHistoryEntity.JOIN_STREAM_ID)
|
|
val streamId: Long,
|
|
|
|
@ColumnInfo(name = STREAM_LATEST_DATE)
|
|
val latestAccessDate: Date,
|
|
|
|
@ColumnInfo(name = STREAM_WATCH_COUNT)
|
|
val watchCount: Long
|
|
) : LocalItem {
|
|
|
|
fun toStreamInfoItem(): StreamInfoItem {
|
|
val item = StreamInfoItem(streamEntity.serviceId, streamEntity.url, streamEntity.title, streamEntity.streamType)
|
|
item.duration = streamEntity.duration
|
|
item.uploaderName = streamEntity.uploader
|
|
item.thumbnailUrl = streamEntity.thumbnailUrl
|
|
|
|
return item
|
|
}
|
|
|
|
override fun getLocalItemType(): LocalItem.LocalItemType {
|
|
return LocalItem.LocalItemType.STATISTIC_STREAM_ITEM
|
|
}
|
|
|
|
companion object {
|
|
const val STREAM_LATEST_DATE = "latestAccess"
|
|
const val STREAM_WATCH_COUNT = "watchCount"
|
|
}
|
|
}
|