diff options
author | makefu <github@syntax-fehler.de> | 2013-09-02 17:53:45 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2013-09-02 17:53:45 +0200 |
commit | 7eb79f6564f498163a670fb3bc503dfcaace0ab5 (patch) | |
tree | 07571a600890c94bf8c36c7d59e29ebd54b81b15 /god/ivan | |
parent | ff8a17e1fdf40ce8c7b6479f18f0476d442a8797 (diff) |
refactor naturalvoices
util/lib/naturalvoices/att.sh contains functions to grab and play
att text-to-speech from the servers
god/ivan/naturalvoices_cached.sh and util/lib/naturalvoices/att.sh
are using the new lib
Diffstat (limited to 'god/ivan')
-rwxr-xr-x | god/ivan/naturalvoices_cached.sh | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/god/ivan/naturalvoices_cached.sh b/god/ivan/naturalvoices_cached.sh index df180108..d64d9b78 100755 --- a/god/ivan/naturalvoices_cached.sh +++ b/god/ivan/naturalvoices_cached.sh @@ -2,25 +2,24 @@ # The cached version of naturalvoices # This should prevent us from being pwned again ... +. ../../util/lib/naturalvoices/att.sh + +: ${1?what to say?Please provide text as parameter.} + text=$(echo $* | sed -e 's/ /+/g' -e 's/\//%2F/g') voice="klara" -ip=192.20.225.36 -base_url="http://$ip" + + CACHE_DIR="/tmp/ivan-speech" -mkdir -p $CACHE_DIR -TXTFILE="$CACHE_DIR/${text}.wav" -if [ ! -e $TXTFILE ] ;then - echo "Downloading $TXTFILE" - wget $base_url$( curl -Ss -H 'Host:$ip' \ - -H 'Origin:http://www2.research.att.com' \ - -e "http://www2.research.att.com/~ttsweb/tts/demo.php" \ - -A "Mozilla/5.0 (X11; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0" \ - -d "voice=$voice" -d "txt=$text" -d "speakButton=SPEAK" \ - -H 'Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \ - $base_url/tts/cgi-bin/nph-nvttsdemo | \ - grep HREF|sed 's/.*\(".*"\).*/\1/' | \ - sed -e 's/"//g' ) -O "$TXTFILE" 2>/dev/null +mkdir -p "$CACHE_DIR" +OUTFILE="$CACHE_DIR/${text}.wav" + + +if [ ! -e $OUTFILE ] ;then + echo "Downloading $OUTFILE" + get_tts "$text" else - echo "using cached version of $TXTFILE" + echo "using cached version of $OUTFILE" fi -aplay "$TXTFILE" + +play_file "$OUTFILE" |