mirror of
https://github.com/kkroening/ffmpeg-python.git
synced 2025-04-06 04:15:44 +08:00
Overwrite output files by default, with option to turn it off
This commit is contained in:
parent
f8409d4397
commit
3d88c9151d
@ -109,7 +109,7 @@ def _get_output_args(node, stream_name_map):
|
|||||||
|
|
||||||
|
|
||||||
@output_operator()
|
@output_operator()
|
||||||
def get_args(stream_spec, overwrite_output=False):
|
def get_args(stream_spec, overwrite_output=True):
|
||||||
"""Get command-line arguments for ffmpeg."""
|
"""Get command-line arguments for ffmpeg."""
|
||||||
nodes = get_stream_spec_nodes(stream_spec)
|
nodes = get_stream_spec_nodes(stream_spec)
|
||||||
args = []
|
args = []
|
||||||
@ -126,8 +126,14 @@ def get_args(stream_spec, overwrite_output=False):
|
|||||||
args += ['-filter_complex', filter_arg]
|
args += ['-filter_complex', filter_arg]
|
||||||
args += reduce(operator.add, [_get_output_args(node, stream_name_map) for node in output_nodes])
|
args += reduce(operator.add, [_get_output_args(node, stream_name_map) for node in output_nodes])
|
||||||
args += reduce(operator.add, [_get_global_args(node) for node in global_nodes], [])
|
args += reduce(operator.add, [_get_global_args(node) for node in global_nodes], [])
|
||||||
if overwrite_output:
|
|
||||||
|
if bool(overwrite_output) is True:
|
||||||
args += ['-y']
|
args += ['-y']
|
||||||
|
# bool(None) evaluates to False, skip it earlier
|
||||||
|
elif overwrite_output is None:
|
||||||
|
pass
|
||||||
|
elif bool(overwrite_output) is False:
|
||||||
|
args += ['-n']
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user