Skip to content

Commit a75c41b

Browse files
committed
StreamHistoryEntry: convert to StreamInfoItem
Can be used to play history items.
1 parent 069cdf6 commit a75c41b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

+11
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ 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
67
import java.time.OffsetDateTime
78

89
data class StreamHistoryEntry(
@@ -27,4 +28,14 @@ data class StreamHistoryEntry(
2728
return this.streamEntity.uid == other.streamEntity.uid && streamId == other.streamId &&
2829
accessDate.isEqual(other.accessDate)
2930
}
31+
32+
fun toStreamInfoItem(): StreamInfoItem {
33+
val item = StreamInfoItem(streamEntity.serviceId, streamEntity.url, streamEntity.title, streamEntity.streamType)
34+
item.duration = streamEntity.duration
35+
item.uploaderName = streamEntity.uploader
36+
item.uploaderUrl = streamEntity.uploaderUrl
37+
item.thumbnailUrl = streamEntity.thumbnailUrl
38+
39+
return item
40+
}
3041
}

0 commit comments

Comments
 (0)