To sync Orage with Google Calendar, it's possible to download Google Calendar in iCalendar format and import this into Orage.
To download the file, go to calendar settings and right click the green ICAL button next to Private Address.
Select Save Link As (or similar, according to browser) and save the file.
To import into Orage, Go to File > Exchange data > Foreign files, click the Open button, navigate to the saved file (basic.ics) and click Add. Events from Google Calendar will be added to any local Orage events.
To automate the process, we can use a cron command.
wget -NThe -N parameter will overwrite the file if it is newer on the sever, rather than adding files bacis.ics.1, bacis.ics.2 etc etc which we don't want.
To get the calendar URL, right click on the green ICAL button again but this time select Copy Link Location (or similar, according to browser).
Paste the address into a text editor to see it. There is a problem here because the Google email address that the URL contains will have been transformed into HTML URL Encoding, so joesmith@gmail.com will have become joesmith%40gmail.com (see: Try It Yourself) and the % character will not work in a cron command. Edit %40 back to @, so the full command looks like this:
wget -N https://www.google.com/calendar/ical/joesmith@gmail.com/private-/basic.icsNow we need to run the command once a day. Corenominal has a cron tutorial which covers this. Note: it may be necessary to specify the full path to wget with this method: /usr/bin/wget. I used a GUI application which uses cron to schedule tasks: Gnome-schedule, where the above command worked OK. Although it's a Gnome app, it installs in XFCE without needing any dependencies, and is simple to use.
The Run button didn't seem to work for me, perhaps because it is a Gnome app and is not properly configured to launch a terminal in XFCE. If you want to check your cron command is working, change Date & Time to Every minute and watch the basic.ics file appear in your home directory, then reset to daily, of course.
Update Nov 2022.
Here's a nice script from Stuff, geeky stuff to handle the download from the new Google location. As the author suggested, I did need to edit the wget command to one line. I edited the script slightly to add Google calendar information as a foreign file so I could keep local calendar entries.
# mv ~/.local/share/orage/orage.ics ~/.local/share/orage/orage_old.ics
mv ~/calendar/basic.ics ~/.local/share/orage/basic.ics
I also added the header #!/bin/bash, which probably anybody familiar with scripting would take for granted, but I add for the benefit of people like me who only hack other people's code from time to time.
I tried Adam MacLeod's suggestion from the comments using davespagnol's guide, but Google seem to have made obtaining a CalDAV API even more complicated since that guide was written - I gave up when they asked me to enter credit card details. Access seems to be aimed at software developers or businesses or institutions. Syncing works in Thunderbird so why bother?
That's what I've been looking for. Thanks for handy instruction.
ReplyDeleteI do the same thing, but use the following options, wget -T 5 -r -nH -nd -O /home/[username]/.local/share/orage/orage.ics [URL]. The -T 5 is a five second timeout, -r recursive, -nH and -nd is no hostname and no directory based upon the URL and path. This lets you specify the output directory and file name. Orage then always has your Google Cal updates. My cron job runs every hour.
ReplyDeleteThanks to you and JM, this is good.
ReplyDeleteand it Just Works™ in the unix spririt of things
Deletelol. the unix philosophy is 'do one thing and do it well'. you're thinking of Apple.
DeleteFor anyone still interested in this, the URL to use and the method to get your ICAL file manually from Google has changed quite a bit.
ReplyDeleteGo to calendar > settings, then you should 3 links listed horizontally like tabs, choose "Calendars", then you should see your calendar listed with your Name and a calendar icon beside it. Click that link, and then down near the bottom of the page you will see the green ICAL button next to "Private Address". Right click and copy the link location (or however you save a link in your browser ) and plug that into the command given by JM earlier. Note this link will be much different from the one described in the article.
Thanks for the update. Appreciated.
DeleteRather than Wget, try https://vdirsyncer.pimutils.org this handles the synchronization and (should) makes it bi-directional.
ReplyDelete