diff --git a/main.py b/main.py index 8552ba8f..96a15fca 100644 --- a/main.py +++ b/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: