summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoïc Guégan <manzerbredes@mailbox.org>2025-07-26 09:08:18 +0200
committerLoïc Guégan <manzerbredes@mailbox.org>2025-07-26 09:08:18 +0200
commit3ce1b64c601feb91a87fb5e093eb04f228c56e1e (patch)
treec9241a61efa66879dbd80259cbdb279cee239bfa
parentcb7e02e1b061ddfcd34cbe3c38951bba0944030e (diff)
Minor changes
-rw-r--r--infos.yaml9
-rwxr-xr-xmain.py19
2 files changed, 28 insertions, 0 deletions
diff --git a/infos.yaml b/infos.yaml
index b9d53d8..07dfac0 100644
--- a/infos.yaml
+++ b/infos.yaml
@@ -3,9 +3,15 @@ course: "Parallel Programming"
semester:
start: "11/08/2025"
end: "15/12/2025"
+ lectures:
+ slots:
+ monday:
+ start: "2pm"
+ end: "3pm"
output:
date_format: "%b %d"
+ time_format: "%H:%M"
format: "text" # Or html/json/csv/latex/mediawiki
week_drift: 0 # Add constant offset to week numbers
tables:
@@ -57,6 +63,9 @@ lectures:
name: "Introduction"
date: "13/08/2025"
who: "Loïc"
+ slot:
+ start: "5pm"
+ end: "6pm"
2:
name: "Parallel software and hardware"
date: "22/08/2025"
diff --git a/main.py b/main.py
index a4912ec..bfc63b8 100755
--- a/main.py
+++ b/main.py
@@ -19,6 +19,13 @@ def formatday(d):
return d.strftime(i["output"]["date_format"])
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"], "%I%p")
+ end=datetime.strptime(i["semester"]["lectures"]["slots"][dname]["end"], "%I%p")
+ (start,end)
+ return None
def getassign(d):
val=""
for a in i["assignments"]:
@@ -30,12 +37,24 @@ def getassign(d):
val+=str(a)
return val
def getlecture(d):
+ slot=getgloballectureslot(d)
for l in i["lectures"]:
date=parse_date(i["lectures"][l]["date"])
if d==date:
+ # Time
+ startT, endT = (None, None)
+ if "slot" in i["lectures"][l]:
+ startT=datetime.strptime(i["lectures"][l]["slot"]["start"], "%I%p")
+ endT=datetime.strptime(i["lectures"][l]["slot"]["end"], "%I%p")
+ elif slot is not None:
+ startT, endT=slot
+ # 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 (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
return text
return ""
def getevents(d):