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 = [
|
||||
pkgs.google-fonts
|
||||
pkgs.hanken-grotesk
|
||||
pkgs.typstyle
|
||||
pkgs.uv
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ dependencies = [
|
|||
"premailer==3.10.0",
|
||||
"python-dateutil==2.9.0.post0",
|
||||
"python-dotenv==1.1.1",
|
||||
"pytz==2026.1.post1",
|
||||
"requests==2.32.4",
|
||||
"six==1.17.0",
|
||||
"soupsieve==2.7",
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import sys
|
|||
import requests
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
from pytz import timezone
|
||||
|
||||
MOBILIZON_API_URL = "https://events.hs3.pl/api"
|
||||
QUERY_LIMIT = 100
|
||||
|
|
@ -122,12 +123,15 @@ def get_raw_events():
|
|||
|
||||
ev["txt_description"] = BeautifulSoup(ev["description"], "html.parser").get_text()
|
||||
|
||||
begins = ev["beginsOn"].split("T")
|
||||
ends = ev["endsOn"].split("T")
|
||||
txt_date = f"{begins[0]} {begins[1][:-4]}-"
|
||||
local_tz = timezone("Europe/Warsaw")
|
||||
begins_date = datetime.datetime.fromisoformat(ev["beginsOn"]).astimezone(local_tz)
|
||||
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]:
|
||||
txt_date += f"{ends[0]}"
|
||||
txt_date += f"{ends[1][:-4]}"
|
||||
txt_date += f"{ends[1]}"
|
||||
ev["txt_date"] = txt_date
|
||||
|
||||
extract_picture(ev)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
width="1122.52"
|
||||
height="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)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
|
|
@ -178,7 +178,7 @@
|
|||
inkscape:window-x="2869"
|
||||
inkscape:window-y="1609"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="g19">
|
||||
inkscape:current-layer="g17">
|
||||
<inkscape:page
|
||||
x="0"
|
||||
y="0"
|
||||
|
|
@ -25080,7 +25080,7 @@
|
|||
<g
|
||||
id="g14253">
|
||||
<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"
|
||||
id="path14255" />
|
||||
</g>
|
||||
|
|
@ -25096,7 +25096,7 @@
|
|||
id="g14267">
|
||||
<text
|
||||
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"
|
||||
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"
|
||||
|
|
@ -25105,7 +25105,7 @@
|
|||
id="tspan14269">DOŁĄCZ DO NAS</tspan></text>
|
||||
<text
|
||||
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"
|
||||
id="text14275"><tspan
|
||||
x="0"
|
||||
|
|
@ -25118,7 +25118,7 @@
|
|||
<g
|
||||
id="g14277">
|
||||
<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"
|
||||
id="path14279" />
|
||||
</g>
|
||||
|
|
@ -25134,7 +25134,7 @@
|
|||
id="g14291">
|
||||
<text
|
||||
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"
|
||||
id="text14295"><tspan
|
||||
x="0 9.7771587"
|
||||
|
|
@ -25143,7 +25143,7 @@
|
|||
id="tspan14293">hs</tspan></text>
|
||||
<text
|
||||
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"
|
||||
id="text14299"><tspan
|
||||
x="0"
|
||||
|
|
@ -25151,7 +25151,7 @@
|
|||
id="tspan14297">3</tspan></text>
|
||||
<text
|
||||
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"
|
||||
id="text14303"><tspan
|
||||
x="0"
|
||||
|
|
@ -25159,7 +25159,7 @@
|
|||
id="tspan14301">.</tspan></text>
|
||||
<text
|
||||
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"
|
||||
id="text14307"><tspan
|
||||
x="0 9.8499956"
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
|
|
@ -10,8 +10,6 @@
|
|||
margin: (top: .5cm, bottom: .5cm, x: 0cm),
|
||||
)
|
||||
|
||||
#set text(fill: white)
|
||||
|
||||
#place(
|
||||
top + left,
|
||||
dx: 8mm,
|
||||
|
|
@ -23,7 +21,7 @@
|
|||
top + left,
|
||||
dx: 13mm,
|
||||
dy: 145mm,
|
||||
qr-code("https://hs3.pl", width: 32mm)
|
||||
qr-code("https://hs3.pl", width: 32mm),
|
||||
)
|
||||
|
||||
#let add_event(number, title, description, date, address) = {
|
||||
|
|
@ -31,7 +29,8 @@
|
|||
let ey = 46mm + calc.div-euclid(number, 2) * 76mm
|
||||
|
||||
set text(
|
||||
font: ("Hanken Grotesk"),
|
||||
fill: white,
|
||||
font: "Rajdhani",
|
||||
)
|
||||
|
||||
place(
|
||||
|
|
@ -45,24 +44,27 @@
|
|||
[
|
||||
#block(
|
||||
height: 14mm,
|
||||
title
|
||||
text(
|
||||
weight: "bold",
|
||||
title,
|
||||
),
|
||||
)
|
||||
#move(dy: 4mm,
|
||||
block(
|
||||
height: 3mm,
|
||||
#move(dy: 3mm, block(
|
||||
height: 8mm,
|
||||
clip: true,
|
||||
text(weight: "bold", size: 9pt, date)
|
||||
)
|
||||
)
|
||||
#move(dy: 10mm,
|
||||
block(
|
||||
text(
|
||||
weight: "bold",
|
||||
size: 10pt,
|
||||
date,
|
||||
),
|
||||
))
|
||||
#move(dy: 4mm, block(
|
||||
height: 12mm,
|
||||
clip: true,
|
||||
text(size: 9pt, address)
|
||||
)
|
||||
)
|
||||
text(size: 10pt, address),
|
||||
))
|
||||
],
|
||||
)
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -70,7 +72,13 @@
|
|||
#let index = 0
|
||||
|
||||
#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
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
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(
|
||||
top + left,
|
||||
|
|
@ -49,13 +49,12 @@
|
|||
weight: "bold",
|
||||
grid(
|
||||
columns: (1fr, 1fr),
|
||||
date.split(" ").at(0),
|
||||
align(right)[#date.split(" ").at(1)]
|
||||
date.split(" ").at(0), align(right)[#date.split(" ").at(1)],
|
||||
),
|
||||
),
|
||||
address,
|
||||
)
|
||||
)
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
align(right + bottom)[#text(size: 14pt, weight: "bold", name)]
|
||||
|
|
@ -70,7 +69,14 @@
|
|||
#let index = 0
|
||||
|
||||
#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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue