mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Simple fix for EditionTracking with new format style
This commit is contained in:
@@ -110,18 +110,28 @@ def initializeForgeCards():
|
|||||||
|
|
||||||
def initializeFormats():
|
def initializeFormats():
|
||||||
formats = {}
|
formats = {}
|
||||||
formatLocation = os.path.join(resDir, 'blockdata', 'formats.txt')
|
formatLocation = os.path.join(resDir, 'formats')
|
||||||
print "Looking for formats in ", formatLocation
|
print "Looking for formats in ", formatLocation
|
||||||
with open(formatLocation) as formatFile:
|
for root, dirnames, filenames in os.walk(formatLocation):
|
||||||
|
for fileName in fnmatch.filter(filenames, '*.txt'):
|
||||||
|
if fileName not in ['standard.txt', 'Modern.txt']:
|
||||||
|
continue
|
||||||
|
|
||||||
|
with open(os.path.join(root, fileName)) as formatFile:
|
||||||
while formatFile:
|
while formatFile:
|
||||||
try:
|
try:
|
||||||
line = formatFile.readline().strip()
|
line = formatFile.readline().strip()
|
||||||
if not line:
|
if not line:
|
||||||
# this should only happen when the file is done processing if we did things correctly?
|
# this should only happen when the file is done processing if we did things correctly?
|
||||||
break
|
break
|
||||||
|
if line == '[format]':
|
||||||
|
line = formatFile.readline().strip()
|
||||||
|
|
||||||
format = line[1:-1]
|
if line.startswith('Name:'):
|
||||||
|
format = line.split(':')[1]
|
||||||
formats[format] = {}
|
formats[format] = {}
|
||||||
|
else:
|
||||||
|
break
|
||||||
except:
|
except:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user