Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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
#Format:TAG,ADDRESS#Remove this line#
home,https://path/to/home/calendar/basic.ics
work,https://path/to/work/calendar/basic.ics
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.