AutoWhisperWatcher is a tool designed to monitor a directory on macOS for new audio files and automatically open them with MacWhisper. When a new file is detected, the script automatically opens MacWhisper and transcribes the file using the application's default settings, making it perfect for quick audio processing without manual intervention. It utilizes fswatch to watch for file changes and the terminal multiplexer screen to manage the script's execution in the background seamlessly.
- Homebrew: Ensure that Homebrew is installed on your system. If it's not installed, you can install it by running:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - MacWhisper: Ensure that MacWhisper is installed on your system.
- GNU Screen: Ensure that Screen is installed on your system. If it's not installed, you can install it with Homebrew by running:
brew install screen
Install fswatch using Homebrew:
brew install fswatch-
Open your terminal.
-
Navigate to a directory where you want to save your monitoring script and create it:
cd $HOME nano monitor.sh
-
Paste the following script into the editor:
#!/bin/bash FOLDER_PATH="/path/to/folder/to/watch/" open_with_macwhisper() { osascript -e "tell application \"MacWhisper\" to open \"$1\"" } export -f open_with_macwhisper fswatch -o "$FOLDER_PATH" | while read f do find "$FOLDER_PATH" -type f -print0 | xargs -0 -I {} bash -c 'open_with_macwhisper "$@"' _ {} done
-
Save and exit by pressing
CTRL+X, thenYto confirm, andEnterto save. -
Make the script executable:
chmod +x monitor.sh
To start monitoring in a screen session:
screen -S AutoWhisperWatcher
./monitor.shDetach from the screen session by pressing CTRL+A followed by D.
To stop the script:
- Reattach to the screen session:
screen -r AutoWhisperWatcher
- Terminate the script by pressing
CTRL+C. - Exit the screen session:
exit
- Open crontab editor:
crontab -e
- Add the following line to run the script at reboot (update the path if your monitoring script is not in your Home directory):
@reboot screen -dmS AutoWhisperWatcher $HOME/monitor.sh
AutoWhisperWatcher provides an automated solution to monitor a specific directory for new files and open them using MacWhisper without manual intervention.