From 9d8117239f1dbb5ddfe4f0fb6ee68b7aeef4a276 Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Sun, 13 Nov 2022 00:48:12 +0000 Subject: [PATCH] Fix incorrect field. --- .../piped/server/handlers/StreamHandlers.java | 17 ++++++++++++----- .../me/kavin/piped/utils/obj/MatrixHelper.java | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main/java/me/kavin/piped/server/handlers/StreamHandlers.java b/src/main/java/me/kavin/piped/server/handlers/StreamHandlers.java index e25d2c8..e0af9cc 100644 --- a/src/main/java/me/kavin/piped/server/handlers/StreamHandlers.java +++ b/src/main/java/me/kavin/piped/server/handlers/StreamHandlers.java @@ -22,6 +22,7 @@ import org.schabi.newpipe.extractor.stream.StreamInfo; import org.schabi.newpipe.extractor.stream.StreamType; import org.schabi.newpipe.extractor.utils.JsonUtils; +import java.io.IOException; import java.util.List; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @@ -150,11 +151,17 @@ public class StreamHandlers { if (info.getUploadDate() != null && System.currentTimeMillis() - time < TimeUnit.DAYS.toMillis(Constants.FEED_RETENTION)) { VideoHelpers.updateVideo(info.getId(), info, time); - MatrixHelper.sendEvent("video.piped.stream.info", new FederatedVideoInfo( - info.getId(), StringUtils.substring(info.getUploaderUrl(), -24), - info.getName(), - info.getDuration(), info.getViewCount()) - ); + Multithreading.runAsync(() -> { + try { + MatrixHelper.sendEvent("video.piped.stream.info", new FederatedVideoInfo( + info.getId(), StringUtils.substring(info.getUploaderUrl(), -24), + info.getName(), + info.getDuration(), info.getViewCount()) + ); + } catch (IOException e) { + throw new RuntimeException(e); + } + }); } String lbryId; diff --git a/src/main/java/me/kavin/piped/utils/obj/MatrixHelper.java b/src/main/java/me/kavin/piped/utils/obj/MatrixHelper.java index fdccabb..f57a799 100644 --- a/src/main/java/me/kavin/piped/utils/obj/MatrixHelper.java +++ b/src/main/java/me/kavin/piped/utils/obj/MatrixHelper.java @@ -77,7 +77,7 @@ public class MatrixHelper { .put(RequestBody.create(mapper.writeValueAsBytes( mapper.createObjectNode() .put("msgtype", type) - .set("body", mapper.valueToTree(content)) + .set("content", mapper.valueToTree(content)) ), MediaType.get("application/json"))) .build() ).get("event_id").asText();