Remove unused code

This commit is contained in:
The Magician 2024-12-13 17:13:25 +00:00
parent 8c683002be
commit 6814b23018
2 changed files with 2 additions and 77 deletions

View File

@ -1,12 +0,0 @@
package logic
/*
func GetAllBlueprints(db *sql.DB) ([]cardtrader.Blueprint, error) {
blueprints, err := database.GetAllBlueprints(db)
if err != nil {
return nil, err
}
return blueprints, nil
}
*/

View File

@ -1,11 +1,9 @@
package main package main
import ( import (
"encoding/json"
"errors" "errors"
"flag" "flag"
"fmt" "fmt"
"io/ioutil"
"log" "log"
"os" "os"
"sevenkeys/config" "sevenkeys/config"
@ -13,8 +11,6 @@ import (
"sevenkeys/delverlens" "sevenkeys/delverlens"
"sevenkeys/logic" "sevenkeys/logic"
"sevenkeys/update" "sevenkeys/update"
"github.com/mtgban/go-mtgban/cardtrader"
) )
const ( const (
@ -27,10 +23,6 @@ const (
AddSubcommand string = "add" AddSubcommand string = "add"
RemoveSubcommand string = "remove" RemoveSubcommand string = "remove"
ReplaceSubcommand string = "replace" ReplaceSubcommand string = "replace"
DeckSubcommand string = "deck"
GetProductIdSubcommand string = "products"
MatchSubcommands string = "match"
) )
func main() { func main() {
@ -49,10 +41,9 @@ func main() {
switch flag.Args()[0] { switch flag.Args()[0] {
case UpdateSubcommand: case UpdateSubcommand:
err := update.UpdateScryfallData(db) update.UpdateScryfallData(db)
logic.Check(err)
err = update.UpdateCardtraderData(db, config.CardtraderToken) err := update.UpdateCardtraderData(db, config.CardtraderToken)
logic.Check(err) logic.Check(err)
break break
case CreateStorageAreaSubcommand: case CreateStorageAreaSubcommand:
@ -207,60 +198,6 @@ func main() {
err := logic.Replace(db, *cardLocationId, *cardPrintingId) err := logic.Replace(db, *cardLocationId, *cardPrintingId)
logic.Check(err) logic.Check(err)
break break
case DeckSubcommand:
deckCmd := flag.NewFlagSet(DeckSubcommand, flag.ExitOnError)
deckCmd.Parse(flag.Args()[1:])
//filename := deckCmd.Args()[0]
break
case GetProductIdSubcommand:
blbBlueprintsBytes, err := ioutil.ReadFile("blb_blueprints.json")
logic.Check(err)
var blbBlueprints []cardtrader.Blueprint
err = json.Unmarshal(blbBlueprintsBytes, &blbBlueprints)
logic.Check(err)
productsBytes, err := ioutil.ReadFile("products.json")
logic.Check(err)
var products []cardtrader.Product
err = json.Unmarshal(productsBytes, &products)
logic.Check(err)
for _, product := range products {
var productBlueprint cardtrader.Blueprint
for _, blueprint := range blbBlueprints {
if blueprint.Id == product.BlueprintId {
productBlueprint = blueprint
break
}
}
fmt.Printf("%s %s %d ",
productBlueprint.Name,
product.Properties.Number,
product.Id,
)
if product.Properties.MTGFoil {
fmt.Printf("FOIL ")
} else {
fmt.Printf("NONFOIL ")
}
fmt.Printf("x%d\n", product.Quantity)
}
break
/*
case MatchSubcommands:
cardLocations, err := logic.GetAllStorageSearchOptions(db)
logic.Check(err)
blueprints, err := logic.GetAllBlueprints(db)
logic.Check(err)
break
*/
default: default:
fmt.Fprintf(os.Stderr, "Unrecognized subcommand: %s\n", os.Args[1]) fmt.Fprintf(os.Stderr, "Unrecognized subcommand: %s\n", os.Args[1])
break break