add wikipedia fact
This commit is contained in:
parent
3fb3c4f63f
commit
26a2cfb91b
3 changed files with 20 additions and 34 deletions
|
|
@ -6,7 +6,7 @@ from PIL import Image
|
||||||
epd = epd4in2.EPD()
|
epd = epd4in2.EPD()
|
||||||
epd.init()
|
epd.init()
|
||||||
|
|
||||||
image = Image.open('./document_ready.bmp')
|
image = Image.open('./document.bmp')
|
||||||
image = image.convert('L')
|
image = image.convert('L')
|
||||||
epd.display_4Gray(epd.getbuffer_4Gray(image))
|
epd.display_4Gray(epd.getbuffer_4Gray(image))
|
||||||
epd.sleep()
|
epd.sleep()
|
||||||
|
|
|
||||||
47
document.typ
47
document.typ
|
|
@ -1,43 +1,26 @@
|
||||||
#set page(width: 86mm, height: 65mm)
|
#set page(width: 65mm, height: 86mm)
|
||||||
|
|
||||||
#let weekdays = ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
|
|
||||||
#let today = datetime.today()
|
#let today = datetime.today()
|
||||||
#let weather = json("weather.json")
|
#let weather = json("weather.json")
|
||||||
|
|
||||||
#align(center)[
|
|
||||||
#text(size:2em)[#today.display("[weekday] [month repr:long] [year]")]
|
|
||||||
|
|
||||||
#box(
|
|
||||||
stroke: 0.2em+black
|
|
||||||
)[
|
|
||||||
#grid(
|
|
||||||
columns: (1fr,1fr,1fr,1fr,1fr,1fr,1fr),
|
|
||||||
inset:0.5em,
|
|
||||||
rows:1,
|
|
||||||
align:center,
|
|
||||||
fill: (x, _) =>
|
|
||||||
if x>4 { luma(240) }
|
|
||||||
else { white },
|
|
||||||
|
|
||||||
stroke: (x, _) =>
|
|
||||||
if x== weekdays.position(it => {it == today.display("[weekday repr:short]")}) {0.15em+black}
|
|
||||||
else { none},
|
|
||||||
[Lun],[Mar],[Mer],[Jeu],[Ven],[Sam],[Dim]
|
|
||||||
)
|
|
||||||
]
|
|
||||||
|
|
||||||
#let icon = none
|
#let icon = none
|
||||||
#if weather.current.weather_code == 0{
|
#if weather.current.weather_code == 0{
|
||||||
icon = image("icons/sun.svg", width:3em)
|
icon = image("icons/sun.svg", width:3em)
|
||||||
}
|
}
|
||||||
|
|
||||||
#grid(
|
|
||||||
columns: (1fr,4fr),
|
|
||||||
align: (center+horizon, left+horizon),
|
|
||||||
[#icon],[#text(size:3em)[#weather.current.temperature_2m #weather.current_units.temperature_2m]]
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
#align(center)[
|
||||||
|
#text(size:2em, weight: "bold")[#today.display("[weekday] [month repr:long] [year]")]
|
||||||
|
|
||||||
|
|
||||||
|
#v(1fr)
|
||||||
|
|
||||||
|
#grid(
|
||||||
|
columns: (1fr,2fr),
|
||||||
|
align: (center+horizon, left+horizon),
|
||||||
|
[#icon],[#text(size:3em)[#weather.current.temperature_2m #weather.current_units.temperature_2m]]
|
||||||
|
)
|
||||||
|
|
||||||
|
#v(1fr)
|
||||||
|
#read("event.txt")
|
||||||
|
#v(1fr)
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
|
echo "Get Wikipedia fact..."
|
||||||
|
wget -qO- "https://api.wikimedia.org/feed/v1/wikipedia/en/onthisday/events/$(date +%m)/$(date +%d)" | \
|
||||||
|
jq -r '.events[0] | "\(.year): \(.text)"' > event.txt
|
||||||
echo "Generate document..."
|
echo "Generate document..."
|
||||||
./typst compile --format png document.typ
|
./typst compile --format png document.typ
|
||||||
echo "Convert to image..."
|
echo "Convert to image..."
|
||||||
mogrify -resize 400x300^ -gravity center -extent 400x300 document_ready.png document_ready.bmp
|
convert -rotate 90 -resize 400x300^ -gravity center -extent 400x300 document.png document.bmp
|
||||||
echo "Update display..."
|
echo "Update display..."
|
||||||
python3 display.py
|
python3 display.py
|
||||||
echo "Done."
|
echo "Done."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue