Add functionality to prompt for input file if not provided via CLI

This commit is contained in:
Ramforth
2025-11-01 11:28:18 +01:00
parent bab986646b
commit 0c8a431256

View File

@@ -13,6 +13,7 @@ def main():
) )
parser.add_argument( parser.add_argument(
"input_file", "input_file",
nargs='?',
help="Path to the input video file.", help="Path to the input video file.",
type=str type=str
) )
@@ -25,7 +26,13 @@ def main():
args = parser.parse_args() args = parser.parse_args()
input_file_path = os.path.abspath(args.input_file) input_file_path = args.input_file
while not input_file_path:
input_file_path = input("Please enter the path to the input video file: ").strip()
if not input_file_path:
print("Input file path cannot be empty. Please try again.", file=sys.stderr)
input_file_path = os.path.abspath(input_file_path)
if not os.path.exists(input_file_path): if not os.path.exists(input_file_path):
print(f"Error: Input file not found at '{input_file_path}'", file=sys.stderr) print(f"Error: Input file not found at '{input_file_path}'", file=sys.stderr)