Fixed issues and print useful info
This commit is contained in:
parent
0f19dc902d
commit
2857556170
1 changed files with 8 additions and 6 deletions
14
parser.py
14
parser.py
|
@ -100,23 +100,25 @@ class GoogleSheetsCalParser(HTMLParser):
|
|||
cal.add_component(self.event)
|
||||
|
||||
try:
|
||||
print(self.event['uid'])
|
||||
ev = self.calendar.event_by_uid(self.event['uid'])
|
||||
except caldav.lib.error.NotFoundError:
|
||||
ev = None
|
||||
if ev:
|
||||
icev = Calendar.from_ical(ev.data)
|
||||
ex = True
|
||||
for key in ['summary', 'dtstart', 'dtend']:
|
||||
if icev.subcomponents[1][key] != self.event[key]:
|
||||
ex = False
|
||||
if icev.subcomponents[1]['summary'] != self.event['summary']:
|
||||
ex = False
|
||||
else:
|
||||
for key in ['dtstart', 'dtend']:
|
||||
if icev.subcomponents[1][key].to_ical() != self.event[key].to_ical():
|
||||
ex = False
|
||||
if ex: return
|
||||
print(f'Change on {self.event["dtstart"]}')
|
||||
print(f'Change on {self.event.decoded("dtstart").isoformat()}')
|
||||
ev.data = cal.to_ical().decode('utf-8')
|
||||
ev.save()
|
||||
return
|
||||
|
||||
print(f'New event on {self.event["dtstart"]}')
|
||||
print(f'New event on {self.event.decoded("dtstart").isoformat()}')
|
||||
self.calendar.save_event(cal.to_ical().decode('utf-8'))
|
||||
elif tag == 'tr':
|
||||
for mr in self.multirows.values():
|
||||
|
|
Reference in a new issue