Add example for Automator Script (Quick Action) to README.md

This commit is contained in:
Victor Giers
2025-12-08 16:00:21 +01:00
parent fb3fa0a52d
commit b235ba27ad

View File

@@ -59,6 +59,37 @@ python beautify-audio.py ~/Downloads/Track.wav \
--auth-file ~/secrets/onetagger-auth.json --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 ## Notes
- Automator-friendly: one input file in, one clean MP3 out. - 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. - If OneTagger is missing or fails, conversion and cleanup still run; renaming uses best-effort metadata.