scripts for my gemini capsule
oeb: make old script redirect to new
| -rwxr-xr-x | oeb.sh | 30 |
1 files changed, 3 insertions, 27 deletions
@@ -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" |