💾 Archived View for gemini.cyberbot.space › scripts › dailydigests.txt captured on 2022-04-29 at 12:28:14.

View Raw

More Information

⬅️ Previous capture (2021-11-30)

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

#!/bin/bash

TODAY=$(date +%Y-%m-%d)
YESTERDAY=$(date -d yesterday +%Y-%m-%d)
TWODAYS=$(date -d "2 days ago" +%Y-%m-%d)
ANTENNA="gemini://warmedal.se/~antenna/filter/unVZVAAHNogZNmmpWxzjdsimQcBGGIUn"
COMITIUM="gemini://gemini.cyberbot.space/feed.gmi"
NEWS="gemini://rawtext.club/~sloum/geminews/npr/"

tmp_d=$(mktemp -d)
tmpcomitium1="$tmp_d/comitium1.txt"
tmpcomitium2="$tmp_d/comitium2.txt"
tmpantenna1="$tmp_d/antenna1.txt"
tmpantenna2="$tmp_d/antenna2.txt"
tmpnews="$tmp_d/news.txt"

trap 'rm -rf -- "$tmp_d"' EXIT

mkdir -p $HOME/dailydigest
rm $HOME/dailydigest/*

# comitium feed digest for today
gmni -j once $COMITIUM | tail -n +9 | awk -v today="## $TODAY" -v yesterday="## $YESTERDAY" '$0 ~ today {flag=1} $0 ~ yesterday {flag=0} flag {print $2}' | awk '/gemini/ {print}' | xargs -d 


\n' sh -c 'for arg do gmni -j once -L "$arg"; echo -e "\n<========================>\n"; done' > $tmpcomitium1
ebook-convert $tmpcomitium1 $HOME/dailydigest/$TODAY-comitium.pdb --title=$TODAY-Gemini
ebook-convert $tmpcomitium1 $HOME/dailydigest/$TODAY-comitium.epub --title=$TODAY-Gemini

# comitium feed digest for yesterday
gmni -j once $COMITIUM | tail -n +9 | awk -v twodays="## $TWODAYS" -v yesterday="## $YESTERDAY" '$0 ~ yesterday {flag=1} $0 ~ twodays {flag=0} flag {print $2}' | awk '/gemini/ {print}' | xargs -d 


\n' sh -c 'for arg do gmni -j once -L "$arg"; echo -e "\n<========================>\n"; done' > $tmpcomitium2
ebook-convert $tmpcomitium2 $HOME/dailydigest/$YESTERDAY-comitium.pdb --title=$YESTERDAY-Gemini
ebook-convert $tmpcomitium2 $HOME/dailydigest/$YESTERDAY-comitium.epub --title=$YESTERDAY-Gemini

# Antenna feed digest for today
gmni -j once $ANTENNA | grep $TODAY | awk '!/(.mp4|.mp3)/ {print $2}' | xargs -d 


\n' sh -c 'for arg do gmni -j once -L "$arg"; echo -e "\n<========================>\n"; done' > $tmpantenna1
ebook-convert $tmpantenna1 $HOME/dailydigest/$TODAY-antenna.pdb --title=$TODAY-antenna
ebook-convert $tmpantenna1 $HOME/dailydigest/$TODAY-antenna.epub --title=$TODAY-antenna

# Antenna feed digest for yesterday
gmni -j once $ANTENNA | grep $YESTERDAY | awk '!/(.mp4|.mp3)/ {print $2}' | xargs -d 


\n' sh -c 'for arg do gmni -j always -L "$arg"; echo -e "\n<========================>\n"; done' > $tmpantenna2
ebook-convert $tmpantenna2 $HOME/dailydigest/$YESTERDAY-antenna.pdb --title=$YESTERDAY-antenna
ebook-convert $tmpantenna2 $HOME/dailydigest/$YESTERDAY-antenna.epub --title=$YESTERDAY-antenna

# NPR News for today
gmni -j once $NEWS | awk -v news="$NEWS" '{sub("=> ",news)} $1 ~ /.gmi/ {print $1}' | xargs -n1 gmni -j once -L > $tmpnews
ebook-convert $tmpnews $HOME/dailydigest/$TODAY-news.pdb --formatting-type=plain --title=$TODAY-news
ebook-convert $tmpnews $HOME/dailydigest/$TODAY-news.epub --title=$TODAY-news