summaryrefslogtreecommitdiff
path: root/update_index.sh
blob: f6cf15f770d06aa1e44b7b3a8a8beaf6119d2850 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

set -e

dir=${1:-}

filepath=$(du -a $dir | awk '($1 > 50) {print $2}' | shuf -n 1)
echo "$filepath"

cp "$filepath" /home/grail/projects/web/dynamic-web-page/todays_audio.opus

whisper --model medium --language de --device cpu /home/grail/projects/web/dynamic-web-page/todays_audio.opus 2>/dev/null

phrase=$(cat todays_audio.opus.txt)
phrase=$(echo $phrase | tr "\n" " ")
/home/grail/projects/web/dynamic-web-page/get_sd_image.sh "$phrase"
/home/grail/projects/web/dynamic-web-page/replace_phrase.sh "$phrase"

# in case of error go back
# cp audio.bak todays_audio.opus

yes | cp "$filepath" /home/grail/projects/web/grailblog/src/todays_audio.opus && \
    rsync -rPha /home/grail/projects/web/grailblog/src hostiko:/var/www