From adf5ba9140b01c37d7077b180c1379987767d266 Mon Sep 17 00:00:00 2001 From: Isaac Shoebottom Date: Tue, 24 Jun 2025 17:18:34 -0300 Subject: [PATCH] Add script to batch process a video file, made for a batch of video files --- dot_local/bin/executable_transcribe-videos | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 dot_local/bin/executable_transcribe-videos diff --git a/dot_local/bin/executable_transcribe-videos b/dot_local/bin/executable_transcribe-videos new file mode 100644 index 0000000..9316beb --- /dev/null +++ b/dot_local/bin/executable_transcribe-videos @@ -0,0 +1,37 @@ +#!/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."