diff --git a/README.md b/README.md index 687985f..f1383b1 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,37 @@ python beautify-audio.py ~/Downloads/Track.wav \ --auth-file ~/secrets/onetagger-auth.json ``` +## Example for Automator Script (Quick Action) +```bash +set -euo pipefail + +# Where the repo lives +SCRIPT_ROOT="/path/to/beautify-audio" +PY_SCRIPT="$SCRIPT_ROOT/beautify-audio.py" + +# Make sure Homebrew binaries are visible (ffmpeg, etc.) +export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH" + +LOG_DIR="$HOME/Library/Logs" +LOG_FILE="$LOG_DIR/beautify-audio-$(date +%Y%m%d-%H%M%S).log" +mkdir -p "$LOG_DIR" + +# Make sure a virtual environment with the requirements installed is available +source "$SCRIPT_ROOT/.venv/bin/activate" + +{ + echo "==== $(date) ====" + for src in "$@"; do + echo "Processing: $src" + /usr/bin/env python3 "$PY_SCRIPT" "$src" + done +} >>"$LOG_FILE" 2>&1 + +osascript -e "display notification \"Beautify Audio finished for $# file(s).\" with title \"Beautify Audio\"" + +``` + + ## Notes - Automator-friendly: one input file in, one clean MP3 out. - If OneTagger is missing or fails, conversion and cleanup still run; renaming uses best-effort metadata.