[NEWIMPORT] Add call to HUD for auto import

Make sure the matching db_handid is recorded in the Hand object for later use
This commit is contained in:
Worros 2009-12-06 23:02:07 +08:00
parent 909c2bd0fc
commit 0061bd0644
2 changed files with 8 additions and 2 deletions

View File

@ -54,6 +54,7 @@ class Hand(object):
self.starttime = 0 self.starttime = 0
self.handText = handText self.handText = handText
self.handid = 0 self.handid = 0
self.dbid_hands = 0
self.tablename = "" self.tablename = ""
self.hero = "" self.hero = ""
self.maxseats = None self.maxseats = None
@ -218,8 +219,8 @@ db: a connected fpdb_db object"""
# seats TINYINT NOT NULL, # seats TINYINT NOT NULL,
hh['seats'] = len(sqlids) hh['seats'] = len(sqlids)
handid = db.storeHand(hh) self.dbid_hands = db.storeHand(hh)
db.storeHandsPlayers(handid, sqlids, self.stats.getHandsPlayers()) db.storeHandsPlayers(self.dbid_hands, sqlids, self.stats.getHandsPlayers())
# HandsActions - all actions for all players for all streets - self.actions # HandsActions - all actions for all players for all streets - self.actions
# HudCache data can be generated from HandsActions (HandsPlayers?) # HudCache data can be generated from HandsActions (HandsPlayers?)
# Tourneys ? # Tourneys ?

View File

@ -430,6 +430,11 @@ class Importer:
#try, except duplicates here? #try, except duplicates here?
#hand.prepInsert() #hand.prepInsert()
hand.insert(self.database) hand.insert(self.database)
if self.callHud and hand.dbid_hands != 0:
#print "DEBUG: call to HUD: handsId: %s" % hand.dbid_hands
#pipe the Hands.id out to the HUD
# print "fpdb_import: sending hand to hud", handsId, "pipe =", self.caller.pipe_to_hud
self.caller.pipe_to_hud.stdin.write("%s" % (hand.dbid_hands) + os.linesep)
errors = getattr(hhc, 'numErrors') errors = getattr(hhc, 'numErrors')
stored = getattr(hhc, 'numHands') stored = getattr(hhc, 'numHands')