Page 2 of 2

Re: HOW-TO: Sync Orage with your Google Calendar.

Posted: Thu Sep 27, 2018 5:22 pm
by davemx
Yes, a lot of the reason I like to leave HOW-TOs on the forum is that I can refer back to them if I need to reinstall!

Re: HOW-TO: Sync Orage with your Google Calendar.

Posted: Tue Oct 30, 2018 1:47 pm
by Spidrena
Thanks, your How-to works perfectly.
I only have one question:
How can I sync entries into Orage calendar back to the Google Calendar?

greetz;
Spidrena

Re: HOW-TO: Sync Orage with your Google Calendar.

Posted: Mon Nov 19, 2018 1:10 pm
by davemx
Spidrena wrote: Tue Oct 30, 2018 1:47 pm Thanks, your How-to works perfectly.
I only have one question:
How can I sync entries into Orage calendar back to the Google Calendar?

greetz;
Spidrena
I wish I knew! It should "just work" but it doesn't in my case either. You can be sure that if I ever find out, I will post it!

Re: HOW-TO: Sync Orage with your Google Calendar.

Posted: Sun May 26, 2019 5:55 pm
by davemx
I've discovered a slightly easier way of doing this. The earlier problem was that the version of vdirsyncer in MX repositories was old and didn't work in this case, so I used an alpha version that installs in an awkward place. I've since discovered that we shouldn't be installing it like that anyway. The correct way is via pip3 install.

Will write up soon.

Re: HOW-TO: Sync Orage with your Google Calendar.

Posted: Tue May 28, 2019 2:09 pm
by davemx
OK here goes...

1. INSTALLING vdirsyncer ON YOUR COMPUTER

Firstly, you need to install, from MX Package Installer or Synaptic, a program called python3-pip.

You have to open a Root Terminal on your computer, and enter the following two commands.

pip3 install vdirsyncer
pip3 install requests_oauthlib


This installs vdirsyncer in the folder /usr/local/bin/

Re: HOW-TO: Sync Orage with your Google Calendar.

Posted: Tue May 28, 2019 2:51 pm
by davemx
2. OPENING YOUR GOOGLE ACCOUNT UP TO vdirsyncer

If you already did this (using the previous method perhaps), then you don't need to do it again, instead, just move the files called config and google_token in your folder ~/.vdirsyncer/ to somewhere safe, and skip to section 3.

Otherwise, log into the Google API dashboard. https://console.cloud.google.com/apis/dashboard

Once there click on "+ ENABLE APIS AND SERVICES" near the top of the screen.

This takes you to a search screen, and in the search box, enter "caldav". You will get a box to click on, "CalDAV API" which you should select. You will need to Create Credentials. In return, you will get two long IDs, client_id and client_secret.

Open your File Manager, and Show Hidden Files, click into .config and create a folder within that called vdirsyncer — and inside that create a text file called config.

You should create a folder under ~/.local/share/orage/ which is your gmail address (shown as youraddress@gmail.com in the file that follows).

config should look like this. You will use your own gmail address, client_id and client_secret, but everything else should be typed exactly as I have:

Code: Select all

[general] 
status_path = "~/.vdirsyncer/status/" 

[pair mygoogle_calendar] 
a = "mygoogle_calendar_local" 
b = "mygoogle_calendar_remote" 
collections = ["from a", "from b"] 

[storage mygoogle_calendar_local] 
type = "singlefile" 
path = "~/.local/share/orage/youraddress@gmail.com/%s.ics" 

[storage mygoogle_calendar_remote] 
type = "google_calendar" 
token_file = "~/.vdirsyncer/google_token"
client_id = "1235467890abcdefghijklmnopqrstuvwxyz.apps.googleusercontent.com"
client_secret = "1234567890abcdefghijklmnop"

Now, make a folder in your home folder (not under .config) called "./vdirsyncer", inside that, create another folder called "status", and inside that, another folder called "calendar".

That's the preparation done...

Now for the moment of truth. You need to open a terminal, and run the following command as user:

vdirsyncer discover

A browser window should pop up to complete the authorisation, and that will create an access token, another long string of characters, which you need to copy to your clipboard. Meanwhile, the terminal goes into a "waiting" state. If you click on the terminal and hit a key, you will be prompted for the access token, which you should paste in. Keep an eye on the text that outputs to the terminal, in order to know that everything has gone ok.

Finally, you can run the following command as user do download your data files from Google for the first time:

vdirsyncer sync

Re: HOW-TO: Sync Orage with your Google Calendar.

Posted: Tue May 28, 2019 3:04 pm
by davemx
3. IF YOU HAD vdirsyncer SET UP BEFORE

Open your File Manager, and Show Hidden Files, click into .config and create a folder within that called vdirsyncer — and inside that, copy the text files you saved earlier called config and google_token.

You should create a folder under ~/.local/share/orage/ which is your gmail address (shown as youraddress@gmail.com in the file that follows).

config should be changed to look like this. You will use your own gmail address after path = , client_id and client_secret, but everything else look exactly like this:

Code: Select all

[general] 
status_path = "~/.vdirsyncer/status/" 

[pair mygoogle_calendar] 
a = "mygoogle_calendar_local" 
b = "mygoogle_calendar_remote" 
collections = ["from a", "from b"] 

[storage mygoogle_calendar_local] 
type = "singlefile" 
path = "~/.local/share/orage/youraddress@gmail.com/%s.ics" 

[storage mygoogle_calendar_remote] 
type = "google_calendar" 
token_file = "~/.vdirsyncer/google_token"
client_id = "1235467890abcdefghijklmnopqrstuvwxyz.apps.googleusercontent.com"
client_secret = "1234567890abcdefghijklmnop"

Finally, open a terminal and run as user:

vdirsyncer sync

You'll be able to see if everything is working OK.

Re: HOW-TO: Sync Orage with your Google Calendar.

Posted: Tue May 28, 2019 3:16 pm
by davemx
4. SETTING UP THE CRON JOB

Because vdirsyncer is in a folder that is part of the normal path for both root and user, setting up the cron job is far less fraught than in the earlier method. You literally don't have to worry about paths they take care of themselves.

To make it for once an hour, in a terminal you run the command:

crontab -e

An editor opens and at the bottom you add a line:

36 * * * * /usr/local/bin/vdirsyncer sync

All the "36" means is that the line runs on minute 36 of each hour, and the four stars mean every hour, every day of month, every month, and every day of week. If you have more than one hourly cron job, spread them out!

In order to save the change you do CTRL+O (letter O for output), and to exit, CTRL+X.

When the sync finishes, you should have one or more files in the folder "/home/your-user-name/.local/share/orage/you@gmail.com/" which you can now link to orage.

You have to click on your panel orage time and date to bring up the calendar. You link the calendars by clicking on File>Exchange Data, and the tab called Foreign Files.

I would add each of the ics files one at a time so that you can see what data each of the files contains from your Google Calendar. Some will contain birthdays calculated from your contact list, or maybe info from a public calendar (such as public holidays in your country) — these need to be marked READ ONLY. At least one will be your appointments list, and you need to make that READ-WRITE.

See the next post re: using Orage to add to your calendar.

Re: HOW-TO: Sync Orage with your Google Calendar.

Posted: Tue Jun 25, 2019 8:00 am
by davemx
Spidrena wrote: Tue Oct 30, 2018 1:47 pm Thanks, your How-to works perfectly.
I only have one question:
How can I sync entries into Orage calendar back to the Google Calendar?

greetz;
Spidrena
I think the answer was staring me in the face all along! I wish that some of Orage was better laid out. Anyway, when you create a new entry, there is a pull-down menu which enables you to add it to any calendar you've marked as READ-WRITE. Click this link to view:

https://drive.google.com/open?id=1C2Tbo ... fJNqVrHt_E

I have a sub-calendar called Diary and that's where I put appointments.

It gives some worrying messages if you run vdirsyncer sync in a terminal when there's uploading to be done, but ignore them.