diff options
-rw-r--r-- | god/ivan/Makefile | 4 | ||||
-rwxr-xr-x | god/ivan/ivan | 2 | ||||
-rwxr-xr-x | god/ivan/ivan-startup | 18 | ||||
-rwxr-xr-x | god/ivan/naturalvoices_cached.sh | 26 |
4 files changed, 38 insertions, 12 deletions
diff --git a/god/ivan/Makefile b/god/ivan/Makefile index 38eb1da2..30bb86aa 100644 --- a/god/ivan/Makefile +++ b/god/ivan/Makefile @@ -1,7 +1,7 @@ .PHONY: infest BIN_DIR = ../bin infest: - cp ivan ${INSTALL_DIR} + ln -s ${PWD}ivan ${INSTALL_DIR} debian-startup: cp ivan-startup /etc/init.d/ivan - update-rc.d evan start + update-rc.d ivan start diff --git a/god/ivan/ivan b/god/ivan/ivan index c28bd3cb..c35cccf7 100755 --- a/god/ivan/ivan +++ b/god/ivan/ivan @@ -29,7 +29,7 @@ do if [ -n "${USING_ESPEAK:-}" ];then espeak -v $v -p $p -k $k -a $a -g $g "`shuf \"$SATZ_LISTE\" | tail -1`" else - ../../util/bin/naturalvoices2.sh "`shuf \"$SATZ_LISTE\" | tail -1`" + ./naturalvoices_cached.sh "`shuf \"$SATZ_LISTE\" | tail -1`" fi [ ! "${1:-}" = "-d" ] && exit 0 # break if not daemonized sleep $((${RANDOM}%${RND_DELAY})) diff --git a/god/ivan/ivan-startup b/god/ivan/ivan-startup index 8a7f8daa..f955e1c2 100755 --- a/god/ivan/ivan-startup +++ b/god/ivan/ivan-startup @@ -1,29 +1,29 @@ #! /bin/sh # ### BEGIN INIT INFO -# Provides: evan +# Provides: ivan # Required-Start: $remote_fs $network # Required-Stop: $remote_fs $network # Should-Start: $syslog $named # Should-Stop: $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 -# Short-Description: Start evan daemons +# Short-Description: Start ivan daemons # Description: ### END INIT INFO # # Based on Lubomir Bulej's Redhat init script. -DAEMON="/root/bin/evan" -PIDFILE="/var/lock/evan" -NAME="evan" -DESC="evan daemons" -TCONF="/etc/evan" +DAEMON="/krebs/bin/ivan" +PIDFILE="/var/lock/ivan" +NAME="ivan" +DESC="ivan daemons" +TCONF="/etc/ivan" test -f $DAEMON || exit 0 -[ -r /etc/default/evan ] && . /etc/default/evan +[ -r /etc/default/ivan ] && . /etc/default/ivan start() { @@ -34,7 +34,7 @@ start() { stop() { [ ! -e $PIDFILE ] && echo "$PIDFILE does not exist" && return kill `cat $PIDFILE` - #killall evan + #killall ivan rm $PIDFILE } 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" |