gcalcli
gcalcli copied to clipboard
make it so that imported events retain UID and duplicate IDs will fail gracefully
see #583 and #492
I modified this for my own purposes and I stopped at "it works for my use case and doesn't make any tests fail". I don't think I missed anything important but I don't mind spending some more time on it if needed. I think not importing defaults is pretty reasonable default behavior -- I personally would not expect an import to create duplicate events if the event IDs are the same. Thoughts?
I don't have time to get familiar with that part of the codebase and review but I agree with your description of the desired behavior. Basically I think this should try to reproduce what the Google Calendar web interface does when given repeated imports of the same thing, which to my knowledge is as you describe.
I have tested this PR and can confirm it works as expected, thanks!
Here's more feedback:
In its current state this PR does not allow importing updated events (ie. SEQUENCE got incremented).
Ideally gcalcli would fetch the existing event (same UID) and update it if SEQUENCE has been incremented and ignore events who have not changed (same UID and same SEQUENCE)
Updating events would be a much welcome behavior! It would be even better than a graceful fail.
May I suggest using service.events().import(**kwargs) instead of service.events().insert(**kwargs), when 'iCalUID' in event
is True
?
I did some tests from the google developers API page, the behavior of import
seems correct.
I can create an other pull request but I wanted to have your thoughts first!