cmd/horsebot: download support card icons
This commit is contained in:
@@ -33,6 +33,10 @@ func saveImgs(ctx context.Context, db *sqlitex.Pool, out string) {
|
||||
if err != nil {
|
||||
slog.Error("ranks", slog.Any("err", err))
|
||||
}
|
||||
supps, err := suppIDs(ctx, db)
|
||||
if err != nil {
|
||||
slog.Error("supports", slog.Any("err", err))
|
||||
}
|
||||
|
||||
g, ctx := errgroup.WithContext(ctx)
|
||||
tick := time.NewTicker(250 * time.Millisecond)
|
||||
@@ -40,6 +44,7 @@ func saveImgs(ctx context.Context, db *sqlitex.Pool, out string) {
|
||||
idouts(ctx, g, tick, chara, filepath.Join(out, "chara"), "https://gametora.com/images/umamusume/characters/icons/chr_icon_%d.png", image.Pt(256, 256), image.Pt(64, 64), image.Pt(32, 32), image.Pt(16, 16))
|
||||
idouts(ctx, g, tick, rank, filepath.Join(out, "rank"), "https://media.gametora.com/umamusume/ui/rank/%02d.png", image.Pt(128, 128), image.Pt(64, 64), image.Pt(32, 32), image.Pt(16, 16))
|
||||
idouts(ctx, g, tick, rank, filepath.Join(out, "rank", "simple"), "https://media.gametora.com/umamusume/ui/rank/simple/%02d.png", image.Pt(50, 50), image.Pt(32, 32), image.Pt(16, 16))
|
||||
idouts(ctx, g, tick, supps, filepath.Join(out, "support"), "https://gametora.com/images/umamusume/supports/support_card_s_%d.png", image.Pt(128, 128), image.Pt(64, 64), image.Pt(32, 32))
|
||||
if err := g.Wait(); err != nil {
|
||||
slog.Error("output", slog.Any("err", err))
|
||||
}
|
||||
@@ -88,6 +93,12 @@ func rankIDs(ctx context.Context, db *sqlitex.Pool) ([]int32, error) {
|
||||
})
|
||||
}
|
||||
|
||||
func suppIDs(ctx context.Context, db *sqlitex.Pool) ([]int32, error) {
|
||||
return load(ctx, db, nil, "SELECT id FROM support_card_data", func(s *sqlite.Stmt) int32 {
|
||||
return s.ColumnInt32(0)
|
||||
})
|
||||
}
|
||||
|
||||
var pngenc = &png.Encoder{CompressionLevel: png.BestCompression}
|
||||
|
||||
func idouts(ctx context.Context, g *errgroup.Group, tick *time.Ticker, ids []int32, p, urlf string, sizes ...image.Point) {
|
||||
|
||||
Reference in New Issue
Block a user