1 from __future__ import unicode_literals
5 from .common import PostProcessor
12 class ExecAfterDownloadPP(PostProcessor):
13 def __init__(self, downloader=None, verboseOutput=None, exec_cmd=None):
14 self.verboseOutput = verboseOutput
15 self.exec_cmd = exec_cmd
17 def run(self, information):
22 cmd = cmd.replace('{}', shlex_quote(information['filepath']))
24 self._downloader.to_screen("[exec] Executing command: %s" % cmd)
25 retCode = subprocess.call(cmd, shell=True)
27 raise PostProcessingError(
28 'Command returned error code %d' % retCode)
30 return None, information # by default, keep file and do nothing