Skip to content

Commit

Permalink
Improve printed informations
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuchulain committed Dec 28, 2023
1 parent 4a4746b commit 06df65d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions recode_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -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='?')

Expand All @@ -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'])
Expand All @@ -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)
Expand Down

0 comments on commit 06df65d

Please sign in to comment.