summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--infos.yaml5
-rwxr-xr-xmain.py26
2 files changed, 22 insertions, 9 deletions
diff --git a/infos.yaml b/infos.yaml
index c6eeeb0..7aa0f23 100644
--- a/infos.yaml
+++ b/infos.yaml
@@ -8,6 +8,7 @@ semester:
friday:
start: "12:15"
end: "14:00"
+# room: "A20"
wednesday:
start: "09:15"
end: "10:00"
@@ -22,6 +23,7 @@ output:
hidden: no
show_events: yes
show_time: yes
+ show_room: no
show_lecturers: yes
show_assignments: yes
show_dates: yes
@@ -37,6 +39,7 @@ output:
assignments: "Assignments"
dates: "Dates"
weeks: "Week {}"
+ rooms: "Room: {}"
deadlines:
hidden: no
msg_handout: "Mandatory assignment {} handout"
@@ -74,6 +77,8 @@ lectures:
name: "Parallel software and hardware"
date: "22/08/2025"
who: "Loïc"
+ slot:
+ room: "BB"
3:
name: "MPI"
date: "29/08/2025"
diff --git a/main.py b/main.py
index f987060..3b49d66 100755
--- a/main.py
+++ b/main.py
@@ -21,10 +21,14 @@ def getweek(d):
return d.isocalendar().week + i["output"]["week_drift"]
def getgloballectureslot(d):
dname=d.strftime("%A").lower()
- if dname in i["semester"]["lectures"]["slots"].keys():
- start=datetime.strptime(i["semester"]["lectures"]["slots"][dname]["start"], "%H:%M")
- end=datetime.strptime(i["semester"]["lectures"]["slots"][dname]["end"], "%H:%M")
- return (start,end)
+ slots=i["semester"]["lectures"]["slots"]
+ if dname in slots.keys():
+ start,end, room=(None,None,None)
+ if "start" in slots[dname].keys():
+ start=datetime.strptime(i["semester"]["lectures"]["slots"][dname]["start"], "%H:%M")
+ end=datetime.strptime(i["semester"]["lectures"]["slots"][dname]["end"], "%H:%M")
+ room=slots[dname]["room"] if "room" in slots[dname].keys() else None
+ return (start,end, room)
return None
def getassign(d):
val=""
@@ -42,16 +46,20 @@ def getlecture(d):
date=parse_date(i["lectures"][l]["date"])
if d==date:
# Time
- startT, endT = (None, None)
+ startT, endT, room = (None, None, None)
+ if slot is not None:
+ startT, endT, room=slot
if "slot" in i["lectures"][l]:
- startT=datetime.strptime(i["lectures"][l]["slot"]["start"], "%H:%M")
- endT=datetime.strptime(i["lectures"][l]["slot"]["end"], "%H:%M")
- elif slot is not None:
- startT, endT=slot
+ if "start" in i["lectures"][l]["slot"].keys():
+ startT=datetime.strptime(i["lectures"][l]["slot"]["start"], "%H:%M")
+ endT=datetime.strptime(i["lectures"][l]["slot"]["end"], "%H:%M")
+ room=i["lectures"][l]["slot"]["room"] if "room" in i["lectures"][l]["slot"].keys() else None
# Content
text=textwrap.fill(i["lectures"][l]["name"],o["text_wrap"])
if o["show_lecturers"]:
text+="\n"+textwrap.fill("("+i["lectures"][l]["who"]+")",o["text_wrap"])
+ if o["show_room"] and room is not None:
+ text=textwrap.fill(o["labels"]["rooms"].format(room),o["text_wrap"])+"\n"+text
if o["show_time"] and (startT,endT) != (None, None):
timeT=textwrap.fill(startT.strftime(i["output"]["time_format"])+"-"+endT.strftime(i["output"]["time_format"]),o["text_wrap"])
text=timeT+"\n"+text