38 lines
818 B
Bash
38 lines
818 B
Bash
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
# Check if transcribe-video.sh is in PATH
|
|
if ! command -v transcribe-video &> /dev/null; then
|
|
echo "Error: transcribe-video not found in PATH."
|
|
exit 1
|
|
fi
|
|
|
|
# Enable globbing for both mp4 and mkv
|
|
shopt -s nullglob
|
|
FILES=( *.mp4 *.mkv )
|
|
|
|
if [ ${#FILES[@]} -eq 0 ]; then
|
|
echo "No .mp4 or .mkv files found in the current directory."
|
|
exit 0
|
|
fi
|
|
|
|
echo "Found ${#FILES[@]} file(s) to process."
|
|
|
|
for FILE in "${FILES[@]}"; do
|
|
# Get basename without extension
|
|
BASENAME="${FILE%.*}"
|
|
# Check if SRT file already exists
|
|
SRT_FILE="${BASENAME}.srt"
|
|
if [[ -f "$SRT_FILE" ]]; then
|
|
echo "Skipping $FILE: SRT file already exists."
|
|
continue
|
|
fi
|
|
echo "=== Processing: $FILE ==="
|
|
transcribe-video "$FILE"
|
|
echo "=== Done: $FILE ==="
|
|
echo
|
|
done
|
|
|
|
echo "All files processed."
|