display-epaper/run_darwin_arm64.go

42 lines
785 B
Go
Raw Normal View History

2024-09-15 09:01:13 +02:00
package main
import (
2024-09-15 10:46:07 +02:00
"context"
2024-09-15 12:00:36 +02:00
"github.com/Crocmagnon/display-epaper/fete"
2024-09-15 10:46:07 +02:00
"github.com/Crocmagnon/display-epaper/transports"
2024-09-15 23:25:17 +02:00
"github.com/Crocmagnon/display-epaper/weather"
2024-09-15 09:01:13 +02:00
"github.com/llgcode/draw2d/draw2dimg"
"log"
2024-09-15 12:00:36 +02:00
"time"
2024-09-15 09:01:13 +02:00
)
2024-09-15 23:25:17 +02:00
func run(
ctx context.Context,
_ time.Duration,
2024-09-15 23:25:17 +02:00
transportsClient *transports.Client,
feteClient *fete.Client,
weatherClient *weather.Client,
) error {
2024-09-15 23:55:31 +02:00
img, err := getBlack(
ctx,
func() time.Time {
t, err := time.Parse(time.DateOnly, "2024-08-01zzz")
if err != nil {
return time.Now()
}
return t
},
transportsClient,
feteClient,
weatherClient,
)
2024-09-15 09:01:13 +02:00
if err != nil {
log.Fatal(err)
}
2024-09-15 21:18:06 +02:00
if err := draw2dimg.SaveToPngFile("out/black.png", img); err != nil {
log.Fatalf("error saving image: %v", err)
}
2024-09-15 09:01:13 +02:00
return nil
}