Update EditionTracking.py to work with new formats directory structure

This commit is contained in:
Mitchell Matthews
2018-08-23 11:54:47 -04:00
parent f217b3da3a
commit 0a3532d4c5

View File

@@ -102,7 +102,7 @@ def initializeForgeCards():
if not name or split: if not name or split:
name += line[5:].rstrip().lower() name += line[5:].rstrip().lower()
elif line.startswith("AlternateMode") and 'Split' in line: elif line.startswith("AlternateMode") and 'Split' in line:
split = True split = True
@@ -110,11 +110,11 @@ def initializeForgeCards():
def initializeFormats(): def initializeFormats():
formats = {} formats = {}
formatLocation = os.path.join(resDir, 'formats') formatLocation = os.path.join(resDir, 'formats', 'Sanctioned')
print "Looking for formats in ", formatLocation print "Looking for formats in ", formatLocation
for root, dirnames, filenames in os.walk(formatLocation): for root, dirnames, filenames in os.walk(formatLocation):
for fileName in fnmatch.filter(filenames, '*.txt'): for fileName in fnmatch.filter(filenames, '*.txt'):
if fileName not in ['standard.txt', 'Modern.txt']: if fileName not in ['Standard.txt', 'Modern.txt']:
continue continue
with open(os.path.join(root, fileName)) as formatFile: with open(os.path.join(root, fileName)) as formatFile:
@@ -298,7 +298,7 @@ if __name__ == '__main__':
elif key != "": elif key != "":
currentMissing.append(key) currentMissing.append(key)
total = len(currentMissing)+len(currentImplemented) total = len(currentMissing)+len(currentImplemented)
percentage = 0 percentage = 0
if total > 0 : if total > 0 :
percentage = (float(len(currentImplemented))/float(total))*100 percentage = (float(len(currentImplemented))/float(total))*100
currentMissing.sort() currentMissing.sort()
@@ -338,7 +338,7 @@ if __name__ == '__main__':
text = normalizeOracle(orc.get('text')) text = normalizeOracle(orc.get('text'))
except: except:
text = '' text = ''
output.write(text + '\n\n') output.write(text + '\n\n')
output.write("\n") output.write("\n")
output.write("Total: " + str(total) + "\n") output.write("Total: " + str(total) + "\n")