From 4bab3197f95e1284f00f2bd8c8e83214f7c270b5 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 13 Nov 2020 16:44:59 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20debug=20option=20to=20print?= =?UTF-8?q?=20compiled=20command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bbbdl/__main__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bbbdl/__main__.py b/bbbdl/__main__.py index c0e9e56..accc52a 100644 --- a/bbbdl/__main__.py +++ b/bbbdl/__main__.py @@ -21,7 +21,9 @@ def main(): help="Overwrite existing files instead of skipping them.") @click.option("-v", "--verbose-ffmpeg", is_flag=True, help="Print ffmpeg info to stderr.") -def download(input_url, output_file, overwrite=False, verbose_ffmpeg=False): +@click.option("-D", "--debug", is_flag=True, + help="Print the compiled ffmpeg command to stdout instead of running it.") +def download(input_url, output_file, overwrite=False, verbose_ffmpeg=False, debug=False): if not overwrite and os.path.exists(output_file): raise click.ClickException(f"Output file already exists: {output_file}") @@ -29,9 +31,13 @@ def download(input_url, output_file, overwrite=False, verbose_ffmpeg=False): click.secho(f"Downloading: {input_url} -> {output_file}", err=True, fg="green") streams = compose_lesson(meeting) + output = ffmpeg.output(*streams, output_file) - output.run(quiet=not verbose_ffmpeg, overwrite_output=True) + if debug: + click.echo(" ".join(output.compile())) + else: + output.run(quiet=not verbose_ffmpeg, overwrite_output=True) @main.command()