diff --git a/dogadjaji.csv b/dogadjaji.csv index 56d9ff7..fe54839 100644 --- a/dogadjaji.csv +++ b/dogadjaji.csv @@ -10,3 +10,11 @@ datum, vreme, lokacija, tema 08-05-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Linux install day 09-05-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Cryptoparty - Uvod u privatnost 11-05-2023, 18:00, Polyhedra https://www.openstreetmap.org/node/4856556781, Uvod u racunarske mreze +01-08-2023, 19:00, DC Krov, Tehno veče +07-08-2023, 19:00, DC Krov, Linux ricing +08-08-2023, 19:00, DC Krov, Lambda račun +14-08-2023, 19:00, DC Krov, Linux distro diskusija +15-08-2023, 19:00, DC Krov, Pirati 777 mora +21-08-2023, 19:00, DC Krov, Python vežbe +22-08-2023, 19:00, DC Krov, Autentifikacija na internetu +28-08-2023, 19:00, DC Krov, Kviz \ No newline at end of file diff --git a/font/Facade-Sud.woff b/font/Facade-Sud.woff new file mode 100644 index 0000000..bf24115 Binary files /dev/null and b/font/Facade-Sud.woff differ diff --git a/font/JetBrainsMono-Regular.ttf b/font/JetBrainsMono-Regular.ttf new file mode 100644 index 0000000..42e9fba Binary files /dev/null and b/font/JetBrainsMono-Regular.ttf differ diff --git a/poster.html b/poster.html new file mode 100644 index 0000000..857c8ee --- /dev/null +++ b/poster.html @@ -0,0 +1,9 @@ +

DECENTRALA

Plan za Avgust

+ + + + + + + +
UTO1. Tehno veče
PON7. Linux ricing
UTO8. Lambda račun
PON14. Linux distro diskusija
UTO15. Pirati 777 mora
PON21. Python vežbe
UTO22. Autentifikacija na internetu
PON28. Kviz

Radionice počinju u 19h u Društvenom centru Krov u Kraljice Marije 47.

Ulaz u zgradu je u prolazu pored Štark prodavnice slatkiša, odmah pored menjačnice. DC Krov je na poslednjem spratu.

\ No newline at end of file diff --git a/poster.py b/poster.py new file mode 100644 index 0000000..24085e2 --- /dev/null +++ b/poster.py @@ -0,0 +1,58 @@ +import csv +import datetime as dt +from dateutil import relativedelta + +EVENTS_CSV_PATH = "dogadjaji.csv" +CURRENT_TIME = dt.date.today() +NEXT_MONTH = CURRENT_TIME + relativedelta.relativedelta(months=1, day=1) +DAYS_OF_WEEK_SR = ("PON", "UTO", "SRE", "CET", "PET", "SUB", "NED") +MONTHS_SR = ("Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar") + +def load_events(csv_path:str) -> list[dict]: + events = [] + with open(csv_path) as csv_file: + csv_reader = csv.reader(csv_file) + next(csv_reader, None) + for event in csv_reader: + event_date = event[0] + event_date_parsed = dt.datetime.strptime(event_date, "%d-%m-%Y").date() + event_time = event[1] + event_title = event[3] + current_event = {"date":event_date_parsed, + "time":event_time, + "title":event_title} + + if event_date_parsed >= NEXT_MONTH: + events.append(current_event) + + return events + +def render_table(events:list[dict])-> str: + html = "" + for event in events: + date = DAYS_OF_WEEK_SR[event["date"].weekday()] + day = event["date"].day + title = event["title"] + html += f"{date}{day}.{title}\n" + return html + +def render_page(table: str) -> str: + head = "" + header = "

DECENTRALA

" + subheader = f"

Plan za {MONTHS_SR[NEXT_MONTH.month - 1]}

" + link = "" + p1 = "

Radionice počinju u 19h u Društvenom centru Krov u Kraljice Marije 47.

" + p2 = "

Ulaz u zgradu je u prolazu pored Štark prodavnice slatkiša, odmah pored menjačnice. DC Krov je na poslednjem spratu.

" + return f"{head}
{header}{subheader}{table}
{p1}{p2}{link}
" + +def main(): + events = load_events(EVENTS_CSV_PATH) + table = render_table(events) + page = render_page(table) + f = open("poster.html", "w") + f.write(page) + f.close() + + +if __name__ == "__main__": + main() diff --git a/styles/poster.css b/styles/poster.css new file mode 100644 index 0000000..322e903 --- /dev/null +++ b/styles/poster.css @@ -0,0 +1,69 @@ + +html { + +} + +@font-face { + font-family: Facade; + src: url(../font/Facade-Sud.woff); +} + + +@font-face { + font-family: jetbrains-mono; + src: url(../font/JetBrainsMono-Regular.ttf); +} + +html, body { + margin: 0; + padding: 0; +} + +main { + max-width: 1200px; + margin: auto; + font-family: 'jetbrains-mono'; + padding: 2.3rem; +} + +h1 { + font-family: 'Facade'; + text-align: center; + font-size: 5rem; + margin: 0rem; +} + +h2 { + text-align: center; + margin-top: 0.0rem; + margin-bottom: 2rem; + font-size: 2rem; +} + + +p { + font-size: 1.5rem; +} + +table { + margin: 4rem 0; +} + +td { + font-size: 1.8rem; + padding-top: 0.5rem; +} + +td:first-child { + width: 3.5rem; +} + +td:nth-child(2) { + padding-right: 1rem; +} + +#link { + margin-top: 8rem; + text-align: right; + font-size: 3rem; +} \ No newline at end of file