Added TIMETABLE
This commit is contained in:
parent
812e163169
commit
4be55f963c
1 changed files with 21 additions and 4 deletions
25
parser.py
25
parser.py
|
@ -9,6 +9,19 @@ import caldav, icalendar
|
||||||
|
|
||||||
# Constants definition
|
# Constants definition
|
||||||
URL = "https://docs.google.com/spreadsheets/u/0/d/e/2PACX-1vQ9yzFLr5mXbIZVK3ucdUZuScAbLoCyPqzHr-5V0aYeCFEz7LuidPdk_EnkkJT-zjemzQQHaKvpeXW2/pubhtml/sheet?headers=false&gid=1619638924"
|
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):
|
class GoogleSheetsCalParser(HTMLParser):
|
||||||
|
@ -18,14 +31,18 @@ class GoogleSheetsCalParser(HTMLParser):
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.inTable = False
|
self.inTable = False
|
||||||
self.row = 0
|
self.row = -1
|
||||||
self.column = 0
|
self.column = -1
|
||||||
HTMLParser.__init__(self)
|
HTMLParser.__init__(self)
|
||||||
|
|
||||||
def handle_starttag(self, tag, attrs):
|
def handle_starttag(self, tag, attrs):
|
||||||
if self.inTable:
|
if self.inTable:
|
||||||
...
|
if tag == 'tr':
|
||||||
elif tag == 'table':
|
self.row += 1
|
||||||
|
self.column = -1
|
||||||
|
elif tag == 'td':
|
||||||
|
self.column += 1
|
||||||
|
elif tag == 'tbody':
|
||||||
self.inTable = True
|
self.inTable = True
|
||||||
|
|
||||||
def handle_endtag(self, tag):
|
def handle_endtag(self, tag):
|
||||||
|
|
Reference in a new issue