diff --git a/src/main/java/me/kavin/piped/server/handlers/ChannelHandlers.java b/src/main/java/me/kavin/piped/server/handlers/ChannelHandlers.java index 4f9903c..130103c 100644 --- a/src/main/java/me/kavin/piped/server/handlers/ChannelHandlers.java +++ b/src/main/java/me/kavin/piped/server/handlers/ChannelHandlers.java @@ -106,7 +106,7 @@ public class ChannelHandlers { .filter(v -> v.getId().equals(id)) .findFirst(); if (video.isPresent()) { - VideoHelpers.updateVideo(s, video.get(), item); + VideoHelpers.updateVideo(s, id, item); } else { VideoHelpers.handleNewVideo("https://youtube.com/watch?v=" + id, time, channel); } diff --git a/src/main/java/me/kavin/piped/utils/DatabaseHelper.java b/src/main/java/me/kavin/piped/utils/DatabaseHelper.java index 3fc778d..e7c92b0 100644 --- a/src/main/java/me/kavin/piped/utils/DatabaseHelper.java +++ b/src/main/java/me/kavin/piped/utils/DatabaseHelper.java @@ -96,6 +96,15 @@ public class DatabaseHelper { } } + public static boolean doesVideoExist(SharedSessionContract s, String id) { + CriteriaBuilder cb = s.getCriteriaBuilder(); + CriteriaQuery