1
Fork 0
mirror of https://github.com/Steffo99/bbbdl.git synced 2024-11-22 07:44:18 +00:00

Add debug option to print compiled command

This commit is contained in:
Steffo 2020-11-13 16:44:59 +01:00
parent 2238642ad3
commit 4bab3197f9

View file

@ -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,8 +31,12 @@ 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)
if debug:
click.echo(" ".join(output.compile()))
else:
output.run(quiet=not verbose_ffmpeg, overwrite_output=True)