From 06df65d89d5266c131014fc1805bb670bd7879b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C4=8Cejka?= Date: Thu, 28 Dec 2023 13:47:55 +0100 Subject: [PATCH] Improve printed informations --- recode_video.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/recode_video.py b/recode_video.py index a48213e..6afac7f 100755 --- a/recode_video.py +++ b/recode_video.py @@ -219,6 +219,7 @@ def get_command(command, file_path): parser.add_argument('-n', '--dry-run', action='store_true', help='Only display the command, don\'t recode') parser.add_argument('-f', '--force', action='store_true', help='Rewrite output file if it already exists') + parser.add_argument('-v', '--verbose', action='store_true', help='Verbose output') parser.add_argument('filename', type=str, help='Media file to recode') parser.add_argument('outfilename', type=str, help='Recoded media file', nargs='?') @@ -236,11 +237,11 @@ def get_command(command, file_path): ) if not os.path.exists(input_file): - print("File '{}' does not exist".format(input_file)) + print("File '{}' does not exist".format(input_file), file=sys.stderr) exit(1) if os.path.exists(output_file) and not args.force: - print("File '{}' already exists".format(output_file)) + print("File '{}' already exists".format(output_file), file=sys.stderr) exit(1) ffmpeg_parameters = get_ffmpeg_parameters(input_file, parameters['recoding']) @@ -250,7 +251,8 @@ def get_command(command, file_path): if args.force: ffmpeg_command = ffmpeg_command + ' -y' - print("\nCall this command:\n{}\n".format(ffmpeg_command)) + if args.verbose: + print("\nCall this command:\n{}\n".format(ffmpeg_command)) if not args.dry_run: result = subprocess.run(ffmpeg_command, shell=True, capture_output=True, text=True)