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)