add hourly refresh with systemd timer

This commit is contained in:
grizzly 2025-08-24 10:06:13 -04:00
parent 951eb71b83
commit 5f4d1f24d4
5 changed files with 48 additions and 9 deletions

View file

@ -1,4 +1,7 @@
#set page(width: 65mm, height: 86mm)
#set page(width: 65mm,
height: 86mm,
margin: ("x":0cm,"y":0cm)
)
#let today = datetime.today()
#let weather = json("weather.json")
#let icons_map = (
@ -32,19 +35,16 @@
"99": "icons/hail_day_night.svg",
)
#let decimate_array(a,n:2) = {
#let reduce_array(a,n:2) = {
let ret = ()
for (i,v) in a.enumerate(){
if calc.rem-euclid(i,n) == 0{
if calc.rem-euclid(i,n) == 0 and i>6{
ret.push(v)
}
}
return ret
}
#align(center)[
#text(size:1.3em, weight: "bold")[#today.display("[weekday] [month repr:long] [year]")]
#let times = ()
#for i in range(24){
times.push(datetime(hour:i,minute:0,second:0))
@ -52,12 +52,23 @@
#let times = times.map(x=>x.display("[hour]"))
#let codes = weather.hourly.weather_code.map(x => image(icons_map.at(str(x)), height:1em))
#let temps = weather.hourly.temperature_2m
#let values = decimate_array(times.zip(codes,temps),n: 2)
#let values = reduce_array(times.zip(codes,temps),n: 2)
#align(center)[
#v(1fr)
#text(size:2em, weight: "bold")[#today.display("[weekday] [day]")]
#v(1fr)
#grid(
columns: (1fr,1fr,1fr),
..values.flatten().map(x => text(size:1.3em)[#x])
columns: (1fr,2fr,2fr),
align: (right,center,center),
..values.flatten().map(x => text(size:1.7em)[#x])
)
#v(1fr)
]