public
Last active

Downloads multiple Google calendars, converts them to Reminder's format if they have changed and tags them. The .reminders file should contain INCLUDE lines pointing to ~/.local/share/remind/TAG Requires: ical2rem, wget

  • Download Gist
remupdate.conf
1 2 3
#Format:TAG,ADDRESS#Remove this line#
home,https://path/to/home/calendar/basic.ics
work,https://path/to/work/calendar/basic.ics
remupdate.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#!/bin/bash
#This should be set to your Reminder's calendar file. It should be a collection of lines like:
#INCLUDE [getenv("HOME")]/.local/share/remind/TAG
REMMAIN=~/.reminders
 
#This should be set to a file which contains the names and webaddresses of your Google calendars
GCCFG=~/.config/remupdate.conf
 
#You should not need to modify anything below this line
GCALS=( `cat $GCCFG` )
TMPFOL=/tmp/ical2rem-`RANDOM=</dev/urandom tr -dc A-Za-z0-9 | head -c 8`
 
mkdir -p $TMPFOL
mkdir -p ~/.local/share/remind/ics/
 
for ENTRY in "${GCALS[@]}"
do
ICAL=`echo $ENTRY | sed 's/^.*,//g'`
TAG=`echo $ENTRY | sed 's/,.*//g'`
echo "Downloading calendar $TAG..."
wget -qO $TMPFOL/basic.ics "$ICAL"
touch ~/.local/share/remind/ics/$TAG.ics
if [ `diff -u <(sed '/DTSTAMP:/d' $TMPFOL/basic.ics) <(sed '/DTSTAMP:/d' ~/.local/share/remind/ics/$TAG.ics) | wc -l` -ne 0 ] ; then
echo "`diff -u <(sed '/DTSTAMP:/d' $TMPFOL/basic.ics) <(sed '/DTSTAMP:/d' ~/.local/share/remind/ics/$TAG.ics) | wc -l` changes detected. Updating $TAG..."
mv $TMPFOL/basic.ics ~/.local/share/remind/ics/$TAG.ics
ical2rem ~/.local/share/remind/ics/$TAG.ics --label "$TAG" | sed "s/%\"/%\"\($TAG\)\ /" > ~/.local/share/remind/$TAG
else
echo "No changes detected. Skipping..."
fi
done

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.