ExecAfterDownloadPP, YoutubeDL: remove unused parameters
[youtube-dl] / youtube_dl / postprocessor / execafterdownload.py
1 from __future__ import unicode_literals
2
3 import subprocess
4
5 from .common import PostProcessor
6 from ..compat import shlex_quote
7 from ..utils import PostProcessingError
8
9
10 class ExecAfterDownloadPP(PostProcessor):
11     def __init__(self, downloader=None, exec_cmd=None):
12         self.exec_cmd = exec_cmd
13
14     def run(self, information):
15         cmd = self.exec_cmd
16         if '{}' not in cmd:
17             cmd += ' {}'
18
19         cmd = cmd.replace('{}', shlex_quote(information['filepath']))
20
21         self._downloader.to_screen("[exec] Executing command: %s" % cmd)
22         retCode = subprocess.call(cmd, shell=True)
23         if retCode != 0:
24             raise PostProcessingError(
25                 'Command returned error code %d' % retCode)
26
27         return [], information