From e40a7063b8f3a3dde582dc7477a8185e91a68f95 Mon Sep 17 00:00:00 2001 From: tritoch Date: Wed, 28 Jun 2017 12:27:09 -0500 Subject: [PATCH] Handle `X` in card costs. Slightly improved split card handling. Error for Blank mana cost on nonland. If a nonland card with no mana cost (`0` is a mana cost) is printed, adding it to card_corrections will prevent it from appearing in the error log. --- spoilers.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/spoilers.py b/spoilers.py index 1ee49e47..1360df1d 100644 --- a/spoilers.py +++ b/spoilers.py @@ -21,7 +21,7 @@ def scrape_mtgs(url): def parse_mtgs(mtgs, manual_cards=[], card_corrections=[], delete_cards=[], split_cards={}, related_cards=[]): mtgs = mtgs.replace('utf-16','utf-8') patterns = ['Name: (?P.*?)<', - 'Cost: (?P\d{0,2}[WUBRGC]*?)<', + 'Cost: (?P[X]*\d{0,2}[XWUBRGC]*?)<', 'Type: (?P.*?)<', 'Pow/Tgh: (?P.*?)<', 'Rules Text: (?P.*?)