feat: Now more timezone aware than ever
This commit is contained in:
parent
31d7c67783
commit
7553028f2d
6 changed files with 73 additions and 52 deletions
|
|
@ -24,7 +24,9 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
packages = [
|
packages = [
|
||||||
|
pkgs.google-fonts
|
||||||
pkgs.hanken-grotesk
|
pkgs.hanken-grotesk
|
||||||
|
pkgs.typstyle
|
||||||
pkgs.uv
|
pkgs.uv
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ dependencies = [
|
||||||
"premailer==3.10.0",
|
"premailer==3.10.0",
|
||||||
"python-dateutil==2.9.0.post0",
|
"python-dateutil==2.9.0.post0",
|
||||||
"python-dotenv==1.1.1",
|
"python-dotenv==1.1.1",
|
||||||
|
"pytz==2026.1.post1",
|
||||||
"requests==2.32.4",
|
"requests==2.32.4",
|
||||||
"six==1.17.0",
|
"six==1.17.0",
|
||||||
"soupsieve==2.7",
|
"soupsieve==2.7",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import sys
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
from pytz import timezone
|
||||||
|
|
||||||
MOBILIZON_API_URL = "https://events.hs3.pl/api"
|
MOBILIZON_API_URL = "https://events.hs3.pl/api"
|
||||||
QUERY_LIMIT = 100
|
QUERY_LIMIT = 100
|
||||||
|
|
@ -122,12 +123,15 @@ def get_raw_events():
|
||||||
|
|
||||||
ev["txt_description"] = BeautifulSoup(ev["description"], "html.parser").get_text()
|
ev["txt_description"] = BeautifulSoup(ev["description"], "html.parser").get_text()
|
||||||
|
|
||||||
begins = ev["beginsOn"].split("T")
|
local_tz = timezone("Europe/Warsaw")
|
||||||
ends = ev["endsOn"].split("T")
|
begins_date = datetime.datetime.fromisoformat(ev["beginsOn"]).astimezone(local_tz)
|
||||||
txt_date = f"{begins[0]} {begins[1][:-4]}-"
|
ends_date = datetime.datetime.fromisoformat(ev["endsOn"]).astimezone(local_tz)
|
||||||
|
begins = (begins_date.strftime("%Y-%m-%d"), begins_date.strftime("%H:%M"))
|
||||||
|
ends = (ends_date.strftime("%Y-%m-%d"), ends_date.strftime("%H:%M"))
|
||||||
|
txt_date = f"{begins[0]} {begins[1]}-"
|
||||||
if begins[0] != ends[0]:
|
if begins[0] != ends[0]:
|
||||||
txt_date += f"{ends[0]}"
|
txt_date += f"{ends[0]}"
|
||||||
txt_date += f"{ends[1][:-4]}"
|
txt_date += f"{ends[1]}"
|
||||||
ev["txt_date"] = txt_date
|
ev["txt_date"] = txt_date
|
||||||
|
|
||||||
extract_picture(ev)
|
extract_picture(ev)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
width="1122.52"
|
width="1122.52"
|
||||||
height="1587.4"
|
height="1587.4"
|
||||||
viewBox="0 0 1122.52 1587.4"
|
viewBox="0 0 1122.52 1587.4"
|
||||||
sodipodi:docname="PLAKAT_01 do svg.svg"
|
sodipodi:docname="PLAKAT_01 do svg_20260503.svg"
|
||||||
inkscape:version="1.2.2 (732a01da63, 2022-12-09)"
|
inkscape:version="1.2.2 (732a01da63, 2022-12-09)"
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
|
@ -178,7 +178,7 @@
|
||||||
inkscape:window-x="2869"
|
inkscape:window-x="2869"
|
||||||
inkscape:window-y="1609"
|
inkscape:window-y="1609"
|
||||||
inkscape:window-maximized="1"
|
inkscape:window-maximized="1"
|
||||||
inkscape:current-layer="g19">
|
inkscape:current-layer="g17">
|
||||||
<inkscape:page
|
<inkscape:page
|
||||||
x="0"
|
x="0"
|
||||||
y="0"
|
y="0"
|
||||||
|
|
@ -25080,7 +25080,7 @@
|
||||||
<g
|
<g
|
||||||
id="g14253">
|
id="g14253">
|
||||||
<path
|
<path
|
||||||
d="m 17.6307,281.137 v -7.5 h 50.3148 v 7.5 H 17.6307"
|
d="m 17.6307,285.977 v -7.5 h 50.3148 v 7.5 H 17.6307"
|
||||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
id="path14255" />
|
id="path14255" />
|
||||||
</g>
|
</g>
|
||||||
|
|
@ -25096,7 +25096,7 @@
|
||||||
id="g14267">
|
id="g14267">
|
||||||
<text
|
<text
|
||||||
xml:space="preserve"
|
xml:space="preserve"
|
||||||
transform="translate(64.0293,788.42)"
|
transform="translate(64.0293,802.139)"
|
||||||
style="font-variant:normal;font-weight:normal;font-size:17.0079px;font-family:Rajdhani;-inkscape-font-specification:Rajdhani-Regular;writing-mode:lr-tb;fill:#df0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
style="font-variant:normal;font-weight:normal;font-size:17.0079px;font-family:Rajdhani;-inkscape-font-specification:Rajdhani-Regular;writing-mode:lr-tb;fill:#df0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||||
id="text14271"><tspan
|
id="text14271"><tspan
|
||||||
x="0 9.4826775 18.897324 27.478582 36.53606 45.763618 53.970707 58.507099 67.989777 77.404427 81.977997 91.834854 100.90934"
|
x="0 9.4826775 18.897324 27.478582 36.53606 45.763618 53.970707 58.507099 67.989777 77.404427 81.977997 91.834854 100.90934"
|
||||||
|
|
@ -25105,7 +25105,7 @@
|
||||||
id="tspan14269">DOŁĄCZ DO NAS</tspan></text>
|
id="tspan14269">DOŁĄCZ DO NAS</tspan></text>
|
||||||
<text
|
<text
|
||||||
xml:space="preserve"
|
xml:space="preserve"
|
||||||
transform="translate(174.467,788.42)"
|
transform="translate(174.467,802.139)"
|
||||||
style="font-variant:normal;font-weight:normal;font-size:17.0079px;font-family:Rajdhani;-inkscape-font-specification:Rajdhani-Regular;writing-mode:lr-tb;fill:#df0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
style="font-variant:normal;font-weight:normal;font-size:17.0079px;font-family:Rajdhani;-inkscape-font-specification:Rajdhani-Regular;writing-mode:lr-tb;fill:#df0000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||||
id="text14275"><tspan
|
id="text14275"><tspan
|
||||||
x="0"
|
x="0"
|
||||||
|
|
@ -25118,7 +25118,7 @@
|
||||||
<g
|
<g
|
||||||
id="g14277">
|
id="g14277">
|
||||||
<path
|
<path
|
||||||
d="m 17.7841,289.783 v -7.5 h 50.1614 v 7.5 H 17.7841"
|
d="m 17.7841,298 v -7.5 H 67.9455 V 298 H 17.7841"
|
||||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||||
id="path14279" />
|
id="path14279" />
|
||||||
</g>
|
</g>
|
||||||
|
|
@ -25134,7 +25134,7 @@
|
||||||
id="g14291">
|
id="g14291">
|
||||||
<text
|
<text
|
||||||
xml:space="preserve"
|
xml:space="preserve"
|
||||||
transform="matrix(1.10257,0,0,1,98.6195,812.928)"
|
transform="matrix(1.10257,0,0,1,98.6195,836.221)"
|
||||||
style="font-variant:normal;font-weight:bold;font-size:17.0079px;font-family:Rajdhani;-inkscape-font-specification:Rajdhani-Bold;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
style="font-variant:normal;font-weight:bold;font-size:17.0079px;font-family:Rajdhani;-inkscape-font-specification:Rajdhani-Bold;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||||
id="text14295"><tspan
|
id="text14295"><tspan
|
||||||
x="0 9.7771587"
|
x="0 9.7771587"
|
||||||
|
|
@ -25143,7 +25143,7 @@
|
||||||
id="tspan14293">hs</tspan></text>
|
id="tspan14293">hs</tspan></text>
|
||||||
<text
|
<text
|
||||||
xml:space="preserve"
|
xml:space="preserve"
|
||||||
transform="matrix(1.10257,0,0,1,116.58,812.928)"
|
transform="matrix(1.10257,0,0,1,116.58,836.221)"
|
||||||
style="font-variant:normal;font-weight:bold;font-size:17.0079px;font-family:Rajdhani;-inkscape-font-specification:Rajdhani-Bold;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
style="font-variant:normal;font-weight:bold;font-size:17.0079px;font-family:Rajdhani;-inkscape-font-specification:Rajdhani-Bold;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||||
id="text14299"><tspan
|
id="text14299"><tspan
|
||||||
x="0"
|
x="0"
|
||||||
|
|
@ -25151,7 +25151,7 @@
|
||||||
id="tspan14297">3</tspan></text>
|
id="tspan14297">3</tspan></text>
|
||||||
<text
|
<text
|
||||||
xml:space="preserve"
|
xml:space="preserve"
|
||||||
transform="matrix(1.10257,0,0,1,126.059,812.928)"
|
transform="matrix(1.10257,0,0,1,126.059,836.221)"
|
||||||
style="font-variant:normal;font-weight:bold;font-size:17.0079px;font-family:Rajdhani;-inkscape-font-specification:Rajdhani-Bold;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
style="font-variant:normal;font-weight:bold;font-size:17.0079px;font-family:Rajdhani;-inkscape-font-specification:Rajdhani-Bold;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||||
id="text14303"><tspan
|
id="text14303"><tspan
|
||||||
x="0"
|
x="0"
|
||||||
|
|
@ -25159,7 +25159,7 @@
|
||||||
id="tspan14301">.</tspan></text>
|
id="tspan14301">.</tspan></text>
|
||||||
<text
|
<text
|
||||||
xml:space="preserve"
|
xml:space="preserve"
|
||||||
transform="matrix(1.10257,0,0,1,129.925,812.928)"
|
transform="matrix(1.10257,0,0,1,129.925,836.221)"
|
||||||
style="font-variant:normal;font-weight:bold;font-size:17.0079px;font-family:Rajdhani;-inkscape-font-specification:Rajdhani-Bold;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
style="font-variant:normal;font-weight:bold;font-size:17.0079px;font-family:Rajdhani;-inkscape-font-specification:Rajdhani-Bold;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||||
id="text14307"><tspan
|
id="text14307"><tspan
|
||||||
x="0 9.8499956"
|
x="0 9.8499956"
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
|
|
@ -10,20 +10,18 @@
|
||||||
margin: (top: .5cm, bottom: .5cm, x: 0cm),
|
margin: (top: .5cm, bottom: .5cm, x: 0cm),
|
||||||
)
|
)
|
||||||
|
|
||||||
#set text(fill: white)
|
#place(
|
||||||
|
top + left,
|
||||||
|
dx: 8mm,
|
||||||
|
dy: -14mm,
|
||||||
|
image("assets/hs3_logo_hires.png", height: 58mm, width: 58mm),
|
||||||
|
)
|
||||||
|
|
||||||
#place(
|
#place(
|
||||||
top+left,
|
top + left,
|
||||||
dx: 8mm,
|
|
||||||
dy: -14mm,
|
|
||||||
image("assets/hs3_logo_hires.png", height: 58mm, width: 58mm),
|
|
||||||
)
|
|
||||||
|
|
||||||
#place(
|
|
||||||
top+left,
|
|
||||||
dx: 13mm,
|
dx: 13mm,
|
||||||
dy: 145mm,
|
dy: 145mm,
|
||||||
qr-code("https://hs3.pl", width: 32mm)
|
qr-code("https://hs3.pl", width: 32mm),
|
||||||
)
|
)
|
||||||
|
|
||||||
#let add_event(number, title, description, date, address) = {
|
#let add_event(number, title, description, date, address) = {
|
||||||
|
|
@ -31,11 +29,12 @@
|
||||||
let ey = 46mm + calc.div-euclid(number, 2) * 76mm
|
let ey = 46mm + calc.div-euclid(number, 2) * 76mm
|
||||||
|
|
||||||
set text(
|
set text(
|
||||||
font: ("Hanken Grotesk"),
|
fill: white,
|
||||||
|
font: "Rajdhani",
|
||||||
)
|
)
|
||||||
|
|
||||||
place(
|
place(
|
||||||
top+left,
|
top + left,
|
||||||
dx: ex,
|
dx: ex,
|
||||||
dy: ey,
|
dy: ey,
|
||||||
block(
|
block(
|
||||||
|
|
@ -45,24 +44,27 @@
|
||||||
[
|
[
|
||||||
#block(
|
#block(
|
||||||
height: 14mm,
|
height: 14mm,
|
||||||
title
|
text(
|
||||||
)
|
weight: "bold",
|
||||||
#move(dy: 4mm,
|
title,
|
||||||
block(
|
),
|
||||||
height: 3mm,
|
|
||||||
clip: true,
|
|
||||||
text(weight: "bold", size: 9pt, date)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
#move(dy: 10mm,
|
|
||||||
block(
|
|
||||||
height: 12mm,
|
|
||||||
clip: true,
|
|
||||||
text(size: 9pt, address)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
#move(dy: 3mm, block(
|
||||||
|
height: 8mm,
|
||||||
|
clip: true,
|
||||||
|
text(
|
||||||
|
weight: "bold",
|
||||||
|
size: 10pt,
|
||||||
|
date,
|
||||||
|
),
|
||||||
|
))
|
||||||
|
#move(dy: 4mm, block(
|
||||||
|
height: 12mm,
|
||||||
|
clip: true,
|
||||||
|
text(size: 10pt, address),
|
||||||
|
))
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,7 +72,13 @@
|
||||||
#let index = 0
|
#let index = 0
|
||||||
|
|
||||||
#for event in events {
|
#for event in events {
|
||||||
add_event(index, event.title, event.txt_description, event.txt_date, "Hackerspace Trójmiasto, al. Wojska Polskiego 41, Gdańsk")
|
add_event(
|
||||||
|
index,
|
||||||
|
event.title,
|
||||||
|
event.txt_description,
|
||||||
|
event.txt_date,
|
||||||
|
"Hackerspace Trójmiasto, al. Wojska Polskiego 41, Gdańsk",
|
||||||
|
)
|
||||||
|
|
||||||
index = index + 1
|
index = index + 1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,16 +25,16 @@
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
place(
|
place(
|
||||||
top+left,
|
top + left,
|
||||||
dx: 94mm,
|
dx: 94mm,
|
||||||
dy: -4mm,
|
dy: -4mm,
|
||||||
image("assets/hs3_logo_hires.png", height: 38mm, width: 38mm),
|
image("assets/hs3_logo_hires.png", height: 38mm, width: 38mm),
|
||||||
)
|
)
|
||||||
|
|
||||||
set text(font: ("Hanken Grotesk"), size: 14pt)
|
set text(font: "Hanken Grotesk", size: 14pt)
|
||||||
|
|
||||||
place(
|
place(
|
||||||
top+left,
|
top + left,
|
||||||
dx: 12mm,
|
dx: 12mm,
|
||||||
dy: 30mm,
|
dy: 30mm,
|
||||||
block(
|
block(
|
||||||
|
|
@ -49,16 +49,15 @@
|
||||||
weight: "bold",
|
weight: "bold",
|
||||||
grid(
|
grid(
|
||||||
columns: (1fr, 1fr),
|
columns: (1fr, 1fr),
|
||||||
date.split(" ").at(0),
|
date.split(" ").at(0), align(right)[#date.split(" ").at(1)],
|
||||||
align(right)[#date.split(" ").at(1)]
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
address,
|
address,
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
align(right+bottom)[#text(size: 14pt, weight: "bold", name)]
|
align(right + bottom)[#text(size: 14pt, weight: "bold", name)]
|
||||||
}
|
}
|
||||||
|
|
||||||
#let events = none
|
#let events = none
|
||||||
|
|
@ -70,7 +69,14 @@
|
||||||
#let index = 0
|
#let index = 0
|
||||||
|
|
||||||
#for event in events {
|
#for event in events {
|
||||||
make_event_card(event.title, event.txt_description, event.txt_date, "Gdańsk, al. Wojska Polskiego 41", event.picture, event.speaker)
|
make_event_card(
|
||||||
|
event.title,
|
||||||
|
event.txt_description,
|
||||||
|
event.txt_date,
|
||||||
|
"Gdańsk, al. Wojska Polskiego 41",
|
||||||
|
event.picture,
|
||||||
|
event.speaker,
|
||||||
|
)
|
||||||
|
|
||||||
index = index + 1
|
index = index + 1
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue