This commit is contained in:
parent
0ac436663f
commit
f3877911a8
|
@ -189,14 +189,14 @@ for i, target_url in tqdm(enumerate(url_list), total=len(url_list), position=0,
|
|||
|
||||
log_info_twice(f"Downloading item: '{playlist['title']}' {target_url}")
|
||||
|
||||
playlist_bar.total = len(download_queue)
|
||||
playlist_bar.total = len(playlist['entries'])
|
||||
playlist_bar.set_description(playlist['title'])
|
||||
|
||||
# Remove already downloaded files from the to-do list.
|
||||
for p, video in enumerate(download_queue):
|
||||
if video['id'] in downloaded_videos:
|
||||
del download_queue[p]
|
||||
playlist_bar.update(len(download_queue))
|
||||
playlist_bar.update(len(downloaded_videos))
|
||||
|
||||
if len(download_queue): # Don't mess with multiprocessing if all videos are already downloaded
|
||||
with Pool(processes=args.threads) as pool:
|
||||
|
@ -208,8 +208,6 @@ for i, target_url in tqdm(enumerate(url_list), total=len(url_list), position=0,
|
|||
'download_archive': downloaded_videos,
|
||||
'ydl_opts': thread_opts,
|
||||
}) for video in download_queue)):
|
||||
print(result)
|
||||
|
||||
# Save the video ID to the file
|
||||
if result['downloaded_video_id']:
|
||||
download_archive_logger.info(result['downloaded_video_id'])
|
||||
|
|
|
@ -40,10 +40,7 @@ def download_video(args) -> dict:
|
|||
video = args[0]
|
||||
kwargs = args[1]
|
||||
bars = kwargs['bars']
|
||||
|
||||
ydl_opts = kwargs['ydl_opts']
|
||||
ydl_opts['progress_hooks'] = [progress_hook]
|
||||
yt_dlp = ydl.YDL(ydl_opts)
|
||||
|
||||
# Get a bar
|
||||
locked = False
|
||||
|
@ -56,6 +53,9 @@ def download_video(args) -> dict:
|
|||
offset = item[0]
|
||||
bar_lock = item[1]
|
||||
break
|
||||
ydl_opts['progress_hooks'] = [progress_hook]
|
||||
|
||||
yt_dlp = ydl.YDL(ydl_opts)
|
||||
|
||||
desc_with = int(np.round(os.get_terminal_size()[0] * (1 / 4)))
|
||||
bar = tqdm(total=100, position=(offset if locked else None), desc=video['title'].ljust(desc_with)[:desc_with], bar_format='{l_bar}{bar}| {n_fmt}/{total_fmt} [{elapsed}<{remaining}{postfix}]', leave=False, disable=not len(bars))
|
||||
|
|
Reference in New Issue