Merge pull request #145 from dev-id/future-sets-cleanup

Don't make set files for sets without cards.
This commit is contained in:
Dave
2017-09-07 11:28:09 -05:00
committed by GitHub
2 changed files with 7 additions and 3 deletions

View File

@@ -158,9 +158,11 @@ if __name__ == '__main__':
save_masterpieces(masterpieces, setinfo)
save_xml(spoilers.pretty_xml('out/' + setinfo['masterpieces']['code'] + '.xml'), 'out/' + setinfo['masterpieces']['code'] + '.xml')
combinedjson[setinfo['masterpieces']['code']] = masterpieces
save_setjson(mtgjson, setinfo['code'])
save_xml(spoilers.pretty_xml('out/' + setinfo['code'] + '.xml'), 'out/' + setinfo['code'] + '.xml')
combinedjson[setinfo['code']] = mtgjson
if 'cards' in mtgjson and mtgjson['cards'] and not mtgjson['cards'] == []:
save_setjson(mtgjson, setinfo['code'])
combinedjson[setinfo['code']] = mtgjson
if os.path.isfile('out/' + setinfo['code'] + '.xml'):
save_xml(spoilers.pretty_xml('out/' + setinfo['code'] + '.xml'), 'out/' + setinfo['code'] + '.xml')
save_setjson(combinedjson, 'spoiler')
spoilers.write_combined_xml(combinedjson, setinfos)
save_xml(spoilers.pretty_xml('out/spoiler.xml'), 'out/spoiler.xml')

View File

@@ -362,6 +362,8 @@ def get_image_urls(mtgjson, isfullspoil, setinfo=False):
def write_xml(mtgjson, code, name, releaseDate):
if not 'cards' in mtgjson or not mtgjson['cards'] or mtgjson['cards'] == []:
return
if not os.path.isdir('out/'):
os.makedirs('out/')
cardsxml = open('out/' + code + '.xml', 'w+')