|
|
@ -231,6 +231,9 @@ class YoutubeDL(object):
|
|
|
|
youtube_dl/postprocessor/__init__.py for a list.
|
|
|
|
youtube_dl/postprocessor/__init__.py for a list.
|
|
|
|
as well as any further keyword arguments for the
|
|
|
|
as well as any further keyword arguments for the
|
|
|
|
postprocessor.
|
|
|
|
postprocessor.
|
|
|
|
|
|
|
|
post_hooks: A list of functions that get called as the final step
|
|
|
|
|
|
|
|
for each video file, after all postprocessors have been
|
|
|
|
|
|
|
|
called. The filename will be passed as the only argument.
|
|
|
|
progress_hooks: A list of functions that get called on download
|
|
|
|
progress_hooks: A list of functions that get called on download
|
|
|
|
progress, with a dictionary with the entries
|
|
|
|
progress, with a dictionary with the entries
|
|
|
|
* status: One of "downloading", "error", or "finished".
|
|
|
|
* status: One of "downloading", "error", or "finished".
|
|
|
@ -347,6 +350,7 @@ class YoutubeDL(object):
|
|
|
|
self._ies = []
|
|
|
|
self._ies = []
|
|
|
|
self._ies_instances = {}
|
|
|
|
self._ies_instances = {}
|
|
|
|
self._pps = []
|
|
|
|
self._pps = []
|
|
|
|
|
|
|
|
self._post_hooks = []
|
|
|
|
self._progress_hooks = []
|
|
|
|
self._progress_hooks = []
|
|
|
|
self._download_retcode = 0
|
|
|
|
self._download_retcode = 0
|
|
|
|
self._num_downloads = 0
|
|
|
|
self._num_downloads = 0
|
|
|
@ -429,6 +433,9 @@ class YoutubeDL(object):
|
|
|
|
pp = pp_class(self, **compat_kwargs(pp_def))
|
|
|
|
pp = pp_class(self, **compat_kwargs(pp_def))
|
|
|
|
self.add_post_processor(pp)
|
|
|
|
self.add_post_processor(pp)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for ph in self.params.get('post_hooks', []):
|
|
|
|
|
|
|
|
self.add_post_hook(ph)
|
|
|
|
|
|
|
|
|
|
|
|
for ph in self.params.get('progress_hooks', []):
|
|
|
|
for ph in self.params.get('progress_hooks', []):
|
|
|
|
self.add_progress_hook(ph)
|
|
|
|
self.add_progress_hook(ph)
|
|
|
|
|
|
|
|
|
|
|
@ -481,6 +488,10 @@ class YoutubeDL(object):
|
|
|
|
self._pps.append(pp)
|
|
|
|
self._pps.append(pp)
|
|
|
|
pp.set_downloader(self)
|
|
|
|
pp.set_downloader(self)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def add_post_hook(self, ph):
|
|
|
|
|
|
|
|
"""Add the post hook"""
|
|
|
|
|
|
|
|
self._post_hooks.append(ph)
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
@ -2011,6 +2022,12 @@ class YoutubeDL(object):
|
|
|
|
except (PostProcessingError) as err:
|
|
|
|
except (PostProcessingError) as err:
|
|
|
|
self.report_error('postprocessing: %s' % str(err))
|
|
|
|
self.report_error('postprocessing: %s' % str(err))
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
for ph in self._post_hooks:
|
|
|
|
|
|
|
|
ph(filename)
|
|
|
|
|
|
|
|
except Exception as err:
|
|
|
|
|
|
|
|
self.report_error('post hooks: %s' % str(err))
|
|
|
|
|
|
|
|
return
|
|
|
|
self.record_download_archive(info_dict)
|
|
|
|
self.record_download_archive(info_dict)
|
|
|
|
|
|
|
|
|
|
|
|
def download(self, url_list):
|
|
|
|
def download(self, url_list):
|
|
|
|