💾 Archived View for gemini.ctrl-c.club › ~semaphore › gemlog › gemlog.sh captured on 2023-04-26 at 14:24:20.
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
#!/usr/bin/bash # This script started its life as one I had brazenly stolen from HexDSL(.co.uk), who probably stole it from someone else, who knows?! ¯\_(ツ)_/¯ prefix=$(date +%Y-%m-%dT00:00:00+00:00) datey=$(date +'%a %d %b %Y') if [[ -z $2 ]] ; then read -p "Please enter a readable title for this post: " title <$(tty) fi if [[ -z $3 ]] ; then read -p "What will the file name of this post be? (No extension needed, .gmi added already): " filename <$(tty) fi if [[ -z $4 ]] ; then read -p "Please enter a tag, if there is one (cfa, ma, radio, kids or none): " tag <$(tty) fi gemdir=/home/filter/Documents/gemini/gemlog gempath=$gemdir/$filename.gmi feed=/home/filter/Documents/gemini/gemlog/atom.xml remotepath=gemini://gemini.ctrl-c.club/~semaphore/gemlog fullpath=$remotepath/$filename.gmi slashheaven="<updated>$prefix</updated>" touch $gempath cat /home/filter/Documents/gemini/gemlog/gemlogheader.txt >$gempath echo "$datey" >> $gempath echo "" >> $gempath echo "" >> $gempath echo "## $title" >> $gempath echo "" >> $gempath echo "" >> $gempath echo "" >> $gempath echo "=> /~semaphore/gemlog/digest.gmi Return to the gemlog digest page." >> $gempath echo "=> /~semaphore/index.gmi Return to /~semaphore/" >> $gempath sed -i '5d' $feed sed -i '$d' $feed sed -i "/^ <author>*/i $slashheaven" $feed echo " <entry>" >> $feed echo " <id>gemini://gemini.ctrl-c.club/~semaphore/gemlog/$filename.gmi</id>" >> $feed echo " <title>$title</title>" >> $feed echo " <updated>$prefix</updated>" >> $feed echo " <link href='$fullpath' rel='alternate'/>" >> $feed echo " </entry>" >> $feed echo "</feed>" >> $feed sed -i "16i => /~semaphore/gemlog/$filename.gmi $datey - $title" /home/filter/Documents/gemini/gemlog/digest.gmi if [ $tag == 'cfa' ]; then sed -i "26i => /~semaphore/gemlog/$filename.gmi $datey - $title" /home/filter/Documents/gemini/cfa/cfa.gmi elif [ $tag == 'ma' ]; then sed -i "36i => /~semaphore/gemlog/$filename.gmi $datey - $title" /home/filter/Documents/gemini/ma/ma.gmi elif [ $tag == 'radio' ]; then sed -i "22i => /~semaphore/gemlog/$filename.gmi $datey - $title" /home/filter/Documents/gemini/radio/radio.gmi elif [ $tag == 'kids' ]; then sed -i "26i => /~semaphore/gemlog/$filename.gmi $datey - $title" /home/filter/Documents/gemini/kids/kids.gmi fi gedit $gempath