[downloader] Pass info_dict to progress_hooks

This commit is contained in:
pukkandan
2021-07-21 22:58:43 +05:30
parent 29b208f6f9
commit 3ba7740dd8
13 changed files with 36 additions and 28 deletions

View File

@@ -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