catpoint-karaoke.sh - annna - Annna the nice friendly bot.
(HTM) git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
---
catpoint-karaoke.sh (912B)
---
1 #!/bin/sh
2 pyenv="${KARAOKE_VENV:-./.venv}"
3 gpt="${KARAOKE_GPT:-/home/annna/bin/gpt}"
4 outdir="${KARAOKE_OUT:-/br/gopher/karaoke}"
5 article="$(mktemp).md"
6
7 maxtries=4
8 tries=0
9 while [ $tries -lt $maxtries ];
10 do
11 if "${pyenv}/bin/python" ./wikipedia-random >"${article}"
12 then
13 if test "$(wc -l "${article}" | awk '{print $1}')" -ge 25
14 then
15 break
16 fi
17 fi
18 sleep 1
19 tries=$(($tries+1))
20 done
21 [ $tries -ge $maxtries ] && exit 1
22
23 prompt="Create a funny presentation. <presentation_spec>$(cat pres-format.md)</presentation_spec>. <presentation_content>$(cat "${article}")</presentation_content>"
24 response="$(printf '%s\n' "${prompt}" | NO_PASTING=1 "${gpt}")"
25 printf '%s' "$response" >"${article}"
26 "${pyenv}/bin/mdformat" --wrap 80 "${article}"
27
28 hash="$(sha1sum "${article}" | cut -c 1-8)"
29 presdir="${outdir}/${hash}"
30 mkdir -p "${presdir}" && \
31 cd "${presdir}" && \
32 <"${article}" md2point && \
33 echo "${presdir}"