]>
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 shlex_quote
 
   7 from ..utils 
import PostProcessingError
 
  10 class ExecAfterDownloadPP(PostProcessor
): 
  11     def __init__(self
, downloader
, exec_cmd
): 
  12         super(ExecAfterDownloadPP
, self
).__init
__(downloader
) 
  13         self
.exec_cmd 
= exec_cmd
 
  15     def run(self
, information
): 
  20         cmd 
= cmd
.replace('{}', shlex_quote(information
['filepath'])) 
  22         self
._downloader
.to_screen("[exec] Executing command: %s" % cmd
) 
  23         retCode 
= subprocess
.call(cmd
, shell
=True) 
  25             raise PostProcessingError( 
  26                 'Command returned error code %d' % retCode
) 
  28         return [], information