mirror of
https://github.com/Cockatrice/Magic-Spoiler.git
synced 2026-09-12 03:35:39 -05:00
Fix spoiler.xml
This commit is contained in:
7
main.py
7
main.py
@@ -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'])
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user