mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
- Fixing the two scripts that were broken because they were expecting an End clause in card scripts
This commit is contained in:
@@ -71,8 +71,7 @@ def writeOutCard(root, fileName, lines, oracle, sets):
|
|||||||
else:
|
else:
|
||||||
cardfile.write('SetInfo:%s|%s|\n' % (setInfo[0],setInfo[1]))
|
cardfile.write('SetInfo:%s|%s|\n' % (setInfo[0],setInfo[1]))
|
||||||
'''
|
'''
|
||||||
|
|
||||||
cardfile.write('End')
|
|
||||||
cardfile.close()
|
cardfile.close()
|
||||||
|
|
||||||
|
|
||||||
@@ -126,12 +125,12 @@ def getOracleFromMagicCardsInfo(name):
|
|||||||
|
|
||||||
def hasOracleLine(cardFile, lines, offlineSource=True):
|
def hasOracleLine(cardFile, lines, offlineSource=True):
|
||||||
# Start parsing the rest of the data file
|
# Start parsing the rest of the data file
|
||||||
line = cardFile.readline().strip()
|
|
||||||
hasOracle = False
|
hasOracle = False
|
||||||
while line != 'End':
|
|
||||||
|
for line in cardFile.readlines():
|
||||||
|
line = line.strip()
|
||||||
# Skip empty lines
|
# Skip empty lines
|
||||||
if line == '':
|
if line == '':
|
||||||
line = cardFile.readline().strip()
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if line.find(oracleStr) != -1:
|
if line.find(oracleStr) != -1:
|
||||||
@@ -144,8 +143,6 @@ def hasOracleLine(cardFile, lines, offlineSource=True):
|
|||||||
else:
|
else:
|
||||||
lines += line + '\n'
|
lines += line + '\n'
|
||||||
|
|
||||||
line = cardFile.readline().strip()
|
|
||||||
|
|
||||||
cardFile.close()
|
cardFile.close()
|
||||||
return hasOracle, lines
|
return hasOracle, lines
|
||||||
|
|
||||||
|
|||||||
@@ -236,18 +236,12 @@ for root, dirnames, filenames in os.walk(folder):
|
|||||||
card.lines = line + '\n'
|
card.lines = line + '\n'
|
||||||
|
|
||||||
# Start parsing the rest of the data file
|
# Start parsing the rest of the data file
|
||||||
line = file.readline().strip()
|
for line in file.readlines():
|
||||||
|
line = line.strip()
|
||||||
while line != 'End':
|
|
||||||
# Skip empty lines
|
# Skip empty lines
|
||||||
if line == '':
|
if line == '':
|
||||||
line = file.readline().strip()
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# We really shouldn't
|
|
||||||
if line == 'End':
|
|
||||||
break
|
|
||||||
|
|
||||||
if line.find(setStr) != -1:
|
if line.find(setStr) != -1:
|
||||||
info = line.replace('SetInfo:','')
|
info = line.replace('SetInfo:','')
|
||||||
parts = info.split('|')
|
parts = info.split('|')
|
||||||
@@ -257,8 +251,6 @@ for root, dirnames, filenames in os.walk(folder):
|
|||||||
else:
|
else:
|
||||||
card.lines += line +'\n'
|
card.lines += line +'\n'
|
||||||
|
|
||||||
line = file.readline().strip()
|
|
||||||
|
|
||||||
if not card.hasSet:
|
if not card.hasSet:
|
||||||
addSets(card)
|
addSets(card)
|
||||||
card.hasSet = True
|
card.hasSet = True
|
||||||
@@ -269,8 +261,6 @@ for root, dirnames, filenames in os.walk(folder):
|
|||||||
for s in card.sets.values():
|
for s in card.sets.values():
|
||||||
file.write('SetInfo:'+ s.set + '|' + s.rarity + '|' + s.image + '\n')
|
file.write('SetInfo:'+ s.set + '|' + s.rarity + '|' + s.image + '\n')
|
||||||
|
|
||||||
file.write('End')
|
|
||||||
|
|
||||||
err.write(card.name + '... Updated\n')
|
err.write(card.name + '... Updated\n')
|
||||||
|
|
||||||
file.close()
|
file.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user