Refactor (See desc)

* Create `FFmpegPostProcessor.real_run_ffmpeg` that can accept multiple input/output files along with switches for each
* Rewrite `cli_configuration_args` and related functions
* Create `YoutubeDL._ensure_dir_exists` - this was previously defined in multiple places
This commit is contained in:
pukkandan
2021-03-09 07:47:21 +05:30
parent ea3a012d2a
commit e92caff5d5
7 changed files with 56 additions and 49 deletions

View File

@@ -91,10 +91,18 @@ class PostProcessor(object):
except Exception:
self.report_warning(errnote)
def _configuration_args(self, *args, **kwargs):
def _configuration_args(self, exe, keys=None, default=[], use_compat=True):
pp_key = self.pp_key().lower()
exe = exe.lower()
root_key = exe if pp_key == exe else '%s+%s' % (pp_key, exe)
keys = ['%s%s' % (root_key, k) for k in (keys or [''])]
if root_key in keys:
keys += [root_key] + ([] if pp_key == exe else [(self.pp_key(), exe)]) + ['default']
else:
use_compat = False
return cli_configuration_args(
self._downloader.params.get('postprocessor_args'),
self.pp_key().lower(), *args, **kwargs)
keys, default, use_compat)
class AudioConversionError(PostProcessingError):