mirror of
https://github.com/Cockatrice/Magic-Spoiler.git
synced 2026-08-26 19:35:24 -05:00
Log Cleanup
* Scryfall debug log off by default * Scryfall logging disabled by default. Manual corrections print on one line.
This commit is contained in:
8
main.py
8
main.py
@@ -16,7 +16,8 @@ presets = {
|
||||
"siteorder": ['scryfall','mtgs','mythicspoiler'], # if we want to use one site before another for card data TODO
|
||||
"imageorder": ['wotc','scryfall','mtgs','mythicspoiler'], # prioritize images from certain sources
|
||||
"useexclusively": '', # if we *only* want to use one site TODO
|
||||
"dumpXML": False # let travis print XML for testing
|
||||
"dumpXML": False, # let travis print XML for testing
|
||||
"scryfallComparison": False #if we want to debug compare scryfall to other sources, enable
|
||||
}
|
||||
|
||||
try:
|
||||
@@ -101,8 +102,9 @@ if __name__ == '__main__':
|
||||
[mtgs, split_cards] = spoilers.parse_mtgs(mtgs, [], [], [], presets['split_cards']) #parse spoilers into mtgjson format
|
||||
mtgs = spoilers.correct_cards(mtgs, manual_sets[setinfo['setname']]['cards'], card_corrections, delete_cards) #fix using the fixfiles
|
||||
scryfall = spoilers.get_scryfall('https://api.scryfall.com/cards/search?q=++e:' + setinfo['setname'].lower())
|
||||
mtgs = spoilers.get_image_urls(mtgs, presets['isfullspoil'], setinfo['setname'], setinfo['setlongname'], setinfo['setsize'], setinfo) #get images
|
||||
mtgjson = spoilers.smash_mtgs_scryfall(mtgs, scryfall)
|
||||
mtgjson = spoilers.get_image_urls(mtgs, presets['isfullspoil'], setinfo['setname'], setinfo['setlongname'], setinfo['setsize'], setinfo) #get images
|
||||
if presets['scryfallComparison']:
|
||||
mtgjson = spoilers.smash_mtgs_scryfall(mtgs, scryfall)
|
||||
[mtgjson, errors] = spoilers.error_check(mtgjson, card_corrections) #check for errors where possible
|
||||
errorlog += errors
|
||||
spoilers.write_xml(mtgjson, setinfo['setname'], setinfo['setlongname'], setinfo['setreleasedate'])
|
||||
|
||||
12
spoilers.py
12
spoilers.py
@@ -300,16 +300,16 @@ def correct_cards(mtgjson, manual_cards=[], card_corrections=[], delete_cards=[]
|
||||
card['colorIdentity'] += CID
|
||||
else:
|
||||
card['colorIdentity'] = [CID]
|
||||
manual_added = []
|
||||
for card in mtgjson['cards']:
|
||||
isManual = False
|
||||
for manualCard in manual_cards:
|
||||
if card['name'] == manualCard['name']:
|
||||
mtgjson2.append(manualCard)
|
||||
print 'overwriting card ' + card['name']
|
||||
manual_added.append(manualCard['name'] + " (overwritten)")
|
||||
isManual = True
|
||||
if not isManual and not card['name'] in delete_cards:
|
||||
mtgjson2.append(card)
|
||||
|
||||
for manualCard in manual_cards:
|
||||
addManual = True
|
||||
for card in mtgjson['cards']:
|
||||
@@ -317,7 +317,9 @@ def correct_cards(mtgjson, manual_cards=[], card_corrections=[], delete_cards=[]
|
||||
addManual = False
|
||||
if addManual:
|
||||
mtgjson2.append(manualCard)
|
||||
print 'inserting manual card ' + manualCard['name']
|
||||
manual_added.append(manualCard['name'])
|
||||
if manual_added != []:
|
||||
print "Manual Cards Added: " + str(manual_added).strip('[]')
|
||||
|
||||
mtgjson = {"cards": mtgjson2}
|
||||
|
||||
@@ -491,8 +493,8 @@ def get_scryfall(setUrl):
|
||||
scryfall.append(setcards['data'])
|
||||
else:
|
||||
setDone = True
|
||||
print setUrl
|
||||
print setcards
|
||||
#print setUrl
|
||||
#print setcards
|
||||
print 'No Scryfall data'
|
||||
scryfall = ['']
|
||||
time.sleep(.1)
|
||||
|
||||
Reference in New Issue
Block a user