mirror of
https://github.com/Cockatrice/Magic-Spoiler.git
synced 2026-03-29 13:44:58 -05:00
Add command line argument parser.
Can change a preset by adding `preset=newvalue` to command line execution.
This commit is contained in:
parent
45d2233058
commit
75421ddd2d
12
main.py
12
main.py
|
|
@ -3,6 +3,7 @@ import spoilers
|
|||
import os
|
||||
import commentjson
|
||||
import json
|
||||
import sys
|
||||
|
||||
presets = {
|
||||
"isfullspoil": False, # when full spoil comes around, we only want to use WOTC images
|
||||
|
|
@ -12,8 +13,9 @@ presets = {
|
|||
"Grind": "Dust"
|
||||
},
|
||||
"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": True # let travis print XML for testing
|
||||
"dumpXML": False # let travis print XML for testing
|
||||
}
|
||||
|
||||
with open('set_info') as data_file:
|
||||
|
|
@ -32,7 +34,12 @@ errorlog = []
|
|||
|
||||
#TODO insert configparser to add config.ini file
|
||||
|
||||
#TODO parse arguments so we can have Travis print xml for testing
|
||||
def parseargs():
|
||||
for argument in sys.argv:
|
||||
for preset in presets:
|
||||
if argument.split('=')[0].lower().replace('-','') == preset.lower():
|
||||
presets[preset] = argument.split('=')[1]
|
||||
print "Setting preset " + preset + " to value " + argument.split('=')[1]
|
||||
|
||||
def save_allsets(AllSets):
|
||||
#TODO Create AllSets.json for Oracle
|
||||
|
|
@ -67,6 +74,7 @@ def save_xml(xmlstring, outfile):
|
|||
xmlfile.write(xmlstring.encode('utf-8'))
|
||||
|
||||
if __name__ == '__main__':
|
||||
parseargs()
|
||||
AllSets = spoilers.get_allsets() #get AllSets from mtgjson
|
||||
combinedjson = {}
|
||||
for setinfo in setinfos:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user