scripts for my gemini capsule
curl: Be silent
Zach DeCook 2021-04-04
parent a53536d · commit ceb612c
-rwxr-xr-xccel.sh3
-rwxr-xr-xgcc.sh6
-rwxr-xr-xnet.sh2
3 files changed, 6 insertions, 5 deletions
diff --git a/ccel.sh b/ccel.sh
index 2a9b2b2..9b59c73 100755
--- a/ccel.sh
+++ b/ccel.sh
@@ -12,6 +12,7 @@ then
exit 0
fi
printf "20 text/gemini\r\n"
+
printf "=> %s This page was automatically generated from the following CCEL book (http)\n" https://ccel.org/ccel/"$QUERY_STRING"
printf "=> /thml2gmi/ and converted with thml2gmi\n"
-curl https://ccel.org/ccel/"$QUERY_STRING".xml | ./thml2gmi.py /dev/stdin
+curl -s https://ccel.org/ccel/"$QUERY_STRING".xml | ./thml2gmi.py /dev/stdin
diff --git a/gcc.sh b/gcc.sh
index 874a86e..6d55641 100755
--- a/gcc.sh
+++ b/gcc.sh
@@ -3,7 +3,7 @@
if [ "$PATH_INFO" = "" ]
then
printf "20 text/gemini\r\n"
- curl https://gccsatx.com/hymns/ | grep ' <a href="https://gccsatx.com/hymns/' | cut -d/ -f5 | sed 's@^@=>gcc.sh/@g'
+ curl -s https://gccsatx.com/hymns/ | grep ' <a href="https://gccsatx.com/hymns/' | cut -d/ -f5 | sed 's@^@=>gcc.sh/@g'
exit 0
fi
@@ -11,14 +11,14 @@ hasmp3=$(echo "$QUERY_STRING"|grep 'mp3')
if [ ! "$hasmp3" = "" ]
then
printf "20 audio/mpeg\r\n"
- mp3=$(curl https://gccsatx.com/hymns$PATH_INFO/ | grep \.mp3 | sed 's/ /\n/g' | grep \.mp3 | grep href | cut -d'"' -f2)
+ mp3=$(curl -s https://gccsatx.com/hymns$PATH_INFO/ | grep \.mp3 | sed 's/ /\n/g' | grep \.mp3 | grep href | cut -d'"' -f2)
curl --output - $mp3
exit 0
fi
printf "20 text/gemini\r\n"
printf "=>/cgi-bin/gcc.sh$PATH_INFO?.mp3 Listen to this!\n"
-curl https://gccsatx.com/hymns$PATH_INFO/ \
+curl -s https://gccsatx.com/hymns$PATH_INFO/ \
| sed 's@ <title>@#@g' | sed 's@ | Hymn Lyrics and Piano Music</title>@@g'\
| sed 's@<p><strong>@##@g' | sed 's@</strong>@@g'\
| sed 's@<p>@@g' \
diff --git a/net.sh b/net.sh
index 06c2936..5ddaa16 100755
--- a/net.sh
+++ b/net.sh
@@ -14,7 +14,7 @@ req="$(printf 'https://labs.bible.org/api/?passage=%s&type=text' "$qs")"
#echo "$req"
echo "#$qs" | sed 's/+/ /g'
# todo: indicate scripture citations and allusions?
-curl "$req" | sed 's@<b>[0-9:]*</b>@@g' | sed 's@</\?b>@@g'
+curl -s "$req" | sed 's@ *<b>[0-9:]*</b> *@ @g' | sed 's@</\?b>@@g'
# end with a newline
echo ''
echo '(NET)'