From 295e7430244bbaa7776f215d8ddc8079095b90f5 Mon Sep 17 00:00:00 2001 From: unknown <89595418+unknownsrc@users.noreply.github.com> Date: Fri, 10 Mar 2023 20:29:19 +0100 Subject: [PATCH] adding auto downloading checking --- utils/auto.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utils/auto.js b/utils/auto.js index c8d9d84..a40b94b 100644 --- a/utils/auto.js +++ b/utils/auto.js @@ -34,6 +34,12 @@ async function handleDownload(channelId) { }) if (already) continue + if (await redis.get(id)) { + logger.info({ message: `Someone is already downloading ${video.title}, ${id}` }) + continue + } + + await redis.set(id, 'downloading') logger.info({ message: `Starting to download ${video.title}, ${id}` }) const download = await ytdlp.downloadVideo('https://www.youtube.com' + video.url)