Write outline for combined importer

This commit is contained in:
The Magician 2024-05-21 12:24:16 +01:00
parent e98b0ec72f
commit f31186add2
1 changed files with 22 additions and 2 deletions

View File

@ -1,8 +1,9 @@
package main package main
import ( import (
"fmt"
"log" "log"
"sevenkeys/database"
"sevenkeys/scryfall/methods"
) )
const CACHE_DIR string = "cache" const CACHE_DIR string = "cache"
@ -19,5 +20,24 @@ func check(err error) {
} }
func main() { func main() {
fmt.Println("Hello, world") log.Println("Connecting to database...")
db := database.GetDatabaseFromConfig("config.json")
log.Println("Connected.")
log.Println("Downloading set data from Scryfall...")
sets, err := methods.GetSets()
check(err)
log.Println("Downloaded set data.")
// Create cache dir
// Create icon cache dir
// Loop through sets, import set data into database and download icons
// TODO: Only download icon if we don't already have the file
// Check whether card data has been updated since last download
// If yes, redownload and recache the bulk data
// Unmarshal cached file into Golang struct
// Import cards into database
} }