2019-04-28 22:43:52 +02:00
|
|
|
package org.schabi.newpipe.database.playlist
|
|
|
|
|
|
|
|
import androidx.room.ColumnInfo
|
|
|
|
import androidx.room.Embedded
|
|
|
|
import org.schabi.newpipe.database.LocalItem
|
|
|
|
import org.schabi.newpipe.database.playlist.model.PlaylistStreamEntity
|
|
|
|
import org.schabi.newpipe.database.stream.model.StreamEntity
|
|
|
|
import org.schabi.newpipe.extractor.stream.StreamInfoItem
|
|
|
|
|
|
|
|
class PlaylistStreamEntry(
|
2020-05-01 20:13:21 +02:00
|
|
|
@Embedded
|
|
|
|
val streamEntity: StreamEntity,
|
2019-04-28 22:43:52 +02:00
|
|
|
|
2020-05-01 20:13:21 +02:00
|
|
|
@ColumnInfo(name = PlaylistStreamEntity.JOIN_STREAM_ID)
|
|
|
|
val streamId: Long,
|
2019-04-28 22:43:52 +02:00
|
|
|
|
2020-05-01 20:13:21 +02:00
|
|
|
@ColumnInfo(name = PlaylistStreamEntity.JOIN_INDEX)
|
|
|
|
val joinIndex: Int
|
2019-04-28 22:43:52 +02:00
|
|
|
) : LocalItem {
|
|
|
|
|
|
|
|
@Throws(IllegalArgumentException::class)
|
|
|
|
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.PLAYLIST_STREAM_ITEM
|
|
|
|
}
|
|
|
|
}
|