mirror of
https://github.com/Cockatrice/Magic-Spoiler.git
synced 2026-06-16 13:19:44 -05:00
Better split/aftermath image matching
This commit is contained in:
parent
883af49ac8
commit
82186fdf2e
|
|
@ -114,12 +114,6 @@
|
|||
"loyalty": "5",
|
||||
"url": "http://media.wizards.com/2017/images/daily/en_VlI3HOtQc3.png"
|
||||
},
|
||||
"Reason": {
|
||||
"url": "http://media-dominaria.cursecdn.com/avatars/132/329/636336513732500758.png"
|
||||
},
|
||||
"Believe": {
|
||||
"url": "http://media-dominaria.cursecdn.com/avatars/132/329/636336513732500758.png"
|
||||
},
|
||||
"Uncage the Menagerie": {
|
||||
"manaCost": "XGG"
|
||||
}
|
||||
|
|
|
|||
18
spoilers.py
18
spoilers.py
|
|
@ -795,28 +795,26 @@ def get_image_urls(mtgjson, isfullspoil, setname, setlongname, setSize=269, seti
|
|||
mythicspoilerpattern = r' src="' + setname.lower() + '/cards/{}.*?.jpg">'
|
||||
WOTC = []
|
||||
for c in mtgjson['cards']:
|
||||
match = re.search(wotcpattern.format(c['name'].replace('\'','’')), text, re.DOTALL)
|
||||
if 'names' in c:
|
||||
cardname = ' // '.join(c['names'])
|
||||
else:
|
||||
cardname = c['name']
|
||||
match = re.search(wotcpattern.format(cardname.replace('\'','’')), text, re.DOTALL)
|
||||
if match:
|
||||
c['url'] = match.groupdict()['img']
|
||||
else:
|
||||
match3 = re.search(wotcpattern2.format(c['name'].replace('\'','’')), text3)
|
||||
match3 = re.search(wotcpattern2.format(cardname.replace('\'','’')), text3)
|
||||
if match3:
|
||||
c['url'] = match3.groupdict()['img']
|
||||
else:
|
||||
match4 = re.search(wotcpattern.format(c['name'].replace('\'','’')), text3, re.DOTALL)
|
||||
match4 = re.search(wotcpattern.format(cardname.replace('\'','’')), text3, re.DOTALL)
|
||||
if match4:
|
||||
c['url'] = match4.groupdict()['img']
|
||||
else:
|
||||
if 'names' in c:
|
||||
mythicname = c['names'][0] + c['names'][1]
|
||||
else:
|
||||
mythicname = c['name']
|
||||
match2 = re.search(mythicspoilerpattern.format(mythicname.lower().replace(' ', '').replace(''', '').replace('-', '').replace('\'','').replace(',', '')), text2, re.DOTALL)
|
||||
match2 = re.search(mythicspoilerpattern.format(cardname.lower().replace(' // ','').replace(' ', '').replace(''', '').replace('-', '').replace('\'','').replace(',', '')), text2, re.DOTALL)
|
||||
if match2 and not isfullspoil:
|
||||
c['url'] = match2.group(0).replace(' src="', 'http://mythicspoiler.com/').replace('">', '')
|
||||
pass
|
||||
#if ('Creature' in c['type'] and not c.has_key('power')) or ('Vehicle' in c['type'] and not c.has_key('power')):
|
||||
# print(c['name'] + ' is a creature w/o p/t img: ' + c['url'])
|
||||
if 'wizards.com' in c['url']:
|
||||
WOTC.append(c['name'])
|
||||
if setinfo:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user