From a6c82662c1189d5c66c3446803549295a48baf7d Mon Sep 17 00:00:00 2001 From: Bnyro Date: Thu, 28 Dec 2023 18:25:52 +0100 Subject: [PATCH] fix: don't auto-add live videos to the playing queue --- app/src/main/java/com/github/libretube/api/obj/StreamItem.kt | 2 ++ app/src/main/java/com/github/libretube/util/PlayingQueue.kt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/libretube/api/obj/StreamItem.kt b/app/src/main/java/com/github/libretube/api/obj/StreamItem.kt index 76ad4f2f7..4965101e3 100644 --- a/app/src/main/java/com/github/libretube/api/obj/StreamItem.kt +++ b/app/src/main/java/com/github/libretube/api/obj/StreamItem.kt @@ -24,6 +24,8 @@ data class StreamItem( val shortDescription: String? = null, val isShort: Boolean = false ) : Parcelable { + val isLive get() = (duration ?: 0L) < 0L + fun toLocalPlaylistItem(playlistId: String): LocalPlaylistItem { return LocalPlaylistItem( playlistId = playlistId.toInt(), diff --git a/app/src/main/java/com/github/libretube/util/PlayingQueue.kt b/app/src/main/java/com/github/libretube/util/PlayingQueue.kt index 9ba41587a..e8e46d123 100644 --- a/app/src/main/java/com/github/libretube/util/PlayingQueue.kt +++ b/app/src/main/java/com/github/libretube/util/PlayingQueue.kt @@ -212,7 +212,7 @@ object PlayingQueue { // don't add new videos to the queue if the user chose to repeat only the current queue if (isLast() && repeatMode == Player.REPEAT_MODE_ALL) return - add(*streams.toTypedArray(), skipExisting = true) + add(*streams.filter { !it.isLive }.toTypedArray(), skipExisting = true) } fun onQueueItemSelected(index: Int) {