This process/tools described below are no longer in use. See My Tools for details on what I currently use.
This script is pretty basic. It uses a list of calendars from a text file of the format:
Then the conversion to the reminder format is handled by a Perl script that I got from https://www.roaringpenguin.com/wiki/index.php/ICal2Rem
There is a bug in the perl module iCal-Parser where it ignores timezone on ical events Bug Report. I've applied the patch mentioned in the report and that seems to have fixed my issues.
#!/bin/bash # calendar-urls.txt is a text file with one line per ics to fetch # each line has two values, the name (which must be unique) # and the url while read line do set $line # Breaks the string into $1, $2, ... rm -f ~/.cal/$1.ics /usr/local/bin/wget -q -O ~/.cal/$1.ics $2 done < ~/.cal/calendar-urls.txt # Convert the local calendars and those fetched from the above loop # to remind format cat ~/.cal/*.ics | /usr/bin/perl ~/.cal/ical2rem.pl --lead-time 0 --no-todos --label "#### Calendar" > ~/.cal/all.rem
The script above pushes my calendar data into the Remind format. From there, I'm able to use Remind to get my calendar for the day. I do a little sed parsing to clean up the output and add the markup that I need to make these appear in Obsidian the way I want.
# -b1 use a 24-hour time format # -gaaad -sorting - date ascending, time ascending, priority ascending, untimed reminders are sorted before timed reminders # -f remain in the foreground # -q don't queue timed reminders remind -b1 -gaaad -f -q ~/.reminders | sed -e 's/^.*today at /- [ ] /' -e 's/^.*today //' | sed -e 's/\\,/,/g' -e 's/\\n/; /g' -e 's/\\;/; /g' | sed '/^#### Calendar Events:/d' | sed 's/^\([^#|-]\)/\1/'
My ~/.reminders file includes the default reminder file, a bit for sunrise/sunset and a few recurring events, then it includes the output of the above ical2rem.pl execution.
include /Users/mckeehan/remind/def.rem BANNER % ; show sunrise/sunset SET $LongDeg -83 SET $LongMin 37 SET $LongSec 37 SET $LatDeg 35 SET $LatMin 58 SET $LatSec 28 ; MSG Sunrise at [sunrise(trigdate())], Sunset at [sunset(trigdate())], next full moon at [moontime(2)] on [moondate(2)]% ; prettify the sunrise/sunset/moon data fset _srtd() coerce("STRING", _no_lz(_am_pm(sunrise(today())))) fset _sstd() coerce("STRING", _no_lz(_am_pm(sunset(today())))) fset _srtm() coerce("STRING", _no_lz(_am_pm(sunrise(today()+1)))) fset _sstm() coerce("STRING", _no_lz(_am_pm(sunset(today()+1)))) MSG - Sunrise at [_srtd()], Sunset at [_sstd()].%"%"% MSG - Next full moon: [mon(moondate(2))] [day(moondate(2))], [year(moondate(2))].%"%" MSG #### Schedule:%"%"% include /Users/mckeehan/remind/othercals.rem
I encountered issues downloading my work Google calendar, but I found that the Private iCal address was not available. It turns out there's a setting in the Google Apps admin console that will enable this feature. See How to Enable the iCal Private Addresses for Google Apps.