From cdd8a962d7adc2ffae85f3d827bbc6a24ad39726 Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Mon, 4 Jul 2022 06:02:06 +0100 Subject: [PATCH] Avoid duplicate video errors. (#300) --- src/main/java/me/kavin/piped/ServerLauncher.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/kavin/piped/ServerLauncher.java b/src/main/java/me/kavin/piped/ServerLauncher.java index c16f562..16fee7a 100644 --- a/src/main/java/me/kavin/piped/ServerLauncher.java +++ b/src/main/java/me/kavin/piped/ServerLauncher.java @@ -64,8 +64,10 @@ public class ServerLauncher extends MultithreadedHttpServerLauncher { Multithreading.runAsync(() -> { for (var entry : feed.getEntries()) { - ResponseHelper.handleNewVideo(entry.getLinks().get(0).getHref(), - entry.getPublishedDate().getTime(), null); + String url = entry.getLinks().get(0).getHref(); + if (DatabaseHelper.getVideoFromId(StringUtils.substring(url, -11)) != null) + continue; + ResponseHelper.handleNewVideo(url, entry.getPublishedDate().getTime(), null); } });