From e2321915e03841e1fc80d40481af50134bcf2c31 Mon Sep 17 00:00:00 2001 From: Wizzard Date: Mon, 5 Feb 2024 00:27:33 -0500 Subject: [PATCH] Added logging --- main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.py b/main.py index 9a0eaee..6d3a797 100644 --- a/main.py +++ b/main.py @@ -5,6 +5,10 @@ import yt_dlp as youtube_dl from config import DISCORD_BOT_TOKEN, DISCORD_CHANNEL_ID, YOUTUBE_CHANNEL_IDS import os +import logging + +logging.basicConfig(level=logging.INFO) + intents = discord.Intents.default() intents.messages = True intents.guilds = True @@ -20,6 +24,7 @@ ydl_opts = { } downloaded_videos_file = 'downloaded_videos.txt' + def get_downloaded_videos(): if not os.path.exists(downloaded_videos_file): return set() @@ -38,8 +43,10 @@ def get_latest_video_url(channel_id): @tasks.loop(minutes=10) async def check_new_videos(): + logging.info("Checking new videos...") downloaded_videos = get_downloaded_videos() for channel_id in YOUTUBE_CHANNEL_IDS: + logging.info(f"Checking channel: {channel_id}") video_url, video_id = get_latest_video_url(channel_id) if video_url and video_id not in downloaded_videos: with youtube_dl.YoutubeDL(ydl_opts) as ydl: