mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
- Simplify how DistinctOracle text in PerSetTracking.py is accumulated
This commit is contained in:
@@ -64,7 +64,7 @@ def printDistinctOracle(missingSet, fileName):
|
|||||||
for s in missing:
|
for s in missing:
|
||||||
if s:
|
if s:
|
||||||
oracle = mtgOracleCards.get(s, "")
|
oracle = mtgOracleCards.get(s, "")
|
||||||
outfile.write("%s\n%s\n" % (s, oracle))
|
outfile.write("%s\n%s" % (s, oracle))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
@@ -92,12 +92,12 @@ if __name__ == '__main__':
|
|||||||
tmpName = ""
|
tmpName = ""
|
||||||
line = ""
|
line = ""
|
||||||
prevline = ""
|
prevline = ""
|
||||||
twoPrior = ""
|
|
||||||
|
|
||||||
#Parse mtg-data
|
#Parse mtg-data
|
||||||
print("Parsing mtg-data")
|
print("Parsing mtg-data")
|
||||||
with open(pathToMtgData) as mtgdata :
|
with open(pathToMtgData) as mtgdata :
|
||||||
for line in mtgdata :
|
for line in mtgdata :
|
||||||
|
# Parse the sets at the top of the mtgdata file
|
||||||
if not hasFetchedSets :
|
if not hasFetchedSets :
|
||||||
if line != "\n" :
|
if line != "\n" :
|
||||||
splitLine = line.split(' ')
|
splitLine = line.split(' ')
|
||||||
@@ -108,13 +108,18 @@ if __name__ == '__main__':
|
|||||||
else :
|
else :
|
||||||
hasFetchedSets = True
|
hasFetchedSets = True
|
||||||
|
|
||||||
|
# Once all sets are parsed, time to parse the cards
|
||||||
if hasFetchedSets :
|
if hasFetchedSets :
|
||||||
if not hasFetchedCardName :
|
if not hasFetchedCardName :
|
||||||
tmpName = line.rstrip().replace("AE", "Ae")
|
tmpName = line.rstrip().replace("AE", "Ae")
|
||||||
hasFetchedCardName = True
|
hasFetchedCardName = True
|
||||||
|
oracle = ""
|
||||||
|
|
||||||
|
else:
|
||||||
|
oracle += line
|
||||||
|
|
||||||
if line == "\n" :
|
if line == "\n" :
|
||||||
mtgOracleCards[tmpName] = twoPrior
|
mtgOracleCards[tmpName] = oracle.replace(prevline, '')
|
||||||
sets = prevline.split(", ")
|
sets = prevline.split(", ")
|
||||||
for i in range(len(sets)):
|
for i in range(len(sets)):
|
||||||
sets[i] = sets[i].split(' ')[0]
|
sets[i] = sets[i].split(' ')[0]
|
||||||
@@ -122,7 +127,6 @@ if __name__ == '__main__':
|
|||||||
mtgDataCards[tmpName] = sets
|
mtgDataCards[tmpName] = sets
|
||||||
hasFetchedCardName = False
|
hasFetchedCardName = False
|
||||||
|
|
||||||
twoPrior = prevline
|
|
||||||
prevline = line
|
prevline = line
|
||||||
|
|
||||||
#Parse Forge
|
#Parse Forge
|
||||||
|
|||||||
Reference in New Issue
Block a user