Introduce new features

This commit is contained in:
nemunaire 2021-04-30 12:32:37 +02:00
parent 86467d8520
commit 1c02eeeb69

31
.speak
View File

@ -1,11 +1,28 @@
#!/bin/sh #!/bin/sh
REMOTE=""
FROMSTDIN=0
while getopts "r" opt; do
case $opt in
r)
FROMSTDIN=1
;;
\?)
exit 1
;;
esac
done
shift $(($OPTIND - 1))
# on teste si la lecture est en cours, pour l'arrêter le cas échéant # on teste si la lecture est en cours, pour l'arrêter le cas échéant
if ! [ -z "$(ps -A | grep espeak | awk '{ print $1 }' )" ] ESPK=$($REMOTE ps -A | grep espeak | awk '{ print $1 }' )
if ! [ -z "${ESPK}" ]
then then
for k in $(ps -A | grep espeak | awk '{ print $1 }' ) for k in ${ESPK}
do do
kill $k $REMOTE kill $k
break break
done done
else else
@ -14,5 +31,11 @@ else
then then
SPEAK_LANG="$1" SPEAK_LANG="$1"
fi fi
xclip -o | espeak -v $SPEAK_LANG | true
if [ "$FROMSTDIN" -eq 0 ]
then
xclip -o | tr '\n' ' ' | $REMOTE espeak -s 350 -p 35 -v $SPEAK_LANG || true
else
cat | $REMOTE espeak -s 350 -p 35 -v $SPEAK_LANG || true
fi
fi fi