diff --git a/downloader.py b/downloader.py index 1303494..0c3a2e8 100755 --- a/downloader.py +++ b/downloader.py @@ -409,7 +409,7 @@ while True: # logger.error(f"{result['video_id']} - Failed due to error.") for line in result['logger_msg']: - log_info_twice(line) + log_info_twice(f"{result['video_id']} - {line}") playlist_bar.update() else: status_bar.write(f"All videos already downloaded for '{playlist['title']}'.") diff --git a/process/threads.py b/process/threads.py index fd59fbb..1edfef4 100644 --- a/process/threads.py +++ b/process/threads.py @@ -110,17 +110,18 @@ def download_video(args) -> dict: try: base_path = os.path.splitext(unidecode(yt_dlp.prepare_filename(video)))[0] - video['outtmpl'] = f"{kwargs['output_path']}/{ydl.get_output_templ(title=unidecode(video['title']), uploader=unidecode(video['uploader']))}" # clean the filename + video['outtmpl'] = f"{kwargs['output_dir']}/{ydl.get_output_templ(title=unidecode(video['title']), uploader=unidecode(video['uploader']))}" # clean the filename except AttributeError: # Sometimes we won't be able to pull the video info so just use the video's ID. base_path = kwargs['output_dir'] / video['id'] + video['outtmpl'] = f"{kwargs['output_dir']}/{ydl.get_output_templ()}" ylogger = ytdl_logger(setup_file_logger(video['id'], str(base_path) + '.log')) kwargs['ydl_opts']['logger'] = ylogger yt_dlp = ydl.YDL(kwargs['ydl_opts']) # recreate the object with the correct logging path error_code = yt_dlp(video['url']) # Do the download if not error_code: elapsed = round(math.ceil(time.time() - start_time) / 60, 2) - output_dict['logger_msg'].append(f"{video['id']} '{video['title']}' downloaded in {elapsed} min.") + output_dict['logger_msg'].append(f"'{video['title']}' - Downloaded in {elapsed} min.") output_dict['downloaded_video_id'] = video['id'] else: output_dict['video_critical_err_msg'] = output_dict['video_critical_err_msg'] + ylogger.errors