Advertisement
metalx1000

MyvTalk - Voice commands v0.1

Jan 5th, 2012
469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.81 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. datafile="$HOME/.vlist"
  4.  
  5. #firefox@firefox
  6. #new years eve@mplayer -fs "$HOME/Videos/NewYearEve_2011/New Years Eve 2011.avi"
  7. #internet explorer@espeak "I think internet explorer Sucks.  s"
  8. #internet@firefox
  9. #films by chris@xdg-open "http://filmsbykris.com"
  10.  
  11. rec -r 16000 -t alsa default /tmp/recording.flac silence 1 0.1 5% 5 1.0 5%
  12. x=$(wget -q -U "Mozilla/5.0" --post-file /tmp/recording.flac --header="Content-Type: audio/x-flac; rate=16000" -O - "http://www.google.com/speech-api/v1/recognize?lang=en-us&client=chromium"|cut -d\" -f12)
  13.  
  14. if [ "$1" == "test" ];then echo "$x";exit 0;fi
  15.  
  16. cat "$datafile"|while read i
  17. do
  18.   ia=$(echo "$i"|cut -d\@ -f1)
  19.   if [[ "$x" =~ "$ia" ]]
  20.   then exec=$(echo "$i"|cut -d\@ -f2)
  21.     eval "$exec"& echo "$x"
  22.     echo "Command Run $exec"
  23.     break
  24.   fi
  25. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement