diff options
author | Blaise Thompson <blaise@untzag.com> | 2024-09-08 19:27:49 -0500 |
---|---|---|
committer | Blaise Thompson <blaise@untzag.com> | 2024-09-08 19:27:49 -0500 |
commit | 60129403d091ccc56868b9b420c8be8efb284e85 (patch) | |
tree | 0ccc01edf7ae69596fc36b5035ae752b85736072 | |
parent | 8ae7213ba802c05e2eac5b1855d49274656a0d1b (diff) |
from remote
-rw-r--r-- | build.py | 44 |
1 files changed, 24 insertions, 20 deletions
@@ -56,22 +56,25 @@ with open(org_fp, "r") as org: events.append(Event(line)) -url = "https://outlook.office365.com/owa/calendar/db2d3e0f0490459a80c4b837118e4bf1@wisc.edu/f6a2b5209cd6432c96f52939cacdbedd2266851683387467601/calendar.ics" -subprocess.run(["curl", url, "-o", "/home/nginx/pycal2org/uw-madison.ics"]) -proc = subprocess.Popen(["python3", "/home/nginx/pycal2org/pycal2org.py", "/home/nginx/pycal2org/uw-madison.ics", ">", "/home/nginx/pycal2org/uw-madison.org"]) -org = proc.stdout.read() -for line in org: - line = line.strip() - if not line: - continue - if not line[0] == "*": - continue - if ":private:" in line: - continue - if ":info:" in line: - continue - events.append(Event(line)) +subprocess.run(["python3", "/home/nginx/agenda/uw_madison_ics.py"]) + +org_fp = "/home/nginx/org/uw-madison.org" + +events = [] + +with open(org_fp, "r") as org: + for line in org: + line = line.strip() + if not line: + continue + if not line[0] == "*": + continue + if ":private:" in line: + continue + if ":info:" in line: + continue + events.append(Event(line)) # create html ------------------------------------------------------------------------------------- @@ -117,14 +120,15 @@ with open(__here__ / "public" / "index.html", "w") as html: f"<h3 id={id}><a href=#{id}>{day.isoformat()} {day.strftime('%A')}</a></h3>" ) for event in events: - if event.end: + try: + total = event.end - event.timestamp + assert total.days > 0 + elapsed = total - (event.end - day) if event.timestamp <= day and event.end >= day: - total = event.end - event.timestamp - elapsed = total - (event.end - day) - html.write( + html.write( f"(day {elapsed.days+1}/{total.days+1}) {event.description}<br>" ) - else: + except: if event.timestamp == day: html.write(f"{event.description}<br>") # increment |