summaryrefslogtreecommitdiffstats
path: root/god/ivan/ivan
blob: f8cbcb8be97d5311fdbe0e261b1d480f8d94e117 (plain)
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
#!/bin/bash

cd $(dirname $(readlink -f $0))
SATZ_LISTE=satz-liste
p="${noise_pitch-10}"
v="${noise_lang-de}"
k="${noise_capital-0}"
a="${noise_amplitude-600}"
g="${noise_gap-1}"
RND_DELAY=3600
CACHE_DIR=/opt/ivan-cache
export CACHE_DIR
#set -x
function helpme ()
{
  cat << EOF 
  $0 [-d]
    -d   -- daemonize
    -h   -- this help file

  environment:
     USING_ESPEAK   - if set, ivan will talk with espeak
EOF
  exit 0
}

[ "${1:-}" = "-h" ] && helpme

while true
do
  aplay announce.wav
  if [ -n "${USING_ESPEAK:-}" ];then
    espeak -v $v -p $p -k $k -a $a -g $g "`shuf \"$SATZ_LISTE\" | tail -1`"
  else
    ./naturalvoices_cached.sh "Achtung, Achtung, es erfolgt eine Durchsage!"
    sleep 0.3
    ./naturalvoices_cached.sh "`shuf  \"$SATZ_LISTE\" | tail -1`"
  fi
  [ ! "${1:-}" = "-d" ] && exit 0   # break if not daemonized
  sleep $((${RANDOM}%${RND_DELAY}))
done