Import set data

This commit is contained in:
The Magician 2024-05-21 13:25:08 +01:00
parent fd4c2048e1
commit 411383704c
1 changed files with 5 additions and 5 deletions

View File

@ -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.")