diff options
| author | Zach DeCook <zachdecook@librem.one> | 2021-11-03 16:38:11 -0400 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2021-11-03 16:39:25 -0400 |
| commit | 48230d7bf2a0242f9f8ccf32b5f50744bdf9e79b (patch) | |
| tree | 9486f54119efaa41af29339165fd5a5b016f0f62 /oeb.sh | |
| parent | 2ab60db3c7508e154415c75a5d994864124c055d (diff) | |
| download | cgi-bin-48230d7bf2a0242f9f8ccf32b5f50744bdf9e79b.tar.gz | |
oeb: make old script redirect to new
Diffstat (limited to 'oeb.sh')
| -rwxr-xr-x | oeb.sh | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/oeb.sh b/oeb.sh index 53b41ec..b348f90 100755 --- a/oeb.sh +++ b/oeb.sh @@ -2,31 +2,7 @@ test "$QUERY_STRING" || QUERY_STRING="$1" if [ "$QUERY_STRING" = "" ] then - printf "10 Enter a scripture reference\r\n" - return + printf "31 gemini://gemini.zachdecook.com/cgi-bin/oeb.py\r\n" + exit fi - -# parse query -book=$(echo $QUERY_STRING|cut -d' ' -f1) -chstart=$(echo $QUERY_STRING|tr ':' ' ' |cut -d' ' -f2) -vstart=$(echo $QUERY_STRING|tr '-' ':' | cut -d: -f2) -# vend is always the last number -vend=$(echo $QUERY_STRING |tr - : |rev|cut -d: -f1|rev) -# chend is the last leftover -chend=$(echo $QUERY_STRING|sed "s/$book //"| sed "s/:$vstart-/ /"|sed "s/ \?:\?$vend$//"|rev|cut -d' ' -f1|rev) -#echo $chstart "\t" $vstart "\t" $chend "\t"$vend && exit - -file=$(find oeb/ -name '*'-$book'*') -if ! test "$file"; then - printf "51 that book doesn't exist yet in the OEB\r\n" - return 1 -fi -printf "20 text/gemini\r\n" -echo '=> https://github.com/openenglishbible/Open-English-Bible This content from OpenEnglishBible (public domain)' -echo '=> gemini://gemini.zachdecook.com/usfm2gmi/ and rendered with usfm2gmi' -echo "# $book $chstart:$vstart - $chend:$vend" -grep '\c '"$chstart$" $file -A5000 | grep '\v '"$vstart " -A5000 \ -| tac|grep '\c '$(($chend + 1))'$' -A5000 | grep '\v '$vend' ' -A5000 | tac\ -| usfm2gmi/usfm2gmi.py -# end in newline -echo '' +printf "31 gemini://gemini.zachdecook.com/cgi-bin/oeb.py?$QUERY_STRING\r\n" |
