diff options
| author | Zach DeCook <zachdecook@librem.one> | 2021-03-23 17:43:23 -0400 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2021-03-23 17:43:23 -0400 |
| commit | 0922bba03cdb364bbf9322ab6038881826f7894a (patch) | |
| tree | 745448cff37bc3adbc5be0141ed3b3f9012417e4 /gcc.sh | |
| parent | 8e1543c2c7aeb6ac103cf736e0e4e5d65b8e9c07 (diff) | |
| download | cgi-bin-0922bba03cdb364bbf9322ab6038881826f7894a.tar.gz | |
* Grace Community Church Hymn site: Add shell wrapper around this
Diffstat (limited to 'gcc.sh')
| -rwxr-xr-x | gcc.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc.sh b/gcc.sh new file mode 100755 index 0000000..6d7e089 --- /dev/null +++ b/gcc.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +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' + exit 0 +fi + +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) + 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/ | sed 's@<br />@@g' | sed 's@</p>@@' | grep -v '<' | grep -v '!important' | grep -v '}\|{\|wp-smiley' | sed 's/\s\+/ /g' | uniq +exit 0 |
