Files
lucky-cat/tools/play_prompt_opus.command

34 lines
584 B
Bash
Executable File

#!/bin/zsh
set -u
SCRIPT_DIR="${0:A:h}"
PLAYER="$SCRIPT_DIR/play_prompt_opus.py"
if [[ $# -gt 0 ]]; then
PROMPT_FILE="$1"
else
PROMPT_FILE="$(osascript <<'APPLESCRIPT'
try
POSIX path of (choose file with prompt "Choose a TQ_CatN prompt Opus file")
on error number -128
return ""
end try
APPLESCRIPT
)"
fi
if [[ -z "$PROMPT_FILE" ]]; then
exit 0
fi
python3 "$PLAYER" "$PROMPT_FILE"
RESULT=$?
if [[ $RESULT -ne 0 ]]; then
echo
echo "Playback failed. Install FFmpeg with: brew install ffmpeg"
echo "Press Enter to close."
read -r
fi
exit $RESULT