]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/postprocessor/execafterdownload.py
1 from __future__
import unicode_literals
5 from .common
import PostProcessor
6 from ..compat
import compat_shlex_quote
13 class ExecAfterDownloadPP(PostProcessor
):
14 def __init__(self
, downloader
, exec_cmd
):
15 super(ExecAfterDownloadPP
, self
).__init
__(downloader
)
16 self
.exec_cmd
= exec_cmd
18 def run(self
, information
):
23 cmd
= cmd
.replace('{}', compat_shlex_quote(information
['filepath']))
25 self
._downloader
.to_screen('[exec] Executing command: %s' % cmd
)
26 retCode
= subprocess
.call(encodeArgument(cmd
), shell
=True)
28 raise PostProcessingError(
29 'Command returned error code %d' % retCode
)
31 return [], information