moninktor/update.sh

12 lines
618 B
Bash
Executable file

#!/bin/bash
echo "Get weather data..."
wget -O tmpweather.json "https://api.open-meteo.com/v1/forecast?latitude=43.4516&longitude=-80.4925&hourly=temperature_2m,weather_code&start_date=$(date +%Y-%m-%d)&end_date=$(date +%Y-%m-%d)&timezone=America/Toronto"
jq --arg timestamp "$(date '+%Y %m %d %H %M %S')" '. + {"timestamp": $timestamp}' tmpweather.json > weather.json
echo "Generate document..."
./typst compile --format png document.typ
echo "Convert to image..."
convert -rotate 90 -resize 400x300^ -gravity center -extent 400x300 document.png document.bmp
echo "Update display..."
python3 display.py
echo "Done."