Simplify `postprocessor_args` transmission to PP base class
authorAurélio A. Heckert <aurelio@colivre.coop.br>
Wed, 1 Jul 2015 23:12:26 +0000 (20:12 -0300)
committerAurélio A. Heckert <aurelio@colivre.coop.br>
Wed, 1 Jul 2015 23:12:26 +0000 (20:12 -0300)
* Remove `extra_cmd_args` transmission from sub to super class.
* Simplify params transmission through `downloader.params`.

youtube_dl/__init__.py
youtube_dl/postprocessor/common.py
youtube_dl/postprocessor/ffmpeg.py

index 356697015a0f66beb1fec48ee52f5f72460b8a60..249f7636503cee65e02d428f2965d1c0619cc36d 100644 (file)
@@ -227,7 +227,6 @@ def _real_main(argv=None):
         postprocessors.append({
             'key': 'FFmpegVideoConvertor',
             'preferedformat': opts.recodevideo,
-            'extra_cmd_args': opts.postprocessor_args,
         })
     if opts.convertsubtitles:
         postprocessors.append({
@@ -354,6 +353,7 @@ def _real_main(argv=None):
         'extract_flat': opts.extract_flat,
         'merge_output_format': opts.merge_output_format,
         'postprocessors': postprocessors,
+        'postprocessor_args': shlex.split(opts.postprocessor_args or ''),
         'fixup': opts.fixup,
         'source_address': opts.source_address,
         'call_home': opts.call_home,
index c44501b594c87fc3c82772c0c67ce2c5d27689f8..bee64c45772ed545e925c831637c39fcf001ea18 100644 (file)
@@ -1,7 +1,6 @@
 from __future__ import unicode_literals
 
 import os
-import shlex
 
 from ..utils import (
     PostProcessingError,
@@ -29,8 +28,8 @@ class PostProcessor(object):
 
     _downloader = None
 
-    def __init__(self, downloader=None, extra_cmd_args=None):
-        self._extra_cmd_args = shlex.split(extra_cmd_args or '')
+    def __init__(self, downloader=None):
+        self._extra_cmd_args = downloader.params.get('postprocessor_args')
         self._downloader = downloader
 
     def set_downloader(self, downloader):
index 891c727699db7af452ba12f89a2d2c7cb8a22c1f..de8c225da3f2fdf31c7534290fde0d0ca04d3b45 100644 (file)
@@ -29,8 +29,8 @@ class FFmpegPostProcessorError(PostProcessingError):
 
 
 class FFmpegPostProcessor(PostProcessor):
-    def __init__(self, downloader=None, extra_cmd_args=None):
-        PostProcessor.__init__(self, downloader, extra_cmd_args)
+    def __init__(self, downloader=None):
+        PostProcessor.__init__(self, downloader)
         self._determine_executables()
 
     def check_version(self):
@@ -287,8 +287,8 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor):
 
 
 class FFmpegVideoConvertorPP(FFmpegPostProcessor):
-    def __init__(self, downloader=None, preferedformat=None, extra_cmd_args=None):
-        super(FFmpegVideoConvertorPP, self).__init__(downloader, extra_cmd_args)
+    def __init__(self, downloader=None, preferedformat=None):
+        super(FFmpegVideoConvertorPP, self).__init__(downloader)
         self._preferedformat = preferedformat
 
     def run(self, information):