Compare commits

...

2 Commits

6 changed files with 144 additions and 0 deletions

View File

@ -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
1 datum vreme lokacija tema
10 08-05-2023 19:00 DC Krov https://www.openstreetmap.org/node/10594728522 Linux install day
11 09-05-2023 19:00 DC Krov https://www.openstreetmap.org/node/10594728522 Cryptoparty - Uvod u privatnost
12 11-05-2023 18:00 Polyhedra https://www.openstreetmap.org/node/4856556781 Uvod u racunarske mreze
13 01-08-2023 19:00 DC Krov Tehno veče
14 07-08-2023 19:00 DC Krov Linux ricing
15 08-08-2023 19:00 DC Krov Lambda račun
16 14-08-2023 19:00 DC Krov Linux distro diskusija
17 15-08-2023 19:00 DC Krov Pirati 777 mora
18 21-08-2023 19:00 DC Krov Python vežbe
19 22-08-2023 19:00 DC Krov Autentifikacija na internetu
20 28-08-2023 19:00 DC Krov Kviz

BIN
font/Facade-Sud.woff Normal file

Binary file not shown.

Binary file not shown.

9
poster.html Normal file
View File

@ -0,0 +1,9 @@
<html><head><link rel="stylesheet" href="styles/poster.css"><head><body><main><h1>DECENTRALA</h1><h2>Plan za Avgust</h2><table><tr><td>UTO</td><td>1.</td><td> Tehno veče</td></tr>
<tr><td>PON</td><td>7.</td><td> Linux ricing</td></tr>
<tr><td>UTO</td><td>8.</td><td> Lambda račun</td></tr>
<tr><td>PON</td><td>14.</td><td> Linux distro diskusija</td></tr>
<tr><td>UTO</td><td>15.</td><td> Pirati 777 mora</td></tr>
<tr><td>PON</td><td>21.</td><td> Python vežbe</td></tr>
<tr><td>UTO</td><td>22.</td><td> Autentifikacija na internetu</td></tr>
<tr><td>PON</td><td>28.</td><td> Kviz</td></tr>
</table><p>Radionice počinju u <strong>19h</strong> u Društvenom centru Krov u <strong>Kraljice Marije 47</strong>.</p><p>Ulaz u zgradu je u prolazu pored Štark prodavnice slatkiša, odmah pored menjačnice. DC Krov je na poslednjem spratu.</p><div id=link>dmz.rs</div></main></body></html>

58
poster.py Normal file
View File

@ -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"<tr><td>{date}</td><td>{day}.</td><td>{title}</td></tr>\n"
return html
def render_page(table: str) -> str:
head = "<head><link rel=\"stylesheet\" href=\"styles/poster.css\"><head>"
header = "<h1>DECENTRALA</h1>"
subheader = f"<h2>Plan za {MONTHS_SR[NEXT_MONTH.month - 1]}</h2>"
link = "<div id=link>dmz.rs</div>"
p1 = "<p>Radionice počinju u <strong>19h</strong> u Društvenom centru Krov u <strong>Kraljice Marije 47</strong>.</p>"
p2 = "<p>Ulaz u zgradu je u prolazu pored Štark prodavnice slatkiša, odmah pored menjačnice. DC Krov je na poslednjem spratu.</p>"
return f"<html>{head}<body><main>{header}{subheader}<table>{table}</table>{p1}{p2}{link}</main></body></html>"
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()

69
styles/poster.css Normal file
View File

@ -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;
}