From e078f7d46892e0a40fb6cf55fb0d6072f824aee2 Mon Sep 17 00:00:00 2001 From: joncody Date: Sat, 7 Apr 2018 20:28:03 -0700 Subject: [PATCH] . --- youtube_dl/postprocessor/execafterdownload.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/youtube_dl/postprocessor/execafterdownload.py b/youtube_dl/postprocessor/execafterdownload.py index 24af1d916..08292e123 100644 --- a/youtube_dl/postprocessor/execafterdownload.py +++ b/youtube_dl/postprocessor/execafterdownload.py @@ -18,14 +18,16 @@ class ExecAfterDownloadPP(PostProcessor): def run(self, information): cmd = self.exec_cmd - - # expose info to exec argument - # youtube-dl -x -o "%(playlist_index)s - %(title)s.%(ext)s" --exec "id3v2 -T %(playlist_index)s -t %(title)s %(filepath)s" PLAYLIST_ID str_types = (str) if sys.version_info.major > 2 else (str, unicode) info = {} + + if '%(filepath)s' not in cmd: + cmd += ' %(filepath)s' + for key in information: value = information[key] info[key] = compat_shlex_quote(value) if isinstance(value, str_types) else value + cmd = cmd % info self._downloader.to_screen('[exec] Executing command: %s' % cmd)