Fix spoiler.xml

This commit is contained in:
tritoch
2017-06-01 14:33:35 -05:00
parent 0946cc7db5
commit e3a926fe39
2 changed files with 7 additions and 3 deletions

View File

@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
import spoilers
import sys
import os
import shutil
#import configparser
import json
#import urllib
@@ -63,6 +65,10 @@ def save_errorlog(errorlog):
with open('out/errors.json', 'w') as outfile:
json.dump(errorlog, outfile, sort_keys=True, indent=2, separators=(',', ': '))
def copy_to_spoiler(setcode):
if os.path.isfile('out/' + setcode + '.xml'):
shutil.copy('out/' + setcode + '.xml','out/spoiler.xml')
if __name__ == '__main__':
AllSets = spoilers.get_allsets() #get AllSets from mtgjson
if presets['oldRSS']:
@@ -91,3 +97,4 @@ if __name__ == '__main__':
save_errorlog(errorlog)
save_allsets(AllSets)
save_setjson(mtgs)
copy_to_spoiler(setinfos['setname'])

View File

@@ -851,9 +851,6 @@ def write_xml(mtgjson, setname, setlongname, setreleasedate, split_cards=[]):
cardsxml.write("</card>\n")
cardsxml.write("</cards>\n</cockatrice_carddatabase>")
if not 'MPS' in setname:
if os.path.isfile('out/' + setname + '.xml'):
shutil.copyfile('out/' + setname + '.xml','out/spoiler.xml')
#failing pretty xml code
#with open('out/' + setname + '.xml') as data_file: