From 2ee6f8493ec951b11263533ad67c96d7450b8053 Mon Sep 17 00:00:00 2001 From: GiviMAD Date: Tue, 24 May 2022 22:29:40 +0200 Subject: [PATCH] [jellyfin] fix multiple sessions for device and update deps (#12794) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miguel Álvarez Díez --- bundles/org.openhab.binding.jellyfin/pom.xml | 32 +++++++++++-------- .../handler/JellyfinServerHandler.java | 2 +- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/bundles/org.openhab.binding.jellyfin/pom.xml b/bundles/org.openhab.binding.jellyfin/pom.xml index 45d630456..af0b68d52 100644 --- a/bundles/org.openhab.binding.jellyfin/pom.xml +++ b/bundles/org.openhab.binding.jellyfin/pom.xml @@ -36,82 +36,86 @@ io.ktor ktor-client-core-jvm - 1.6.7 + 1.6.8 compile io.ktor ktor-client-cio-jvm - 1.6.7 + 1.6.8 compile io.ktor ktor-http-jvm - 1.6.7 + 1.6.8 compile io.ktor ktor-http-cio-jvm - 1.6.7 + 1.6.8 compile io.ktor ktor-network-jvm - 1.6.7 + 1.6.8 compile io.ktor ktor-utils-jvm - 1.6.7 + 1.6.8 compile io.ktor ktor-io-jvm - 1.6.7 + 1.6.8 compile io.ktor ktor-network-tls-jvm - 1.6.7 + 1.6.8 compile org.jetbrains.kotlin kotlin-stdlib - 1.6.10 + 1.6.21 compile org.jetbrains.kotlinx kotlinx-coroutines-core-jvm - 1.5.2 + 1.6.1 compile org.jetbrains.kotlinx kotlinx-coroutines-jdk8 - 1.5.2 + 1.6.1 + compile org.jetbrains.kotlinx kotlinx-serialization-core-jvm - 1.3.1 + 1.3.3 + compile org.jetbrains.kotlinx kotlinx-serialization-json-jvm - 1.3.1 + 1.3.3 + compile io.github.microutils kotlin-logging-jvm - 2.1.16 + 2.1.23 + compile diff --git a/bundles/org.openhab.binding.jellyfin/src/main/java/org/openhab/binding/jellyfin/internal/handler/JellyfinServerHandler.java b/bundles/org.openhab.binding.jellyfin/src/main/java/org/openhab/binding/jellyfin/internal/handler/JellyfinServerHandler.java index 5e0a3aefd..38947a58f 100644 --- a/bundles/org.openhab.binding.jellyfin/src/main/java/org/openhab/binding/jellyfin/internal/handler/JellyfinServerHandler.java +++ b/bundles/org.openhab.binding.jellyfin/src/main/java/org/openhab/binding/jellyfin/internal/handler/JellyfinServerHandler.java @@ -383,7 +383,7 @@ public class JellyfinServerHandler extends BaseBridgeHandler { @Nullable SessionInfo clientSession = sessions.stream() .filter(session -> Objects.equals(session.getDeviceId(), handler.getThing().getUID().getId())) - .findFirst().orElse(null); + .sorted((a, b) -> b.getLastActivityDate().compareTo(a.getLastActivityDate())).findFirst().orElse(null); handler.updateStateFromSession(clientSession); }