guyfox

OSX say - Google Powered

Mar 22nd, 2012
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.37 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. [ -z "`which mplayer`" ] && echo "mplayer required" && exit
  4.  
  5. function google_say() {
  6.     mplayer -user-agent Mozilla "http://translate.google.com/translate_tts?tl=en&q=$(echo $* | sed 's#\ #+#g')" > /dev/null 2>&1
  7. }
  8.  
  9. args="$*"
  10. if [ -z "$args" ]; then
  11.     while :; do
  12.         read args
  13.         google_say "$args"
  14.     done
  15. fi
  16.  
  17. if [ ! -z "$args" ]; then
  18.     google_say "$args"
  19. fi
Add Comment
Please, Sign In to add comment