mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
make tool scripts working-directory agnostic
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
pathToMtgData = "mtg-data.txt"
|
|
||||||
|
|
||||||
############IMPLEMENTATION FOLLOWS############
|
############IMPLEMENTATION FOLLOWS############
|
||||||
import os,sys,fnmatch,re
|
import os,sys,fnmatch,re
|
||||||
|
|
||||||
|
pathToMtgData = os.path.join(sys.path[0], "mtg-data.txt")
|
||||||
|
|
||||||
def getSetByFormat(requestedFormat):
|
def getSetByFormat(requestedFormat):
|
||||||
# Parse out Standard sets from the Format file
|
# Parse out Standard sets from the Format file
|
||||||
formatLocation = os.path.join(sys.path[0], '..', 'res', 'blockdata', 'formats.txt')
|
formatLocation = os.path.join(sys.path[0], '..', 'res', 'blockdata', 'formats.txt')
|
||||||
@@ -207,7 +207,7 @@ if __name__ == '__main__':
|
|||||||
totalMissing = 0
|
totalMissing = 0
|
||||||
totalImplemented = 0
|
totalImplemented = 0
|
||||||
fullTotal = 0
|
fullTotal = 0
|
||||||
with open(sys.path[0] + os.sep + "PerSetTrackingResults" + os.sep + "CompleteStats.txt", "w") as statsfile:
|
with open(os.path.join(sys.path[0], "PerSetTrackingResults", "CompleteStats.txt"), "w") as statsfile:
|
||||||
statsfile.write("Set: Implemented (Missing) / Total = Percentage Implemented\n")
|
statsfile.write("Set: Implemented (Missing) / Total = Percentage Implemented\n")
|
||||||
for k,dataKey in totalDataList :
|
for k,dataKey in totalDataList :
|
||||||
totalImplemented += dataKey[0]
|
totalImplemented += dataKey[0]
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
import os,sys,fnmatch,re
|
import os,sys,fnmatch,re
|
||||||
|
|
||||||
pathToMtgData = "mtg-data.txt"
|
pathToMtgData = os.path.join(sys.path[0], "mtg-data.txt")
|
||||||
pathToSetsMatchTable = "mtgdata-sets-to-forge.txt"
|
pathToSetsMatchTable = os.path.join(sys.path[0], "mtgdata-sets-to-forge.txt")
|
||||||
|
|
||||||
class cis: # CardInSet
|
class cis: # CardInSet
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
pathToMtgData = "mtg-data.txt"
|
|
||||||
|
|
||||||
############IMPLEMENTATION FOLLOWS############
|
############IMPLEMENTATION FOLLOWS############
|
||||||
import os,sys,fnmatch
|
import os,sys,fnmatch
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
pathToMtgData = os.path.join(sys.path[0], "mtg-data.txt")
|
||||||
|
|
||||||
class Card:
|
class Card:
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
import os, fnmatch, re, sys
|
import os, fnmatch, re, sys
|
||||||
from urllib import urlopen
|
from urllib import urlopen
|
||||||
|
|
||||||
|
pathToMtgData = os.path.join(sys.path[0], "mtg-data.txt")
|
||||||
|
|
||||||
onlineOptions = [ 'false', 'f', 'no', 'n' ]
|
onlineOptions = [ 'false', 'f', 'no', 'n' ]
|
||||||
offlineSource = True
|
offlineSource = True
|
||||||
setAbbr = None
|
setAbbr = None
|
||||||
@@ -33,7 +35,7 @@ elif not offlineSource:
|
|||||||
|
|
||||||
mtgData = None
|
mtgData = None
|
||||||
if offlineSource:
|
if offlineSource:
|
||||||
parseFrom = open('mtg-data.txt', 'r')
|
parseFrom = open(pathToMtgData, 'r')
|
||||||
else:
|
else:
|
||||||
# Load Spoiler view of the set
|
# Load Spoiler view of the set
|
||||||
parseFrom = urlopen("http://magiccards.info/query?q=e:%s&v=spoiler&s=cname" % (setAbbr))
|
parseFrom = urlopen("http://magiccards.info/query?q=e:%s&v=spoiler&s=cname" % (setAbbr))
|
||||||
@@ -43,7 +45,7 @@ parseFrom.close()
|
|||||||
print "Size of parse data: %s" % len(mtgData)
|
print "Size of parse data: %s" % len(mtgData)
|
||||||
|
|
||||||
folder = os.path.join(sys.path[0], '..', 'res', 'cardsfolder')
|
folder = os.path.join(sys.path[0], '..', 'res', 'cardsfolder')
|
||||||
err = open('oracleScript.log', 'w')
|
err = open(os.path.join(sys.path[0], 'oracleScript.log'), 'w')
|
||||||
|
|
||||||
setStr = 'SetInfo:'
|
setStr = 'SetInfo:'
|
||||||
oracleStr = 'Oracle:'
|
oracleStr = 'Oracle:'
|
||||||
|
|||||||
Reference in New Issue
Block a user