DiddiZ / mtg-proxies

Print high-resolution MtG proxies.
MIT License
49 stars 14 forks source link

Propaganda // Propaganda has no "oracle_id" #17

Closed lamelizard closed 1 year ago

lamelizard commented 1 year ago

Hello, thank you for the software. I am not sure if just my decklist had an issue, or something was missing elsewhere. Anyways, I got a keyerror and had to patch in a keycheck to scryfall.py:

def recommend_print(current=None, card_name=None, oracle_id=None, mode="best"):
    if current is not None and oracle_id is None:  # Use oracle id of current
        if "oracle_id" in current:
            oracle_id = current["oracle_id"]

CommandLine:

D:\GitHub\mtg-proxies>python print.py decks\shrines.txt decks\shrines.pdf
Parsing decklist ...
Traceback (most recent call last):
  File "D:\GitHub\mtg-proxies\print.py", line 60, in <module>
    decklist = parse_decklist_spec(args.decklist)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\GitHub\mtg-proxies\mtgproxies\cli.py", line 16, in parse_decklist_spec
    decklist, ok, warnings = parse_decklist(decklist_spec)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\GitHub\mtg-proxies\mtgproxies\decklists\decklist.py", line 137, in parse_decklist
    decklist, ok, warnings = parse_decklist_stream(f)
                             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\GitHub\mtg-proxies\mtgproxies\decklists\decklist.py", line 172, in parse_decklist_stream
    card, warnings_print = validate_print(card_name, set_id, collector_number)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\GitHub\mtg-proxies\mtgproxies\decklists\sanitizing.py", line 108, in validate_print
    recommendation = scryfall.recommend_print(card)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\GitHub\mtg-proxies\scryfall\scryfall.py", line 194, in recommend_print
    oracle_id = current["oracle_id"]
                ~~~~~~~^^^^^^^^^^^^^
KeyError: 'oracle_id'

DeckList, I hope the formating was not the issue and the issue is reproduceable, but maybe it has nothing to do with the list:

Deck
1 Sanctum of Tranquil Light (M21) 33
1 Sol Ring (SLD) 1011
1 Swords to Plowshares (SLD) 1021
1 Swan Song (HA3) 9
1 Sterling Grove (MH2) 293
1 Path to the World Tree (KHM) 186
1 Starfield Mystic (M20) 39
1 Weaver of Harmony (PRM) 98031
1 Sythis, Harvest's Hand (MH2) 377
1 Jukai Naturalist (NEO) 225
1 Sanctum Weaver (PRM) 91307
1 Sanctum of Stone Fangs (M21) 120
1 Go-Shintai of Lost Wisdom (NEO) 55
1 Go-Shintai of Boundless Vigor (NEO) 187
1 Arcane Signet (SLD) 201
1 Demonic Tutor (STA) 90
1 Herald of the Pantheon (C18) 151
1 Argothian Enchantress (G03) 2
1 Farseek (TSR) 363
1 Three Visits (CMR) 686
1 Fellwar Stone (SLD) 708
1 Shigeki, Jukai Visionary (NEO) 394
1 Heroic Intervention (AFC) 161
1 Negate (STA) 81
1 Mana Drain (CMR) 637
1 Enchantress's Presence (C18) 141
1 Teferi's Protection (STA) 11
1 Semblance Anvil (BRR) 115
1 Cloud Key (BRR) 75
1 Honden of Infinite Rage (CHK) 172
1 Starnheim Courser (KHM) 32
1 Sanctum of Shattered Heights (M21) 157
1 Sanctum of Fruitful Harvest (M21) 203
1 Go-Shintai of Ancient Wars (NEO) 144
1 Sisay, Weatherlight Captain (SLD) 9999
1 Tameshi, Reality Architect (NEO) 375
1 Mesa Enchantress (SLD) 282
1 Verduran Enchantress (SLD) 1004
1 Idyllic Tutor (SLD) 1020
1 Chromatic Lantern (BRR) 73
1 Honor-Worn Shaku (DMC) 187
1 Archon of Sun's Grace (THB) 298
1 Honden of Cleansing Fire (CHK) 14
1 Honden of Night's Reach (CHK) 116
1 Sanctum of Calm Waters (M21) 68
1 Go-Shintai of Shared Purpose (NEO) 14
1 Go-Shintai of Hidden Cruelty (NEO) 97
1 Go-Shintai of Life's Origin (NEC) 66
1 Calix, Destiny's Hand (THB) 257
1 Captain Sisay (SLD) 51
1 Honden of Seeing Winds (CHK) 69
1 Honden of Life's Web (CHK) 213
1 Elspeth Conquers Death (THB) 13
1 Shrine Steward (NEO) 259
1 Sanctum of All (PRM) 82020
1 Prismatic Geoscope (PLIST) 266
1 Time Wipe (PRM) 72219
1 Plea for Guidance (BNG) 24
1 Farewell (NEO) 365
1 Shark Typhoon (SLC) 2020
1 The Kami War // O-Kagachi Made Manifest (NEO) 362
1 Eerie Ultimatum (IKO) 332
1 Genesis Ultimatum (IKO) 336
1 Ruinous Ultimatum (IKO) 343
1 Brilliant Restoration (NEO) 363
1 The World Tree (KHM) 373
1 Field of the Dead (M20) 247
1 Indatha Triome (IKO) 309
1 Ketria Triome (IKO) 310
1 Raugrin Triome (IKO) 311
1 Savai Triome (IKO) 312
1 Zagoth Triome (IKO) 313
1 Command Tower (CC1) 8
1 Jetmir's Garden (SNC) 291
1 Raffine's Tower (SNC) 292
1 Spara's Headquarters (SNC) 293
1 Xander's Lounge (SNC) 294
1 Ziatora's Proving Ground (SNC) 295
1 Tundra (OLCG) 2015
1 Underground Sea (OLGC) 2016
1 Badlands (OLGC) 2016
1 Taiga (OLGC) 2017
1 Savannah (OLGC) 2017
1 Scrubland (OLGC) 2018
1 Volcanic Island (OLGC) 2018
1 Bayou (OLGC) 2019
1 Plateau (OLGC) 2018
1 Tropical Island (OLGC) 2019
1 Flooded Strand (EXP) 16
1 Polluted Delta (EXP) 17
1 Bloodstained Mire (EXP) 18
1 Wooded Foothills (EXP) 19
1 Windswept Heath (EXP) 20
1 Marsh Flats (EXP) 21
1 Scalding Tarn (EXP) 22
1 Verdant Catacombs (EXP) 23
1 Arid Mesa (EXP) 24
1 Misty Rainforest (EXP) 25
1 Krosan Verge (MOC) 412
1 Mana Confluence (EA2) 22
1 Watery Grave (PRM) 72299
1 Stomping Ground (PRM) 72313
1 Godless Shrine (PRM) 72305
1 Overgrown Tomb (PRM) 72315
1 Breeding Pool (PRM) 72311
1 Steam Vents (PRM) 72307
1 Sacred Foundry (PRM) 72309
1 Hallowed Fountain (PRM) 72297
1 Blood Crypt (PRM) 72301
1 Eidolon of Blossoms (PRM) 52318
1 Setessan Champion (THB) 331
1 Ghostly Prison (SLD) 424
1 Propaganda // Propaganda (SLD) 381
1 Out of Time (MH2) 442
1 Maelstrom Nexus (2XM) 206
1 Starfield of Nyx (ORI) 33
1 Sphere of Safety (SLD) 280
1 Collective Restraint (INV) 49
lamelizard commented 1 year ago

Hmm, this check was not enough, after converting it, i used tokens.py, but was running into the same issue. Are where cards without ID?

D:\GitHub\mtg-proxies>python tokens.py decks\shrines_conv.txt
Parsing decklist ...
Found 118 cards in total with 118 unique cards.
Traceback (most recent call last):
  File "D:\GitHub\mtg-proxies\tokens.py", line 45, in <module>
    tokens = get_tokens(decklist)
             ^^^^^^^^^^^^^^^^^^^^
  File "D:\GitHub\mtg-proxies\tokens.py", line 16, in get_tokens
    for card_print in scryfall.get_cards(oracle_id=card["oracle_id"]):
                                                   ~~~~^^^^^^^^^^^^^
  File "D:\GitHub\mtg-proxies\mtgproxies\decklists\decklist.py", line 25, in __getitem__
    return self.card[key]
           ~~~~~~~~~^^^^^
KeyError: 'oracle_id'

Seems the way, printing the current map in recommend_print reveals that it is Propaganda: 1 Propaganda // Propaganda (SLD) 381 Which seems to be the only double sided print of that card: https://scryfall.com/card/sld/381/propaganda-propaganda which may expain the issue? Note: 1 Propaganda (SLD) 381 is not found

DiddiZ commented 1 year ago

Yes, it was an error with reversible cards which have a separate oracle id for each face. Should be fixed now! Thanks for bringing this to my attention.

As there is currently no format to specify which face you want, for now both sides are printed. Hope that works for you.