From 4d843a125449ab2c0ea1f3a9cf5cc28551798408 Mon Sep 17 00:00:00 2001 From: Marko Kevac Date: Thu, 25 Jul 2024 20:47:34 +0200 Subject: [PATCH] add an ability to add links to events --- dogadjaji.csv | 4 ++-- prep.py | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/dogadjaji.csv b/dogadjaji.csv index c8f3de1..33f8a59 100644 --- a/dogadjaji.csv +++ b/dogadjaji.csv @@ -1,4 +1,4 @@ -datum, vreme, lokacija, tema, tip, +datum, vreme, lokacija, tema, tip, link 20-12-2022, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Uvod u računarske mreže, , 03-01-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Hackathon žurka, hack, 16-01-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Privatnost na internetu, workshop, @@ -162,7 +162,7 @@ datum, vreme, lokacija, tema, tip, 09-07-2024, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Hakaton, hack, 12-07-2024, 15:00, KC Gnezdo https://osm.org/go/xftd8rbl2, Uticaj tehnologije na kulturu, lecture, 14-07-2024, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Napadi na vestacku inteligenciju, lecture discussion -29-07-2024, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, OnionShare, lecture +29-07-2024, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, OnionShare, lecture, https://forum.dmz.rs/t/plan-za-jul-2024/612/17?u=mkevac 30-07-2024, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, CryptoPals #1, workshop 15-08-2024, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, GETÖSEFÖHN, music 15-09-2024, 12:00, KC Magacin https://www.openstreetmap.org/node/1226456745#map=19/44.81314/20.45378, Dekonferencija, conference, diff --git a/prep.py b/prep.py index eae1c33..2c4929d 100755 --- a/prep.py +++ b/prep.py @@ -29,11 +29,16 @@ def load_events(csv_path:str) -> list[dict]: event_location = event[2] event_title = event[3] types = event[4].split() + try: + link = event[5] + except IndexError: + link = "" current_event = {"date":event_date_parsed, "time":event_time, "location": event_location, "title":event_title.strip(), - "types": types } + "types": types, + "link": link} events.append(current_event) return events @@ -47,7 +52,10 @@ def build_html(events: list[dict], dayNames: list[str], typesNames: dict) -> str time = event["time"]+"h" event_html = [] event_html.append(f"
{date} {time}
") - event_html.append(f"
{title}
") + if event["link"] != "": + event_html.append(f"
{title}
") + else: + event_html.append(f"
{title}
") if "https://" in location: place,link = location.split("https://") event_html.append(f"
@{place.strip()}
") -- 2.30.2