LibreTube/app/src/main/java/com/github/libretube/database/DatabaseHelper.kt

24 lines
687 B
Kotlin
Raw Normal View History

2022-08-13 23:34:07 +05:30
package com.github.libretube.database
import com.github.libretube.obj.Streams
import com.github.libretube.obj.WatchHistoryItem
import com.github.libretube.util.toID
object DatabaseHelper {
fun addToWatchHistory(videoId: String, streams: Streams) {
val watchHistoryItem = WatchHistoryItem(
videoId,
streams.title,
streams.uploadDate,
streams.uploader,
streams.uploaderUrl.toID(),
streams.uploaderAvatar,
streams.thumbnailUrl,
streams.duration
)
2022-08-13 23:41:56 +05:30
Thread {
DatabaseHolder.database.watchHistoryDao().insertAll(watchHistoryItem)
}.start()
2022-08-13 23:34:07 +05:30
}
}