Add Scryfall image URL field to database
This commit is contained in:
parent
793fb28d38
commit
b61929a178
|
@ -1,5 +1,6 @@
|
|||
penny_dreadful_downloader/legality_data/
|
||||
a_scanner_dorkly/.venv/
|
||||
scantap/images/
|
||||
sevenkeys/sevenkeys
|
||||
MTG-Card-Identifier_v5.pdf
|
||||
info.txt
|
||||
|
|
|
@ -11,6 +11,7 @@ type CardPrinting struct {
|
|||
IsFoil bool
|
||||
IsPromo bool
|
||||
CollectorNumber string
|
||||
ImageUrl string
|
||||
Language string
|
||||
}
|
||||
|
||||
|
@ -22,8 +23,9 @@ func InsertCardPrinting(db *sql.DB, cardPrinting CardPrinting) error {
|
|||
IsFoil,
|
||||
IsPromo,
|
||||
CollectorNumber,
|
||||
ImageUrl,
|
||||
Language)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?);`
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?);`
|
||||
|
||||
insert, err := db.Prepare(query)
|
||||
defer insert.Close()
|
||||
|
@ -31,7 +33,7 @@ func InsertCardPrinting(db *sql.DB, cardPrinting CardPrinting) error {
|
|||
return err
|
||||
}
|
||||
|
||||
_, err = insert.Exec(cardPrinting.Id, cardPrinting.Name, cardPrinting.SetCode, cardPrinting.IsFoil, cardPrinting.IsPromo, cardPrinting.CollectorNumber, cardPrinting.Language)
|
||||
_, err = insert.Exec(cardPrinting.Id, cardPrinting.Name, cardPrinting.SetCode, cardPrinting.IsFoil, cardPrinting.IsPromo, cardPrinting.CollectorNumber, cardPrinting.ImageUrl, cardPrinting.Language)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ CREATE TABLE IF NOT EXISTS CardPrinting (
|
|||
IsFoil BOOLEAN NOT NULL,
|
||||
IsPromo BOOLEAN NOT NULL,
|
||||
CollectorNumber VARCHAR(10) NOT NULL,
|
||||
ImageUrl VARCHAR(100) NOT NULL,
|
||||
Language VARCHAR(3) NOT NULL
|
||||
);
|
||||
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package scryfall
|
||||
|
||||
type Card struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Set string `json:"set"`
|
||||
Games []string `json:"games"`
|
||||
Foil bool `json:"foil"`
|
||||
NonFoil bool `json:"nonfoil"`
|
||||
Promo bool `json:"promo"`
|
||||
CollectorNumber string `json:"collector_number"`
|
||||
Language string `json:"lang"`
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Set string `json:"set"`
|
||||
Games []string `json:"games"`
|
||||
Foil bool `json:"foil"`
|
||||
NonFoil bool `json:"nonfoil"`
|
||||
Promo bool `json:"promo"`
|
||||
CollectorNumber string `json:"collector_number"`
|
||||
ImageUris map[string]string `json:"image_uris"`
|
||||
Language string `json:"lang"`
|
||||
}
|
||||
|
|
|
@ -124,6 +124,7 @@ func getCardPrintings(card scryfall.Card) []database.CardPrinting {
|
|||
IsFoil: true,
|
||||
IsPromo: card.Promo,
|
||||
CollectorNumber: card.CollectorNumber,
|
||||
ImageUrl: card.ImageUris["png"],
|
||||
Language: card.Language,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue