2019-09-03 23:05:07 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2020-07-24 20:17:25 +02:00
|
|
|
"log"
|
2020-02-04 20:16:42 +01:00
|
|
|
"strconv"
|
|
|
|
"time"
|
2019-09-03 23:05:07 +02:00
|
|
|
|
2020-07-25 00:39:53 +02:00
|
|
|
"git.postblue.info/chris/paddockpass/crawlers"
|
|
|
|
"git.postblue.info/chris/paddockpass/graph"
|
2019-09-03 23:05:07 +02:00
|
|
|
_ "github.com/go-sql-driver/mysql"
|
2020-07-25 01:15:05 +02:00
|
|
|
"github.com/urfave/cli"
|
2019-09-03 23:05:07 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2020-02-05 19:14:19 +01:00
|
|
|
year := strconv.Itoa(time.Now().Year())
|
2020-07-25 00:39:53 +02:00
|
|
|
client, err := graph.ConnectToDgraph()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
err = graph.InitSchema(client)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
2020-02-05 19:14:19 +01:00
|
|
|
|
2020-07-25 01:15:05 +02:00
|
|
|
app := cli.NewApp()
|
|
|
|
app.Usage = "The hardest way to get your F1 stats."
|
|
|
|
app.Description = "Run with the docker-compose file and the app will data from Ergast and display it in Dgraph."
|
|
|
|
|
2020-02-04 20:16:42 +01:00
|
|
|
fmt.Println("Hello there! It is", year)
|
2020-07-26 22:59:23 +02:00
|
|
|
crawlers.GetDriversFromErgast(year, client)
|
2020-07-26 01:41:30 +02:00
|
|
|
crawlers.GetResultsFromErgast(year, "alonso", client)
|
|
|
|
// crawlers.GetSeasonFromErgast(year, client)
|
2020-07-25 00:39:53 +02:00
|
|
|
// crawlers.GetResultsFromErgast(year)
|
2019-09-03 23:05:07 +02:00
|
|
|
}
|