Information Radiator: Calendar

Adding calendar functionality to the information radiator involves pointing the plugin at an .ical file that lives on a website; unfortunately when I logged onto my calendar using WebDav, I didn’t find a single .ical file with all my events in there, I found over a thousand tiny .ical files, each with a single event. What I needed to do was combine all the tiny .ical files into one chunky .ical file, then point the calendar at the chunky .ical file. Here we go.
I created a new VM especially for this task, my thinking was I could probably use the VM for backup tasks later too. I installed Ubuntu server 20.04 LTS, I’d already upgraded all my other Linux installations to 20.04 LTS at the begining of lockdown. Having all your machines on the same OS makes troubleshooting and maintenance easier.
I first needed to download the tiny .ical files from the WebDav folder so I could process them. .ical files are just text files, so I thought I could write a script to combine them all together once I’d obtained them. I first tried to get files using the wget command, but couldn’t get it to connect & download reliably so I used davfs2 to mount the WebDav directory under Linux so I had easy access to the .ical files.
The next step was to process the tiny .ical files into one chunky .ical file; as they are only text files a bit of file manipulation should work wonders. I’m more familiar with Windows scripts than Linux scripts so while looking for a command line reference site I stumbled across a script that did exactly what I wanted. The script was at & this is it, just in case that source vanishes:

echo “BEGIN:VCALENDAR” >> merge;
for file in *.ics; do
cat “$file” | sed -e ‘$d’ $1 | sed -e ‘1,/VEVENT/{/VEVENT/p;d}’ $2 >> merge;
mv merge merge.ics
echo “END:VCALENDAR” >> merge.ics;

So I copied the .ical files from the mounted WebDav directory into a temporary location, then ran the merge script in the temporary folder. This created the chunky .ical file I was after.

I then needed to point the calendar at the chunky .ical file but the calendar only accepts a web address for the source. I have secure online storage so I then upload the chunky .ical file to the online storage & pointed the calendar at that.

All that worked beautifully. The script runs every 15 minutes using cron, keeping the Information Radiator calendar current. The .ical file contains all events from the calendar which is a bit overkill as the calendar on the Information Radiator only shows the next 5 days. The file is pretty small though & I can periodically copy the chunky .ical file as a backup.

Leave a Reply

Your email address will not be published. Required fields are marked *