- Fixing the two scripts that were broken because they were expecting an End clause in card scripts

This commit is contained in:
Sol
2013-02-26 01:25:18 +00:00
parent fb8398ccbd
commit 927e2b4769
2 changed files with 6 additions and 19 deletions

View File

@@ -72,7 +72,6 @@ def writeOutCard(root, fileName, lines, oracle, sets):
cardfile.write('SetInfo:%s|%s|\n' % (setInfo[0],setInfo[1]))
'''
cardfile.write('End')
cardfile.close()
@@ -126,12 +125,12 @@ def getOracleFromMagicCardsInfo(name):
def hasOracleLine(cardFile, lines, offlineSource=True):
# Start parsing the rest of the data file
line = cardFile.readline().strip()
hasOracle = False
while line != 'End':
for line in cardFile.readlines():
line = line.strip()
# Skip empty lines
if line == '':
line = cardFile.readline().strip()
continue
if line.find(oracleStr) != -1:
@@ -144,8 +143,6 @@ def hasOracleLine(cardFile, lines, offlineSource=True):
else:
lines += line + '\n'
line = cardFile.readline().strip()
cardFile.close()
return hasOracle, lines

View File

@@ -236,18 +236,12 @@ for root, dirnames, filenames in os.walk(folder):
card.lines = line + '\n'
# Start parsing the rest of the data file
line = file.readline().strip()
while line != 'End':
for line in file.readlines():
line = line.strip()
# Skip empty lines
if line == '':
line = file.readline().strip()
continue
# We really shouldn't
if line == 'End':
break
if line.find(setStr) != -1:
info = line.replace('SetInfo:','')
parts = info.split('|')
@@ -257,8 +251,6 @@ for root, dirnames, filenames in os.walk(folder):
else:
card.lines += line +'\n'
line = file.readline().strip()
if not card.hasSet:
addSets(card)
card.hasSet = True
@@ -269,8 +261,6 @@ for root, dirnames, filenames in os.walk(folder):
for s in card.sets.values():
file.write('SetInfo:'+ s.set + '|' + s.rarity + '|' + s.image + '\n')
file.write('End')
err.write(card.name + '... Updated\n')
file.close()