summaryrefslogtreecommitdiffstats
path: root/god/ivan/naturalvoices_cached.sh
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2013-09-02 16:52:07 +0200
committermakefu <github@syntax-fehler.de>2013-09-02 16:52:07 +0200
commitcd2185d7fccb36d0146da751a1d34bf942728794 (patch)
tree381ef0896e55c92190eefb25a156a4f2a9768356 /god/ivan/naturalvoices_cached.sh
parentb6ab9e12dd5422f8b65601d10955486778242ede (diff)
add natural voices with caching for ivan
Diffstat (limited to 'god/ivan/naturalvoices_cached.sh')
-rwxr-xr-xgod/ivan/naturalvoices_cached.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/god/ivan/naturalvoices_cached.sh b/god/ivan/naturalvoices_cached.sh
new file mode 100755
index 00000000..df180108
--- /dev/null
+++ b/god/ivan/naturalvoices_cached.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+# The cached version of naturalvoices
+# This should prevent us from being pwned again ...
+
+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
+else
+ echo "using cached version of $TXTFILE"
+fi
+aplay "$TXTFILE"