💾 Archived View for gemini.cyberbot.space › gemlog › aux › hotsync.sh captured on 2023-06-14 at 14:25:14.

View Raw

More Information

-=-=-=-=-=-=-

#!/bin/bash

tmp_d=$(mktemp -d)
trap 'rm -rf -- "$tmp_d"' EXIT

TODAY=$(date +%Y-%m-%d)
WXURL=""

mkdir -p $tmp_d/rss
mkdir -p $tmp_d/geminispace
export gemdir=$tmp_d

gemget -s gemini://gemini.cyberbot.space/feed.gmi -d $tmp_d/
gemget -s gemini://gemini.cyberbot.space/rss/feed.gmi -d $tmp_d/rss/
gemget -s gemini://geminispace.org/?feed -e -d $tmp_d/
gemget -s "$WXURL" -o $tmp_d/$TODAY-weather.gmi

awk '/=> gemini/ {print $2}' $tmp_d/feed.gmi | xargs -d 


\n' sh -c 'for arg do gemget -s -i -e -d "$gemdir" "$arg"; done' _
awk '/=> gemini/ {print $2}' $tmp_d/geminispace.org.gmi | xargs -d 


\n' sh -c 'for arg do gemget -s -i -e -d "$gemdir" "$arg"; done' _

~/rewrite-gmi.awk $tmp_d/feed.gmi > $tmp_d/comitium.gmi
~/rewrite-gmi.awk $tmp_d/geminispace.org.gmi > $tmp_d/gemspace.gmi

sed -i 's/.gmi/.html/g' $tmp_d/comitium.gmi
sed -i 's/.gmi/.html/g' $tmp_d/gemspace.gmi

for i in $tmp_d/*.gmi; do ~/gmi2html.awk $i > ${i%.*}.html; done

~/gmi2html.awk $tmp_d/rss/feed.gmi > $tmp_d/rss/feed.html

plucker-build -H $tmp_d/comitium.html -M 2 -f Gemini-Feed --bpp=4 --maxwidth=160 --zlib-compression
plucker-build -H $tmp_d/gemspace.html -M 2 -f Geminispace --bpp=4 --maxwidth=160 --zlib-compression
plucker-build -H $tmp_d/rss/feed.html -M 2 -f RSS --bpp=4 --maxwidth=160 --zlib-compression
#plucker-build -H $tmp_d/$TODAY-weather.html -M 1 -f Weather --bpp=4 --maxwidth=160 --zlib-compression

#echo "Press Hotsync Button then hit Y"
read -r -p "Would you like to Hotsync? (y/N) " input

if [[ "$input" =~ ^([yY][eE][sS]|[yY])$ ]]
then
    pilot-xfer -p /dev/pilot -i $HOME/.plucker/*.pdb
else
    echo "Done"
fi