Fixed data issue

This commit is contained in:
Edgar P. Burkhart 2020-09-21 07:49:26 +02:00
parent 436a334fd0
commit bdbca9bbc3
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227

View file

@ -45,6 +45,8 @@ class GoogleSheetsCalParser(HTMLParser):
self.rowspan = 0
self.multirows = {}
self.date = {}
self.event = Event()
self.event['uid'] = 0
import priv
@ -106,16 +108,19 @@ class GoogleSheetsCalParser(HTMLParser):
cal = Calendar()
cal.add('prodid', '-//edpibu//edt-parser//FR')
cal.add('version', '2.0')
event = Event()
event.add('uid', f'{self.row}x{self.column}')
event.add('summary', data)
event.add('dtstamp', dt.now())
print(self.row, self.column, times)
event.add('dtstart', dt.combine(self.date[self.column], times[0],
pytz.timezone('Europe/Paris')))
event.add('dtend', dt.combine(self.date[self.column], times[1],
pytz.timezone('Europe/Paris')))
cal.add_component(event)
if self.event['uid'] == f'{self.row}x{self.column}':
self.event['summary'] = f'{self.event["summary"]} {data}'
else:
self.event = Event()
self.event.add('uid', f'{self.row}x{self.column}')
self.event.add('summary', data)
self.event.add('dtstamp', dt.now())
print(self.row, self.column, times)
self.event.add('dtstart', dt.combine(self.date[self.column], times[0],
pytz.timezone('Europe/Paris')))
self.event.add('dtend', dt.combine(self.date[self.column], times[1],
pytz.timezone('Europe/Paris')))
cal.add_component(self.event)
self.calendar.save_event(cal.to_ical().decode('utf-8'))