Skip to content

Commit

Permalink
StreamHistoryEntry: convert to StreamInfoItem
Browse files Browse the repository at this point in the history
Can be used to play history items.
  • Loading branch information
haggaie committed Feb 27, 2023
1 parent 940f990 commit 43935e2
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.schabi.newpipe.database.history.model
import androidx.room.ColumnInfo
import androidx.room.Embedded
import org.schabi.newpipe.database.stream.model.StreamEntity
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import java.time.OffsetDateTime

data class StreamHistoryEntry(
Expand All @@ -27,4 +28,14 @@ data class StreamHistoryEntry(
return this.streamEntity.uid == other.streamEntity.uid && streamId == other.streamId &&
accessDate.isEqual(other.accessDate)
}

fun toStreamInfoItem(): StreamInfoItem {
val item = StreamInfoItem(streamEntity.serviceId, streamEntity.url, streamEntity.title, streamEntity.streamType)
item.duration = streamEntity.duration
item.uploaderName = streamEntity.uploader
item.uploaderUrl = streamEntity.uploaderUrl
item.thumbnailUrl = streamEntity.thumbnailUrl

return item
}
}

0 comments on commit 43935e2

Please sign in to comment.