Merge branch 'master' of git://git.assembla.com/fpdboz

This commit is contained in:
Ray 2009-07-19 16:50:22 -04:00
commit 00aeda5667
2 changed files with 12 additions and 5 deletions

View File

@ -48,6 +48,8 @@ class HandHistoryConverter():
self.in_path = in_path
self.out_path = out_path
self.processedHands = []
if in_path == '-':
self.in_fh = sys.stdin
@ -90,7 +92,7 @@ Otherwise, finish at eof.
handsList = self.allHandsAsList()
logging.info("Parsing %d hands" % len(handsList))
for handText in handsList:
self.processHand(handText)
self.processedHands.append(self.processHand(handText))
numHands= len(handsList)
endtime = time.time()
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:
# print hand
hand.writeHand(self.out_fh)
return hand
else:
logging.info("Unsupported game type: %s" % gametype)
# 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.codepage = codepage
#This function doesn't appear to be used
def splitFileIntoHands(self):
hands = []
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
return True
def getProcessedHands(self):
return self.processedHands
def getProcessedFile(self):
return self.out_path

View File

@ -317,12 +317,12 @@ class Importer:
(stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(out_path, site)
elif (conv.getStatus() and self.NEWIMPORT == True):
#This code doesn't do anything yet
handlist = hhc.getProcessedHands()
self.pos_in_file[file] = hhc.getLastCharacterRead()
handlist = conv.getProcessedHands()
self.pos_in_file[file] = conv.getLastCharacterRead()
for hand in handlist:
hand.prepInsert()
hand.insert()
hand.prepInsert(self.fdb)
hand.insert(self.fdb)
else:
# conversion didn't work
# TODO: appropriate response?