From 2dff75fba50f865d64714bfe5151d3f14f296153 Mon Sep 17 00:00:00 2001 From: Cavit Erginsoy Date: Mon, 20 Jan 2025 22:29:09 +0000 Subject: [PATCH] cli: align directory handling with codebase style Use warnings.warn() for errors instead of print(), show file count messages only with --verbose, and simplify user prompts. Keep error handling consistent with the original code, including traceback on exceptions. --- whisper/mlx_whisper/cli.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/whisper/mlx_whisper/cli.py b/whisper/mlx_whisper/cli.py index 8ace9a23..9c9b45ad 100644 --- a/whisper/mlx_whisper/cli.py +++ b/whisper/mlx_whisper/cli.py @@ -167,13 +167,13 @@ def build_parser(): parser.add_argument( "--prepend-punctuations", type=str, - default="\"'“¿([{-", + default="\"'""¿([{-", help="If word-timestamps is True, merge these punctuation symbols with the next word", ) parser.add_argument( "--append-punctuations", type=str, - default="\"'.。,,!!??::”)]}、", + default="\"'.。,,!!??::"")]}、", help="If word_timestamps is True, merge these punctuation symbols with the previous word", ) parser.add_argument( @@ -273,9 +273,8 @@ def main(): ) writer(result, file_path.stem, **writer_args) except Exception as e: + traceback.print_exc() warnings.warn(f"Failed to process {file_path}: {str(e)}") - if args.get("verbose"): - traceback.print_exc() continue output_name = output_name or path.stem @@ -287,9 +286,8 @@ def main(): ) writer(result, output_name, **writer_args) except Exception as e: + traceback.print_exc() warnings.warn(f"Failed to process {audio_obj}: {str(e)}") - if args.get("verbose"): - traceback.print_exc() if __name__ == "__main__":