diff --git a/app/download.py b/app/download.py index 880cf43..806a880 100644 --- a/app/download.py +++ b/app/download.py @@ -1,7 +1,13 @@ -import os, yt_dlp, json, requests, re +import os, yt_dlp, json, requests, re, logging from bs4 import BeautifulSoup from urllib.parse import urlsplit +logger = logging.getLogger(__name__) + +# Define the hook function +def my_hook(d): + if d['status'] == 'finished': + logging.info(f"Download completed: {d['filename']}") def ebook(url, author): destination = f"/ebooks/{author}" @@ -118,6 +124,7 @@ class dropout(): filename_template = f"{show} - S{int(season):02}E{episode_number} - %(title)s.%(ext)s" dl_opts = { + 'progress_hooks': [my_hook], 'format': 'bestvideo+bestaudio/best', 'audio_quality': '256K', 'paths': {