From f7024dc0ef396870dcd74a1965b48aa8baec5537 Mon Sep 17 00:00:00 2001 From: Cyberes Date: Sun, 22 Jan 2023 12:40:46 -0700 Subject: [PATCH] todo items --- downloader.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/downloader.py b/downloader.py index 6127f11..1385a07 100755 --- a/downloader.py +++ b/downloader.py @@ -77,6 +77,8 @@ if args.daemon: log_dir = args.output / 'logs' create_directories(args.output, log_dir) +# TODO: log file rotation https://www.blog.pythonlibrary.org/2014/02/11/python-how-to-create-rotating-logs/ +# TODO: log to one file instead of one for each run file_logger = setup_file_logger('youtube_dl', log_dir / f'youtube_dl-{str(int(log_time))}.log', level=logging.INFO) video_error_logger = setup_file_logger('youtube_dl_video_errors', log_dir / f'youtube_dl-errors-{int(log_time)}.log', level=logging.INFO) logger = get_silent_logger('yt-dl', silent=not args.daemon) @@ -229,9 +231,10 @@ while True: if len(download_queue): # Don't mess with multiprocessing if all videos are already downloaded with Pool(processes=args.threads) as pool: - # Doesn't work if not connected to a terminal if sys.stdout.isatty(): - status_bar.set_description_str('=' * os.get_terminal_size()[0]) # OSError: [Errno 25] Inappropriate ioctl for device + # Doesn't work if not connected to a terminal: + # OSError: [Errno 25] Inappropriate ioctl for device + status_bar.set_description_str('=' * os.get_terminal_size()[0]) logger.info('Starting downloads...') for result in pool.imap_unordered(download_video, ((video, {