[FFmpegConcat] Abort on --simulate
This commit is contained in:
parent
5625e6073f
commit
ed66a17ef0
2 changed files with 6 additions and 5 deletions
|
@ -103,12 +103,14 @@ class PostProcessor(metaclass=PostProcessorMetaClass):
|
||||||
return getattr(self._downloader, '_copy_infodict', dict)(info_dict)
|
return getattr(self._downloader, '_copy_infodict', dict)(info_dict)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _restrict_to(*, video=True, audio=True, images=True):
|
def _restrict_to(*, video=True, audio=True, images=True, simulated=True):
|
||||||
allowed = {'video': video, 'audio': audio, 'images': images}
|
allowed = {'video': video, 'audio': audio, 'images': images}
|
||||||
|
|
||||||
def decorator(func):
|
def decorator(func):
|
||||||
@functools.wraps(func)
|
@functools.wraps(func)
|
||||||
def wrapper(self, info):
|
def wrapper(self, info):
|
||||||
|
if not simulated and (self.get_param('simulate') or self.get_param('skip_download')):
|
||||||
|
return [], info
|
||||||
format_type = (
|
format_type = (
|
||||||
'video' if info.get('vcodec') != 'none'
|
'video' if info.get('vcodec') != 'none'
|
||||||
else 'audio' if info.get('acodec') != 'none'
|
else 'audio' if info.get('acodec') != 'none'
|
||||||
|
|
|
@ -1145,16 +1145,15 @@ class FFmpegConcatPP(FFmpegPostProcessor):
|
||||||
super().concat_files(in_files, out_file)
|
super().concat_files(in_files, out_file)
|
||||||
return in_files
|
return in_files
|
||||||
|
|
||||||
@PostProcessor._restrict_to(images=False)
|
@PostProcessor._restrict_to(images=False, simulated=False)
|
||||||
def run(self, info):
|
def run(self, info):
|
||||||
entries = info.get('entries') or []
|
entries = info.get('entries') or []
|
||||||
if (self.get_param('skip_download') or not any(entries)
|
if not any(entries) or (self._only_multi_video and info['_type'] != 'multi_video'):
|
||||||
or self._only_multi_video and info['_type'] != 'multi_video'):
|
|
||||||
return [], info
|
return [], info
|
||||||
elif any(len(entry) > 1 for entry in traverse_obj(entries, (..., 'requested_downloads')) or []):
|
elif any(len(entry) > 1 for entry in traverse_obj(entries, (..., 'requested_downloads')) or []):
|
||||||
raise PostProcessingError('Concatenation is not supported when downloading multiple separate formats')
|
raise PostProcessingError('Concatenation is not supported when downloading multiple separate formats')
|
||||||
|
|
||||||
in_files = traverse_obj(entries, (..., 'requested_downloads', 0, 'filepath'))
|
in_files = traverse_obj(entries, (..., 'requested_downloads', 0, 'filepath')) or []
|
||||||
if len(in_files) < len(entries):
|
if len(in_files) < len(entries):
|
||||||
raise PostProcessingError('Aborting concatenation because some downloads failed')
|
raise PostProcessingError('Aborting concatenation because some downloads failed')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue