diff --git a/summarize_yt/cli.py b/summarize_yt/cli.py index 974c087..73c71c4 100644 --- a/summarize_yt/cli.py +++ b/summarize_yt/cli.py @@ -240,39 +240,12 @@ def main(): if not args.yes: try: - # Check if running in a terminal - if sys.stdin.isatty(): - import tty - import termios - - # Save the terminal settings - fd = sys.stdin.fileno() - old_settings = termios.tcgetattr(fd) - try: - # Set the terminal to raw mode - tty.setraw(sys.stdin.fileno()) - sys.stdout.write("\nDo you want to proceed with getting the summary? (y/N): ") - sys.stdout.flush() - # Read a single character - char = sys.stdin.read(1) - # Print a newline since we're in raw mode - sys.stdout.write("\n") - sys.stdout.flush() - finally: - # Restore terminal settings - termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) - else: - # If not in a terminal, use regular input - sys.stdout.write("\nDo you want to proceed with getting the summary? (y/N): ") - sys.stdout.flush() - char = input().strip() - - if not char or char.lower() != "y": + response = input("\nDo you want to proceed with getting the summary? (y/N): ").strip().lower() + if response != 'y': print("Operation cancelled by user.") cleanup_files(vtt_path) sys.exit(0) - - except (EOFError, KeyboardInterrupt, termios.error): + except (EOFError, KeyboardInterrupt): print("\nOperation cancelled by user.") cleanup_files(vtt_path) sys.exit(0)