#!/bin/bash # Get the path to the Python script (adjust if needed) PYTHON_SCRIPT="$HOME/.bin/extract_subtitles.py" # Check if the Python script exists if [ ! -f "$PYTHON_SCRIPT" ]; then echo "Error: Python script '$PYTHON_SCRIPT' not found." exit 1 fi # Check if arguments are provided if [ "$#" -eq 0 ]; then echo "No arguments provided. Attempting to process all video files in the current directory." # Initialize a flag to track if any files are processed files_processed=0 # Find all video files in the current directory for video_file in *.mp4 *.mkv *.avi *.mov; do # Check if the file exists (in case no matches were found) if [ -e "$video_file" ]; then echo "Processing: $video_file" python "$PYTHON_SCRIPT" "$video_file" files_processed=1 fi done # If no files were processed, print a message if [ "$files_processed" -eq 0 ]; then echo "No video files found in the current directory." exit 1 fi else # Run the Python script with the provided arguments python "$PYTHON_SCRIPT" "$@" fi