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)
|
||||
err = operations.InsertOrUpdateSet(db, set)
|
||||
err := operations.InsertOrUpdateSet(db, set)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -69,6 +69,8 @@ func importSets(db *sql.DB, sets []types.Set) error {
|
|||
io.Copy(iconFile, response.Body)
|
||||
log.Println("Finished importing " + set.Code)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
@ -77,7 +79,7 @@ func main() {
|
|||
log.Println("Connected.")
|
||||
|
||||
log.Println("Creating cache directories...")
|
||||
err = createCacheDirectories()
|
||||
err := createCacheDirectories()
|
||||
check(err)
|
||||
log.Println("Created cache directories.")
|
||||
|
||||
|
@ -86,10 +88,8 @@ func main() {
|
|||
check(err)
|
||||
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...")
|
||||
err = importSets()
|
||||
err = importSets(db, sets)
|
||||
check(err)
|
||||
log.Println("Imported sets.")
|
||||
|
||||
|
|
Loading…
Reference in New Issue