diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-07-21 22:58:43 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-07-22 04:30:11 +0530 |
commit | 3ba7740dd841ebcfe8f47612eac30d3b470fa93d (patch) | |
tree | 3c7df3c6d545e2d9b5006b66d807cee3501068ba /yt_dlp/downloader/common.py | |
parent | 29b208f6f9cc7b1c33d32c960e71f4b27eaa1d77 (diff) |
[downloader] Pass `info_dict` to `progress_hook`s
Diffstat (limited to 'yt_dlp/downloader/common.py')
-rw-r--r-- | yt_dlp/downloader/common.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/yt_dlp/downloader/common.py b/yt_dlp/downloader/common.py index 9bf7eef3b..9f0d3c7bf 100644 --- a/yt_dlp/downloader/common.py +++ b/yt_dlp/downloader/common.py @@ -1,5 +1,6 @@ from __future__ import division, unicode_literals +import copy import os import re import sys @@ -360,7 +361,7 @@ class FileDownloader(object): 'filename': filename, 'status': 'finished', 'total_bytes': os.path.getsize(encodeFilename(filename)), - }) + }, info_dict) return True, False if subtitle is False: @@ -388,9 +389,14 @@ class FileDownloader(object): """Real download process. Redefine in subclasses.""" raise NotImplementedError('This method must be implemented by subclasses') - def _hook_progress(self, status): + def _hook_progress(self, status, info_dict): + if not self._progress_hooks: + return + info_dict = dict(info_dict) + for key in ('__original_infodict', '__postprocessors'): + info_dict.pop(key, None) for ph in self._progress_hooks: - ph(status) + ph({**status, 'info_dict': copy.deepcopy(info_dict)}) def add_progress_hook(self, ph): # See YoutubeDl.py (search for progress_hooks) for a description of |