julkascript / cardflow

The open-source Trading Card Game market
MIT License
14 stars 9 forks source link

Sort out card pictures in the backend #94

Open julkascript opened 6 months ago

julkascript commented 6 months ago

Problem: The cards in the different sets have different pictures. Currently, we only store 1 picture per card (the first entry in the response). All card pictures come in the same array - how do we relate them to the CardInSet entry?

julkascript commented 5 months ago

I cannot seem to find any relation between the card images and the cards in each set. Programmatically cannot be extracted.

Example card response:

{
  "data": [
    {
      "id": 1861630,
      "name": "Decode Talker",
      "type": "Link Monster",
      "frameType": "link",
      "desc": "2+ Effect Monsters\r\nGains 500 ATK for each monster it points to. When your opponent activates a card or effect that targets a card(s) you control (Quick Effect): You can Tribute 1 monster this card points to; negate the activation, and if you do, destroy that card.",
      "atk": 2300,
      "race": "Cyberse",
      "attribute": "DARK",
      "archetype": "Code Talker",
      "linkval": 3,
      "linkmarkers": [
        "Top",
        "Bottom-Left",
        "Bottom-Right"
      ],
      "ygoprodeck_url": "https://ygoprodeck.com/card/decode-talker-8433",
      "card_sets": [
        {
          "set_name": "25th Anniversary Tin: Dueling Heroes",
          "set_code": "TN23-EN009",
          "set_rarity": "Quarter Century Secret Rare",
          "set_rarity_code": "",
          "set_price": "0"
        },
        {
          "set_name": "Duel Devastator",
          "set_code": "DUDE-EN023",
          "set_rarity": "Ultra Rare",
          "set_rarity_code": "(UR)",
          "set_price": "1.54"
        },
        {
          "set_name": "Duel Power",
          "set_code": "DUPO-EN106",
          "set_rarity": "Ultra Rare",
          "set_rarity_code": "(UR)",
          "set_price": "1.56"
        },
        {
          "set_name": "OTS Tournament Pack 6",
          "set_code": "OP06-EN001",
          "set_rarity": "Ultimate Rare",
          "set_rarity_code": "(UtR)",
          "set_price": "0"
        },
        {
          "set_name": "Star Pack VRAINS",
          "set_code": "SP18-EN031",
          "set_rarity": "Starfoil",
          "set_rarity_code": "",
          "set_price": "0"
        },
        {
          "set_name": "Star Pack VRAINS",
          "set_code": "SP18-EN031",
          "set_rarity": "Starfoil Rare",
          "set_rarity_code": "(SFR)",
          "set_price": "2.34"
        },
        {
          "set_name": "Starter Deck: Codebreaker",
          "set_code": "YS18-EN043",
          "set_rarity": "Common",
          "set_rarity_code": "(C)",
          "set_price": "0"
        },
        {
          "set_name": "Starter Deck: Link Strike",
          "set_code": "YS17-EN041",
          "set_rarity": "Ultra Rare",
          "set_rarity_code": "(UR)",
          "set_price": "0"
        }
      ],
      "card_images": [
        {
          "id": 1861630,
          "image_url": "https://images.ygoprodeck.com/images/cards/1861630.jpg",
          "image_url_small": "https://images.ygoprodeck.com/images/cards_small/1861630.jpg",
          "image_url_cropped": "https://images.ygoprodeck.com/images/cards_cropped/1861630.jpg"
        },
        {
          "id": 1861629,
          "image_url": "https://images.ygoprodeck.com/images/cards/1861629.jpg",
          "image_url_small": "https://images.ygoprodeck.com/images/cards_small/1861629.jpg",
          "image_url_cropped": "https://images.ygoprodeck.com/images/cards_cropped/1861629.jpg"
        }
      ],
      "card_prices": [
        {
          "cardmarket_price": "0.08",
          "tcgplayer_price": "0.15",
          "ebay_price": "4.48",
          "amazon_price": "0.25",
          "coolstuffinc_price": "0.39"
        }
      ]
    }
  ]
}