Anhang: select.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | #!/bin/bash # # Sound control script for xsane2speech - speech directly from xsane # Copyright (C) 2010, 2011, 2013, 2019 Heinrich Schwietering # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # exec 2>>"${4}""${5}" SOUND="${1}" TXT_FILE="${2}" FILE_OUT="${3}" TEMP_DIR="${4}" ERRORLOG="${5}" SYNTH="${6}" SYNSEL="${7}" SEL="${8}" MAINPROG="${9}" endall(){ $(killall -q -s SIGKILL "$SYNTH") { if [[ "$SYNTH" == "festival" ]] ; then $(killall -q -s SIGKILL "$SOUND") { if [[ "$SYNSEL" != "german" ]] ; then $(killall -q -s SIGKILL audsp) sleep 0.1 $(killall -q -s SIGKILL "$SOUND") fi } fi } rm -f /tmp/paused.txt rm -f /tmp/audiofile_* rm -f /tmp/FestplayPID.txt } #delay until "$SOUND" is started { for i in {1..16}; do { if pidof "$SOUND" true; then break else echo "waiting for $SOUND" 1>&2 sleep 0.5 fi } done } while pidof "$SOUND" true do action=$(DISPLAY=:0.0 yad --title Wiedergabe --geometry -0-0 --button="Pause/Play":2 --button=Beenden:4 --button=Abbruch:8 ) ret=$? { if [[ $ret -eq 2 ]]; then { if [[ "$SOUND" == "gnome-mplayer" ]]; then echo $(pgrep -n mplayer) > /tmp/FestplayPID.txt else echo $(pgrep -n "$SOUND") > /tmp/FestplayPID.txt fi } PAPID=$(cat /tmp/FestplayPID.txt) echo "SEL: pid $PAPID" 1>&2 { if [ -f /tmp/paused.txt ] ; then sleep 0.1 $(kill -SIGCONT "$PAPID") rm -f /tmp/paused.txt echo "SEL: utterance resumed" 1>&2 else $(kill -SIGSTOP "$PAPID") echo "SEL: paused" > /tmp/paused.txt echo "SEL: utterance paused" 1>&2 fi } elif [[ $ret -eq 4 ]] ; then endall echo "SEL: utterance canceled" 1>&2 sleep 0.6 $(killall -q -s SIGKILL "$SEL") break elif [[ $ret -eq 8 ]] ; then endall rm "$TXT_FILE" 1>&2 rm "$FILE_OUT" 1>&2 echo "SEL: abborted ~~~+++~~~~+++~~~" $(date +%c) 1>&2 $(killall -q -s SIGKILL "$MAINPROG") # sleep 0.1 $(killall -q -s SIGKILL yad) $(killall -q -s SIGKILL "$SEL") break fi } done |
Steuerskript zur Wiedergabe von Text in xsane2speech