Import set data
This commit is contained in:
parent
fd4c2048e1
commit
411383704c
|
@ -48,7 +48,7 @@ func importSets(db *sql.DB, sets []types.Set) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println("Importing " + set.Code)
|
log.Println("Importing " + set.Code)
|
||||||
err = operations.InsertOrUpdateSet(db, set)
|
err := operations.InsertOrUpdateSet(db, set)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,8 @@ func importSets(db *sql.DB, sets []types.Set) error {
|
||||||
io.Copy(iconFile, response.Body)
|
io.Copy(iconFile, response.Body)
|
||||||
log.Println("Finished importing " + set.Code)
|
log.Println("Finished importing " + set.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -77,7 +79,7 @@ func main() {
|
||||||
log.Println("Connected.")
|
log.Println("Connected.")
|
||||||
|
|
||||||
log.Println("Creating cache directories...")
|
log.Println("Creating cache directories...")
|
||||||
err = createCacheDirectories()
|
err := createCacheDirectories()
|
||||||
check(err)
|
check(err)
|
||||||
log.Println("Created cache directories.")
|
log.Println("Created cache directories.")
|
||||||
|
|
||||||
|
@ -86,10 +88,8 @@ func main() {
|
||||||
check(err)
|
check(err)
|
||||||
log.Println("Downloaded set data.")
|
log.Println("Downloaded set data.")
|
||||||
|
|
||||||
// Loop through sets, import set data into database and download icons
|
|
||||||
// TODO: Only download icon if we don't already have the file
|
|
||||||
log.Println("Importing set data...")
|
log.Println("Importing set data...")
|
||||||
err = importSets()
|
err = importSets(db, sets)
|
||||||
check(err)
|
check(err)
|
||||||
log.Println("Imported sets.")
|
log.Println("Imported sets.")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue