Commit 71761f4d authored by Tom Kunze's avatar Tom Kunze
Browse files

server/parse_univis: Parse single day events

parent 0e8190f7
......@@ -2,6 +2,7 @@ import sys
import datetime
import urllib.request
import collections
import dateutil.parser
from bs4 import BeautifulSoup
......@@ -123,7 +124,7 @@ def _get_all_events_in_rooms(roomnumbers):
# Yield all events in the room
for event in bs.find_all("event"):
if event is None or event.repeat is None:
if event is None:
continue
# Ignore event if not in this room
......@@ -139,7 +140,12 @@ def _get_all_events_in_rooms(roomnumbers):
# http://univis.uni-erlangen.de/userman/usermanse99.html#x124-26300019.4
# TODO block events b1
weekdays = None
if event.repeat.text[0:2] == "d1" or event.repeat.text[0:2] == "bd":
if event.repeat is None:
if not event.startdate.text == event.enddate.text:
print('Event without repeat over multiple days found: {}'.format(event.title.text), file=sys.stderr)
continue
weekdays = str(dateutil.parser.parse(event.startdate.text).weekday())
elif event.repeat.text[0:2] == "d1" or event.repeat.text[0:2] == "bd":
weekdays = "1,2,3,4,5,6,0"
elif event.repeat.text[0:2] == "w1":
weekdays = event.repeat.text[2:]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment