vdirsyncer icon indicating copy to clipboard operation
vdirsyncer copied to clipboard

Make it possible to locally rename collections

Open gergelypolonkai opened this issue 4 years ago • 5 comments

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

  • give such calendars a different ID locally (my contacts on one account might differ from contacts on the other, so i might want to see the birthdays from both, without every sync causing a conflict), or
  • ignore them (Hungarian holidays are the same regardless of the Google account i’m syncing; this use case is probably the same as the one in #590).

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.

gergelypolonkai avatar Jun 16 '20 06:06 gergelypolonkai

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

Does that work for you?

WhyNotHugo avatar Jun 16 '20 14:06 WhyNotHugo

@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.

gergelypolonkai avatar Jun 18 '20 04:06 gergelypolonkai

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.

shymega avatar Mar 22 '24 00:03 shymega

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"]]

WhyNotHugo avatar Mar 22 '24 11:03 WhyNotHugo

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.

shymega avatar Mar 22 '24 16:03 shymega