Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CipMap
CipMap
Commits
71761f4d
Commit
71761f4d
authored
Apr 01, 2019
by
Tom Kunze
Browse files
server/parse_univis: Parse single day events
parent
0e8190f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
django/server/management/commands/parse_univis.py
View file @
71761f4d
...
...
@@ -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
:]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment