Skip to content

Commit

Permalink
fix(codes): Wrote a new comprehensive set replacement library
Browse files Browse the repository at this point in the history
Used webscraping to compare all scryfall sets with all mtgp sets and created a comprehensive dataset for set code replacements. Added Prerelease Promos to promo checker.
  • Loading branch information
Investigamer committed Aug 7, 2022
1 parent d192ee7 commit 4563d59
Show file tree
Hide file tree
Showing 4 changed files with 502 additions and 6 deletions.
4 changes: 2 additions & 2 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
{"src": os.path.join(CWD, "config.ini"), "dst": os.path.join(DIST, "config.ini")},
# --- SOURCE DIRECTORY
{
"src": os.path.join(MTG, "codes.json"),
"dst": os.path.join(DIST_MTG, "codes.json"),
"src": os.path.join(MTG, "codes.hjson"),
"dst": os.path.join(DIST_MTG, "codes.hjson"),
},
{
"src": os.path.join(MTG, "links.json"),
Expand Down
6 changes: 4 additions & 2 deletions lib/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def get_mtgp_code(self, name: str) -> str:
Get the correct mtgp URL code
"""
# Possible promo set
if self.promo:
if self.promo or self.mtgp_set == "pmo":
code = core.get_mtgp_code_pmo(
name, self.artist, self.set_name, self.mtgp_set
)
Expand Down Expand Up @@ -214,10 +214,12 @@ def check_for_promo(self):
Check if this is a promo card
"""
set_types = ["funny", "promo"]
if self.mtgp_set == "pre":
return True
if "Alchemy" in self.set_name:
self.mtgp_set = "a22"
return True
if "Judge Gift" in self.set_name or self.set == "dci":
if "Judge Gift" in self.set_name or self.mtgp_set == "dci":
self.mtgp_set = "dci"
return True
if self.set_name in ("Legacy Championship", "Vintage Championship"):
Expand Down
Loading

0 comments on commit 4563d59

Please sign in to comment.