Merge branch 'master' of git://git.assembla.com/fpdboz
This commit is contained in:
commit
0670637abc
|
@ -48,6 +48,8 @@ class HandHistoryConverter():
|
||||||
self.in_path = in_path
|
self.in_path = in_path
|
||||||
self.out_path = out_path
|
self.out_path = out_path
|
||||||
|
|
||||||
|
self.processedHands = []
|
||||||
|
|
||||||
if in_path == '-':
|
if in_path == '-':
|
||||||
self.in_fh = sys.stdin
|
self.in_fh = sys.stdin
|
||||||
|
|
||||||
|
@ -90,7 +92,7 @@ Otherwise, finish at eof.
|
||||||
handsList = self.allHandsAsList()
|
handsList = self.allHandsAsList()
|
||||||
logging.info("Parsing %d hands" % len(handsList))
|
logging.info("Parsing %d hands" % len(handsList))
|
||||||
for handText in handsList:
|
for handText in handsList:
|
||||||
self.processHand(handText)
|
self.processedHands.append(self.processHand(handText))
|
||||||
numHands= len(handsList)
|
numHands= len(handsList)
|
||||||
endtime = time.time()
|
endtime = time.time()
|
||||||
print "read %d hands in %.3f seconds" % (numHands, endtime - starttime)
|
print "read %d hands in %.3f seconds" % (numHands, endtime - starttime)
|
||||||
|
@ -200,6 +202,7 @@ which it expects to find at self.re_TailSplitHands -- see for e.g. Everleaf.py.
|
||||||
if hand:
|
if hand:
|
||||||
# print hand
|
# print hand
|
||||||
hand.writeHand(self.out_fh)
|
hand.writeHand(self.out_fh)
|
||||||
|
return hand
|
||||||
else:
|
else:
|
||||||
logging.info("Unsupported game type: %s" % gametype)
|
logging.info("Unsupported game type: %s" % gametype)
|
||||||
# TODO: pity we don't know the HID at this stage. Log the entire hand?
|
# TODO: pity we don't know the HID at this stage. Log the entire hand?
|
||||||
|
@ -310,6 +313,7 @@ or None if we fail to get the info """
|
||||||
self.filetype = filetype
|
self.filetype = filetype
|
||||||
self.codepage = codepage
|
self.codepage = codepage
|
||||||
|
|
||||||
|
#This function doesn't appear to be used
|
||||||
def splitFileIntoHands(self):
|
def splitFileIntoHands(self):
|
||||||
hands = []
|
hands = []
|
||||||
self.obs = self.obs.strip()
|
self.obs = self.obs.strip()
|
||||||
|
@ -347,6 +351,9 @@ or None if we fail to get the info """
|
||||||
#TODO: Return a status of true if file processed ok
|
#TODO: Return a status of true if file processed ok
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def getProcessedHands(self):
|
||||||
|
return self.processedHands
|
||||||
|
|
||||||
def getProcessedFile(self):
|
def getProcessedFile(self):
|
||||||
return self.out_path
|
return self.out_path
|
||||||
|
|
||||||
|
|
|
@ -317,12 +317,12 @@ class Importer:
|
||||||
(stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(out_path, site)
|
(stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(out_path, site)
|
||||||
elif (conv.getStatus() and self.NEWIMPORT == True):
|
elif (conv.getStatus() and self.NEWIMPORT == True):
|
||||||
#This code doesn't do anything yet
|
#This code doesn't do anything yet
|
||||||
handlist = hhc.getProcessedHands()
|
handlist = conv.getProcessedHands()
|
||||||
self.pos_in_file[file] = hhc.getLastCharacterRead()
|
self.pos_in_file[file] = conv.getLastCharacterRead()
|
||||||
|
|
||||||
for hand in handlist:
|
for hand in handlist:
|
||||||
hand.prepInsert()
|
hand.prepInsert(self.fdb)
|
||||||
hand.insert()
|
hand.insert(self.fdb)
|
||||||
else:
|
else:
|
||||||
# conversion didn't work
|
# conversion didn't work
|
||||||
# TODO: appropriate response?
|
# TODO: appropriate response?
|
||||||
|
|
Loading…
Reference in New Issue
Block a user