aboutsummaryrefslogtreecommitdiffstats
path: root/hypervideo_dl/postprocessor/exec.py
diff options
context:
space:
mode:
Diffstat (limited to 'hypervideo_dl/postprocessor/exec.py')
-rw-r--r--hypervideo_dl/postprocessor/exec.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/hypervideo_dl/postprocessor/exec.py b/hypervideo_dl/postprocessor/exec.py
index 7a3cb49..c0bd6df 100644
--- a/hypervideo_dl/postprocessor/exec.py
+++ b/hypervideo_dl/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:
@@ -38,5 +40,10 @@ class ExecPP(PostProcessor):
return [], info
-class ExecAfterDownloadPP(ExecPP): # for backward compatibility
- pass
+# Deprecated
+class ExecAfterDownloadPP(ExecPP):
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self.deprecation_warning(
+ 'hypervideo_dl.postprocessor.ExecAfterDownloadPP is deprecated '
+ 'and may be removed in a future version. Use hypervideo_dl.postprocessor.ExecPP instead')