scripts for my gemini capsule
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
|
#!/bin/sh
if [ "$PATH_INFO" = "" ]
then
printf "20 text/gemini\r\n"
wget -q -O - https://gccsatx.com/hymns/ | grep -o 'https://gccsatx.com/hymns/[^/"#]\+/' |cut -d/ -f5 | sed 's@^@=>gcc.sh/@g'
exit 0
fi
hasmp3=$(echo "$QUERY_STRING"|grep 'mp3')
if [ ! "$hasmp3" = "" ]
then
printf "20 audio/mpeg\r\n"
mp3=$(wget -q -O - https://gccsatx.com/hymns$PATH_INFO/ | grep \.mp3 | sed 's/ /\n/g' | grep \.mp3 | grep href | cut -d'"' -f2)
wget -O - $mp3
exit 0
fi
printf "20 text/gemini\r\n"
printf "=>/cgi-bin/gcc.sh$PATH_INFO?.mp3 Listen to this!\n"
wget -q -O - https://gccsatx.com/hymns$PATH_INFO/ \
| grep -o '\(<strong>\|<p>\|\)[^<>]*\(</strong>\|</p>\|<br />\)' \
| sed 's@<br />@@g'| sed 's@^<strong>@\n## @g' | sed 's@</strong>@@g' | sed 's@</p>@@g' | sed 's@<p>@@g' \
| sed 's@ <title>@#@g' | sed 's@ | Hymn Lyrics and Piano Music</title>@@g'\
| grep -v '<' \
| grep -v '!important' | grep -v '}\|{\|wp-smiley' \
| sed 's/‘/‘/g' |sed 's/’/’/g' | sed 's/”/”/g' | sed 's/“/“/g'\
| grep -v 'this website' \
| sed -r '/^\s*$/d'
exit 0
|