diff --git a/app/download.py b/app/download.py index 1495b5d..d4050b4 100644 --- a/app/download.py +++ b/app/download.py @@ -2,9 +2,6 @@ import os, yt_dlp, json, requests, re, logging from bs4 import BeautifulSoup from urllib.parse import urlsplit -# Setup logging -logging.basicConfig(filename='/data/logs/syllabus.log', level=logging.INFO, - format='%(asctime)s - %(levelname)s - %(message)s') logger = logging.getLogger(__name__) # Define the hook function @@ -200,6 +197,7 @@ class dropout(): filename_template = f"{show} - S00E{episode_number} - %(title)s.%(ext)s" dl_opts = { + 'progress_hooks': [my_hook], 'format': 'bestvideo+bestaudio/best', 'audio_quality': '256K', 'paths': { @@ -252,7 +250,7 @@ class dropout(): class youtube(): def ydl(url, location): - dl_ops = {'paths': {'temp': '/temp', 'home': location}, 'outtmpl': '%(uploader)s/%(title)s.%(ext)s'} + dl_ops = {'progress_hooks': [my_hook],'paths': {'temp': '/temp', 'home': location}, 'outtmpl': '%(uploader)s/%(title)s.%(ext)s'} if dl_ops['paths']['home'] == '/podcasts': dl_ops['format'] = 'bestaudio/best[ext=mp3]' dl_ops['postprocessors'] = [{