Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

AutoWhisperWatcher

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.

Installation

Prerequisites

  • 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

Step 1: Install fswatch

Install fswatch using Homebrew:

brew install fswatch

Setup

Step 2: Create the Monitoring Script

  1. Open your terminal.

  2. Navigate to a directory where you want to save your monitoring script and create it:

    cd $HOME
    nano monitor.sh
  3. 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
  4. Save and exit by pressing CTRL+X, then Y to confirm, and Enter to save.

  5. Make the script executable:

    chmod +x monitor.sh

Usage

Starting the Monitoring Script

To start monitoring in a screen session:

screen -S AutoWhisperWatcher
./monitor.sh

Detach from the screen session by pressing CTRL+A followed by D.

Stopping the Monitoring Script

To stop the script:

  1. Reattach to the screen session:
    screen -r AutoWhisperWatcher
  2. Terminate the script by pressing CTRL+C.
  3. Exit the screen session:
    exit

Automation

Configure to Run at Startup

  1. Open crontab editor:
    crontab -e
  2. 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

Conclusion

AutoWhisperWatcher provides an automated solution to monitor a specific directory for new files and open them using MacWhisper without manual intervention.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages