pimutils / vdirsyncer

📇 Synchronize calendars and contacts.
https://vdirsyncer.pimutils.org/
Other
1.56k stars 161 forks source link

Make it possible to locally rename collections #833

Open gergelypolonkai opened 4 years ago

gergelypolonkai commented 4 years ago

I have two Google accounts, both having a “Holidays in Hungary” calendar and a “Contacts” calendar (with my contacts’ birthdays). They have the same IDs on the two accounts:

Discovering collections for pair cal_google_personal_to_local
[…]
  - "c5i68sj5edpm4rrfdchm6rreehgm6t3j81jn4rrle0n7cbj3c5m6arj4c5p2sprfdtjmop9ecdnmq@virtual" ("Contacts")
  - "cln2sq3ldpjm2sj9c5n26q3fdhkm8obp81jn4rrle0n7cbj3c5m6arj4c5p2sprfdtjmop9ecdnmq@virtual" ("Holidays in Hungary")
[…]
Discovering collections for pair cal_google_company_to_local
[…]
  - "c5i68sj5edpm4rrfdchm6rreehgm6t3j81jn4rrle0n7cbj3c5m6arj4c5p2sprfdtjmop9ecdnmq@virtual" ("Contacts")
  - "cln2sq3ldpjm2sj9c5n26q3fdhkm8obp81jn4rrle0n7cbj3c5m6arj4c5p2sprfdtjmop9ecdnmq@virtual" ("Holidays in Hungary")

I strongly suspect both have a global ID between all Google accounts.

It would be great to either

Currently using 0.16.8-2 from Arch repositories, which actually reports the version number 0.16.9.dev0+gb5dd092.d20200612. The problem seems to affect only Google calendar.

WhyNotHugo commented 4 years ago

There's a file called displayname in the calendar directory, you can just rename it there.

Does that work for you?

gergelypolonkai commented 4 years ago

@WhyNotHugo no, that only changes the display name of the calendar. The internal ID (c5i68… and cln2s…) remain the same regardless, and that’s what confuses vdirsyncer.

shymega commented 7 months ago

I'm coming across a possibly related issue - namely that the calid specified by Google in their CalDAV docs, is not matching with what vdirsyncer sees from the CalDAV API. Currently doing some digging, and I'll open a tracking issue here soon.

WhyNotHugo commented 7 months ago

I think I now properly understand your issue.

The internal id is extracted from the calendar's full URL. It cannot be changed (unless you change the remote URL).

However, you can tell vdirsyncer to synchronise local collection "abc" with remote collection "xyz". The syntax for this is the third example under "collections" in https://vdirsyncer.readthedocs.io/en/stable/config.html#pair-section

Basically, for cal_google_personal_to_local you'd specify something like:

collections = [["holidays", "cln2sq3ldpjm2sj9c5n26q3fdhkm8obp81jn4rrle0n7cbj3c5m6arj4c5p2sprfdtjmop9ecdnmq@virtual", "holidays-personal"]]

And for cal_google_company_to_local something like:

collections = [["holidays", "cln2sq3ldpjm2sj9c5n26q3fdhkm8obp81jn4rrle0n7cbj3c5m6arj4c5p2sprfdtjmop9ecdnmq@virtual", "holidays-company"]]
shymega commented 7 months ago

I think I now properly understand your issue.

The internal id is extracted from the calendar's full URL. It cannot be changed (unless you change the remote URL).

However, you can tell vdirsyncer to synchronise local collection "abc" with remote collection "xyz". The syntax for this is the third example under "collections" in https://vdirsyncer.readthedocs.io/en/stable/config.html#pair-section

Basically, for cal_google_personal_to_local you'd specify something like:

collections = [["holidays", "cln2sq3ldpjm2sj9c5n26q3fdhkm8obp81jn4rrle0n7cbj3c5m6arj4c5p2sprfdtjmop9ecdnmq@virtual", "holidays-personal"]]

And for cal_google_company_to_local something like:

collections = [["holidays", "cln2sq3ldpjm2sj9c5n26q3fdhkm8obp81jn4rrle0n7cbj3c5m6arj4c5p2sprfdtjmop9ecdnmq@virtual", "holidays-company"]]

It's interesting. I put a few debugging print statements in google.py to work out what collections vdirsyncer 'sees', and the calendar ID does match.

However, I'm only uploading calendar entries from locally to Google, and it would be ideal if vdirsyncer could handle the discovery automatically. However, I can use your workaround for now.

Just out of interest, would it be an option for vdirsyncer to use Google's native calendar/contacts APIs, or do we want to use the DAV approach?

Thanks.