Skip to content
Snippets Groups Projects
Verified Commit 8a8b8428 authored by Anton Akhmerov's avatar Anton Akhmerov
Browse files

use a converted schedule

parent 05dd9034
No related branches found
No related tags found
2 merge requests!65Crystal structure changes,!16WIP: exercises lecture 7 (Tight-Binding)
Pipeline #14586 passed
......@@ -7,8 +7,9 @@ stages:
build lectures:
stage: build
before_script:
- pip install -U mkdocs mkdocs-material python-markdown-math notedown
- pip install -U mkdocs mkdocs-material python-markdown-math notedown ics
script:
- python convert_timetable.py
- python execute.py
- mkdocs build
artifacts:
......
from pathlib import Path
import re
import json
import dateutil
import ics
course = ics.Calendar(Path('mytimetable_export.ics').read_text())
events = []
def parse_data(description):
type_conversion = {
'Exam/Test in Osiris': 'Exam',
'Exam/Test not in Osiris': 'Minitest',
'Lecture': 'Lecture',
'Instruction': 'Exercises',
}
type = type_conversion[re.search(
'^Type: (.*)$', description, flags=re.MULTILINE
).group(1)]
out = re.search(
'^Location\\(s\\):\n(?P<name>.*?): (?P<url>http:.*?)$',
description,
flags=re.MULTILINE,
).groupdict()
out['type'] = type
return out
for original in course.events:
parsed = parse_data(original.description)
event = {
'start': str(original.begin),
'end': str(original.end),
'title': f'{parsed["type"]} @ {parsed["name"]}',
}
events.append(event)
events = sorted(events, key=(lambda event: dateutil.parser.isoparse(event['start'])))
events[-1]['title'] = events[-1]['title'].replace('Exam', 'Retake exam')
Path('src/figures/events.json').write_text(json.dumps(events))
This diff is collapsed.
......@@ -4,7 +4,12 @@ Welcome to the 2019 run of the TN2844 course *Vaste Stof Fysica*.
## Schedule
<iframe src="https://calendar.google.com/calendar/embed?showTitle=0&amp;showNav=0&amp;showDate=0&amp;showPrint=0&amp;showTabs=0&amp;showCalendars=0&amp;showTz=0&amp;mode=AGENDA&amp;height=600&amp;wkst=1&amp;bgcolor=%23FFFFFF&amp;src=19fiq3qk5670c38d0hlb3q0kdg%40group.calendar.google.com&amp;color=%23711616&amp;ctz=Europe%2FAmsterdam" style="border-width:0" width="100%" height="400" frameborder="0" scrolling="no"></iframe>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.10.0/fullcalendar.min.css'></link>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.23.0/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.10.0/fullcalendar.min.js"></script>
<script src="../scripts/fullcalendar_loader.js"></script>
<div id='calendar'></div>
## Discussion chat
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment