Skip to content

Commit 6cedd11

Browse files
Stypoxhaggaie
andcommitted
Add StreamHistoryEntry.toStreamInfoItem()
Co-authored-by: Haggai Eran <haggai.eran@gmail.com>
1 parent 5eabcb5 commit 6cedd11

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

app/src/main/java/org/schabi/newpipe/database/history/model/StreamHistoryEntry.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package org.schabi.newpipe.database.history.model
33
import androidx.room.ColumnInfo
44
import androidx.room.Embedded
55
import org.schabi.newpipe.database.stream.model.StreamEntity
6+
import org.schabi.newpipe.extractor.stream.StreamInfoItem
7+
import org.schabi.newpipe.util.image.ImageStrategy
68
import java.time.OffsetDateTime
79

810
data class StreamHistoryEntry(
@@ -27,4 +29,17 @@ data class StreamHistoryEntry(
2729
return this.streamEntity.uid == other.streamEntity.uid && streamId == other.streamId &&
2830
accessDate.isEqual(other.accessDate)
2931
}
32+
33+
fun toStreamInfoItem(): StreamInfoItem =
34+
StreamInfoItem(
35+
streamEntity.serviceId,
36+
streamEntity.url,
37+
streamEntity.title,
38+
streamEntity.streamType,
39+
).apply {
40+
duration = streamEntity.duration
41+
uploaderName = streamEntity.uploader
42+
uploaderUrl = streamEntity.uploaderUrl
43+
thumbnails = ImageStrategy.dbUrlToImageList(streamEntity.thumbnailUrl)
44+
}
3045
}

0 commit comments

Comments
 (0)