diff --git a/parser.py b/parser.py index 0a16231..de4bc91 100755 --- a/parser.py +++ b/parser.py @@ -9,6 +9,19 @@ import caldav, icalendar # Constants definition URL = "https://docs.google.com/spreadsheets/u/0/d/e/2PACX-1vQ9yzFLr5mXbIZVK3ucdUZuScAbLoCyPqzHr-5V0aYeCFEz7LuidPdk_EnkkJT-zjemzQQHaKvpeXW2/pubhtml/sheet?headers=false&gid=1619638924" +TIMETABLE = [ + ('08:00','08:00'), + ('09:00','09:00'), + ('10:00','10:15'), + ('11:15','11:15'), + ('12:15','12:15'), + ('13:00','13:00'), + ('13:30','13:30'), + ('14:30','14:30'), + ('15:30','15:45'), + ('16:45','16:45'), + ('17:45','17:45'), +] class GoogleSheetsCalParser(HTMLParser): @@ -18,14 +31,18 @@ class GoogleSheetsCalParser(HTMLParser): """ def __init__(self): self.inTable = False - self.row = 0 - self.column = 0 + self.row = -1 + self.column = -1 HTMLParser.__init__(self) def handle_starttag(self, tag, attrs): if self.inTable: - ... - elif tag == 'table': + if tag == 'tr': + self.row += 1 + self.column = -1 + elif tag == 'td': + self.column += 1 + elif tag == 'tbody': self.inTable = True def handle_endtag(self, tag):