Simplify postprocessor_args transmission to PP base class

* Remove `extra_cmd_args` transmission from sub to super class.
* Simplify params transmission through `downloader.params`.
This commit is contained in:
Aurélio A. Heckert 2015-07-01 20:12:26 -03:00
parent 1866432db7
commit aa5d9a79d6
3 changed files with 7 additions and 8 deletions

View File

@ -227,7 +227,6 @@ def _real_main(argv=None):
postprocessors.append({ postprocessors.append({
'key': 'FFmpegVideoConvertor', 'key': 'FFmpegVideoConvertor',
'preferedformat': opts.recodevideo, 'preferedformat': opts.recodevideo,
'extra_cmd_args': opts.postprocessor_args,
}) })
if opts.convertsubtitles: if opts.convertsubtitles:
postprocessors.append({ postprocessors.append({
@ -354,6 +353,7 @@ def _real_main(argv=None):
'extract_flat': opts.extract_flat, 'extract_flat': opts.extract_flat,
'merge_output_format': opts.merge_output_format, 'merge_output_format': opts.merge_output_format,
'postprocessors': postprocessors, 'postprocessors': postprocessors,
'postprocessor_args': shlex.split(opts.postprocessor_args or ''),
'fixup': opts.fixup, 'fixup': opts.fixup,
'source_address': opts.source_address, 'source_address': opts.source_address,
'call_home': opts.call_home, 'call_home': opts.call_home,

View File

@ -1,7 +1,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import os import os
import shlex
from ..utils import ( from ..utils import (
PostProcessingError, PostProcessingError,
@ -29,8 +28,8 @@ class PostProcessor(object):
_downloader = None _downloader = None
def __init__(self, downloader=None, extra_cmd_args=None): def __init__(self, downloader=None):
self._extra_cmd_args = shlex.split(extra_cmd_args or '') self._extra_cmd_args = downloader.params.get('postprocessor_args')
self._downloader = downloader self._downloader = downloader
def set_downloader(self, downloader): def set_downloader(self, downloader):

View File

@ -29,8 +29,8 @@ class FFmpegPostProcessorError(PostProcessingError):
class FFmpegPostProcessor(PostProcessor): class FFmpegPostProcessor(PostProcessor):
def __init__(self, downloader=None, extra_cmd_args=None): def __init__(self, downloader=None):
PostProcessor.__init__(self, downloader, extra_cmd_args) PostProcessor.__init__(self, downloader)
self._determine_executables() self._determine_executables()
def check_version(self): def check_version(self):
@ -287,8 +287,8 @@ def run(self, information):
class FFmpegVideoConvertorPP(FFmpegPostProcessor): class FFmpegVideoConvertorPP(FFmpegPostProcessor):
def __init__(self, downloader=None, preferedformat=None, extra_cmd_args=None): def __init__(self, downloader=None, preferedformat=None):
super(FFmpegVideoConvertorPP, self).__init__(downloader, extra_cmd_args) super(FFmpegVideoConvertorPP, self).__init__(downloader)
self._preferedformat = preferedformat self._preferedformat = preferedformat
def run(self, information): def run(self, information):