X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=inline;f=youtube_dl%2Fpostprocessor%2Fcommon.py;h=4191d040bb1da468e248d57b78df1afdacf64cd0;hb=8d5b8b477e4b1051482b21ea451f0de1ce23bce7;hp=c44501b594c87fc3c82772c0c67ce2c5d27689f8;hpb=1866432db74946c2b66263d38ed2c9d9d7e3177d;p=youtube-dl diff --git a/youtube_dl/postprocessor/common.py b/youtube_dl/postprocessor/common.py index c44501b59..4191d040b 100644 --- a/youtube_dl/postprocessor/common.py +++ b/youtube_dl/postprocessor/common.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals import os -import shlex from ..utils import ( PostProcessingError, @@ -23,14 +22,15 @@ class PostProcessor(object): of the chain is reached. PostProcessor objects follow a "mutual registration" process similar - to InfoExtractor objects. And it can receive parameters from CLI trough - --postprocessor-args. + to InfoExtractor objects. + + Optionally PostProcessor can use a list of additional command-line arguments + with self._configuration_args. """ _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._downloader = downloader def set_downloader(self, downloader): @@ -60,6 +60,13 @@ class PostProcessor(object): except Exception: self._downloader.report_warning(errnote) + def _configuration_args(self, default=[]): + pp_args = self._downloader.params.get('postprocessor_args') + if pp_args is None: + return default + assert isinstance(pp_args, list) + return pp_args + class AudioConversionError(PostProcessingError): pass