Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Добавить в запускаемые приложения: /home/user/run_speech.sh /home/user/speech.sh
- COMMAND_COUNTER=0
- MESSAGE_HEADER=""
- MESSAGE_BODY=""
- PARSE_REQUIRED=0
- while read -r DBUS_MESSAGE ; do
- ID=`echo $DBUS_MESSAGE | grep "uint32 0"`
- if [[ $ID ]] ; then
- let COMMAND_COUNTER=0
- let PARSE_REQUIRED=1
- else
- if [ $PARSE_REQUIRED -eq 1 ] ; then
- ID=`echo $DBUS_MESSAGE | egrep "string\ \""`
- if [[ $ID ]] ; then
- let COMMAND_COUNTER=$COMMAND_COUNTER+1
- fi
- if [ $COMMAND_COUNTER -eq 2 ] ; then
- MESSAGE_HEADER=`echo $DBUS_MESSAGE | grep "string\ \"" | sed s/^string\ \"//g | sed s/\"$//g`
- fi
- if [ $COMMAND_COUNTER -eq 3 ] ; then
- MESSAGE_BODY=`echo $DBUS_MESSAGE | grep "string\ \"" | sed s/^string\ \"//g | sed s/\"$//g`
- echo $MESSAGE_HEADER | festival --tts
- echo $MESSAGE_BODY | festival --tts
- let COMMAND_COUNTER=$COMMAND_COUNTER+1
- let PARSE_REQUIRED=0
- fi
- fi
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment