Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update existing ICS with re-import? #730

Closed
ajkessel opened this issue Aug 30, 2024 · 5 comments
Closed

Update existing ICS with re-import? #730

ajkessel opened this issue Aug 30, 2024 · 5 comments
Labels
Milestone

Comments

@ajkessel
Copy link
Contributor

ajkessel commented Aug 30, 2024

The latest code will refuse to re-import an ICS where the UID for the event already exists in Google.

But what if the appointment info has changed -- is there a way to update the Google event based on the new information in the ICS?

I thought this was made possible with PR #712 but maybe I'm misunderstanding it.

Is there any elegant solution here short of using the legacy import switch?

One approach might be to use edit but I'm looking to script this, not have it execute interactively.

Note that if you've deleted the item via gcalcli, gcalcli still sees it as a duplicate and refuses to re-import.

@dbarnett
Copy link
Collaborator

Yup, I noticed this. See https://github.com/insanum/gcalcli/pull/712/files#r1731770966.

IMO it should prompt for whether to update existing event after "import" reports it as a duplicate (probably invoking "insert" in that case, or maybe trying to do more of a "patch" on the existing event), and then respect a flag like --no-interactive to make it just warn and skip or something like that.

@dbarnett dbarnett added this to the 4.5 milestone Aug 30, 2024
@ajkessel
Copy link
Contributor Author

In the meantime, what is the best workaround? I guess you could delete the event and then re-import with legacy-import? Is there something else that makes more sense?

@dbarnett
Copy link
Collaborator

IDK if there's a great workaround for your case besides waiting for a new version. =/

If it were me in a pinch, I'd probably try to fork the ics file to split out the problematic VEVENT objects into their own file and then import --use-legacy-import that one. That might actually be another nice layer of fallback to have in gcalcli too, to always dump a tmp ics file with any events it skipped importing so you can conveniently retry after any failure scenario.

dbarnett added a commit that referenced this issue Sep 26, 2024
Quality-of-life improvement for scenarios like #730 so that it's easier to retry failed events with different settings (--use-legacy-import etc).
@dbarnett
Copy link
Collaborator

Few updates here as I'm getting closer to a 4.5 release milestone:

  1. Any failed imports will now get dumped to a rej.ics file in tmp so if you just want to insert them all instead, you'll be able to conveniently do that with a command like gcalcli import --use-legacy-import /tmp/gcalcli.d3adb33f/rej.ics.
  2. The behavior of updating existing events is still weird and I haven't tracked down the exact issues yet, but I suspect it's a straight-up bug in the Calendar API. They accept a sequence number but don't seem to take it into account at all for import.
  3. I'm having second thoughts about having import be just the new default, considering it has so many behavior quirks and in the API docs they say it's used to add a private copy of an existing event to a calendar. May be too late to completely reverse course, but I might make some tweaks to make it rely more on insert in the future where possible.

I probably won't stall the 4.5 release on figuring out The Whole Story for 2 and 3, but 1 is done now and that'll give us nice trivial workaround in the 4.5 release.

@dbarnett
Copy link
Collaborator

K, forking off the more nuanced parts of this fix into #784 and marking this part as Fixed. It's now possible to re-import to update events but manual and clunky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants