diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-01-03 16:43:54 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-01-03 19:40:02 +0530 |
commit | 1e43a6f7336f4d9691dc52a1bc7cfe14ba7a936d (patch) | |
tree | 218655a09fd54a9c51f4db1d5bb7564c633b6f3e /yt_dlp/postprocessor/exec.py | |
parent | ca30f449a187addcdb99f4c39333e7a292756597 (diff) | |
download | hypervideo-pre-1e43a6f7336f4d9691dc52a1bc7cfe14ba7a936d.tar.lz hypervideo-pre-1e43a6f7336f4d9691dc52a1bc7cfe14ba7a936d.tar.xz hypervideo-pre-1e43a6f7336f4d9691dc52a1bc7cfe14ba7a936d.zip |
Allow `--exec` to be run at any post-processing stage
Deprecates `--exec-before-download`
Diffstat (limited to 'yt_dlp/postprocessor/exec.py')
-rw-r--r-- | yt_dlp/postprocessor/exec.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/yt_dlp/postprocessor/exec.py b/yt_dlp/postprocessor/exec.py index 28a7c3d70..63f4d23f2 100644 --- a/yt_dlp/postprocessor/exec.py +++ b/yt_dlp/postprocessor/exec.py @@ -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: |