-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
44 lines (37 loc) · 959 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"encoding/json"
"fmt"
"log"
"os"
"github.com/toshi0383/gts-notion/gtsport"
"github.com/toshi0383/gts-notion/notion"
)
func main() {
events := gtsport.GetManufacturerEventRounds()
var records []notion.RaceRecord
// TODO: run in parallel to improve performance
for _, e := range events {
race := e.Race
reg := e.Regulation
t := e.BeginDate
beginDate := fmt.Sprintf("%04d-%02d-%02d", t.Year(), t.Month(), t.Day())
record := notion.RaceRecord{
CourseCode: e.Track.CourseCode,
Tire: race.ConsumeTire,
Fuel: race.ConsumeFuel,
Category: reg.CarCategoryTypes[0],
Fav: "No",
Laps: race.RaceLimitLaps,
Date: beginDate,
Tires: []int{reg.LimitTireF, reg.NeedTireF},
Series: 0, // manu
}
records = append(records, record)
}
bytes, err := json.Marshal(records)
if err != nil {
log.Fatalf("Marshal failed: %v\n", err)
}
os.Stdout.Write(bytes)
}