sends extract_info events to progress hooks
This commit is contained in:
parent
cb1fa58813
commit
a0abd85b85
@ -408,6 +408,10 @@ class YoutubeDL(object):
|
|||||||
self._pps.append(pp)
|
self._pps.append(pp)
|
||||||
pp.set_downloader(self)
|
pp.set_downloader(self)
|
||||||
|
|
||||||
|
def _hook_progress(self, status):
|
||||||
|
for ph in self._progress_hooks:
|
||||||
|
ph(status)
|
||||||
|
|
||||||
def add_progress_hook(self, ph):
|
def add_progress_hook(self, ph):
|
||||||
"""Add the progress hook (currently only for the file downloader)"""
|
"""Add the progress hook (currently only for the file downloader)"""
|
||||||
self._progress_hooks.append(ph)
|
self._progress_hooks.append(ph)
|
||||||
@ -680,6 +684,10 @@ class YoutubeDL(object):
|
|||||||
'entries': ie_result,
|
'entries': ie_result,
|
||||||
}
|
}
|
||||||
self.add_default_extra_info(ie_result, ie, url)
|
self.add_default_extra_info(ie_result, ie, url)
|
||||||
|
self._hook_progress({
|
||||||
|
'status': 'extract_info',
|
||||||
|
'ie_result': ie_result,
|
||||||
|
})
|
||||||
if process:
|
if process:
|
||||||
return self.process_ie_result(ie_result, download, extra_info)
|
return self.process_ie_result(ie_result, download, extra_info)
|
||||||
else:
|
else:
|
||||||
@ -1575,8 +1583,7 @@ class YoutubeDL(object):
|
|||||||
try:
|
try:
|
||||||
def dl(name, info):
|
def dl(name, info):
|
||||||
fd = get_suitable_downloader(info, self.params)(self, self.params)
|
fd = get_suitable_downloader(info, self.params)(self, self.params)
|
||||||
for ph in self._progress_hooks:
|
fd.add_progress_hook(self._hook_progress)
|
||||||
fd.add_progress_hook(ph)
|
|
||||||
if self.params.get('verbose'):
|
if self.params.get('verbose'):
|
||||||
self.to_stdout('[debug] Invoking downloader on %r' % info.get('url'))
|
self.to_stdout('[debug] Invoking downloader on %r' % info.get('url'))
|
||||||
return fd.download(name, info)
|
return fd.download(name, info)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user