1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-09-03 00:25:08 +00:00

Allow --exec to be run at any post-processing stage

Deprecates `--exec-before-download`
This commit is contained in:
pukkandan
2022-01-03 16:43:54 +05:30
parent ca30f449a1
commit 1e43a6f733
6 changed files with 52 additions and 45 deletions

View File

@ -22,11 +22,13 @@ class ExecPP(PostProcessor):
if tmpl_dict: # if there are no replacements, tmpl_dict = {}
return self._downloader.escape_outtmpl(tmpl) % tmpl_dict
# If no replacements are found, replace {} for backard compatibility
if '{}' not in cmd:
cmd += ' {}'
return cmd.replace('{}', compat_shlex_quote(
info.get('filepath') or info['_filename']))
filepath = info.get('filepath', info.get('_filename'))
# If video, and no replacements are found, replace {} for backard compatibility
if filepath:
if '{}' not in cmd:
cmd += ' {}'
cmd = cmd.replace('{}', compat_shlex_quote(filepath))
return cmd
def run(self, info):
for tmpl in self.exec_cmd: