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

This commit is contained in:
Eric Blade 2010-08-03 13:03:26 -04:00
commit d715ba4f3a
3 changed files with 22 additions and 12 deletions

View File

@ -433,9 +433,9 @@ or None if we fail to get the info """
try:
in_fh = codecs.open(self.in_path, 'r', kodec)
whole_file = in_fh.read()
in_fh.close()
self.obs = whole_file[self.index:]
self.index = len(whole_file)
in_fh.close()
break
except:
pass

View File

@ -72,7 +72,7 @@ class PokerStars(HandHistoryConverter):
(Tournament\s\# # open paren of tournament info
(?P<TOURNO>\d+),\s
# here's how I plan to use LS
(?P<BUYIN>(?P<BIAMT>[%(LS)s\d\.]+)?\+?(?P<BOUNTY>[%(LS)s\d\.]+)?\+?(?P<BIRAKE>[%(LS)s\d\.]+)\s?(?P<TOUR_ISO>%(LEGAL_ISO)s)?|Freeroll)\s+)?
(?P<BUYIN>(?P<BIAMT>[%(LS)s\d\.]+)?\+?(?P<BIRAKE>[%(LS)s\d\.]+)?\+?(?P<BOUNTY>[%(LS)s\d\.]+)?\s?(?P<TOUR_ISO>%(LEGAL_ISO)s)?|Freeroll)\s+)?
# close paren of tournament info
(?P<MIXED>HORSE|8\-Game|HOSE)?\s?\(?
(?P<GAME>Hold\'em|Razz|RAZZ|7\sCard\sStud|7\sCard\sStud\sHi/Lo|Omaha|Omaha\sHi/Lo|Badugi|Triple\sDraw\s2\-7\sLowball|5\sCard\sDraw)\s
@ -251,17 +251,24 @@ class PokerStars(HandHistoryConverter):
#FIXME: handle other currencies, FPP, play money
raise FpdbParseError("failed to detect currency")
info['BIAMT'] = info['BIAMT'].strip(u'$€FPP')
if hand.buyinCurrency!="PSFP":
hand.buyin = int(100*Decimal(info['BIAMT'][1:]))
if info['BIRAKE'][0]!="$": #we have a non-bounty game
info['BOUNTY']=info['BOUNTY']+info['BIRAKE'] #TODO remove this dirty dirty hack by fixing regex
hand.fee = int(100*Decimal(info['BOUNTY'][1:]))
else:
hand.fee = int(100*Decimal(info['BIRAKE'][1:]))
if info['BOUNTY'] != None:
# There is a bounty, Which means we need to switch BOUNTY and BIRAKE values
tmp = info['BOUNTY']
info['BOUNTY'] = info['BIRAKE']
info['BIRAKE'] = tmp
info['BOUNTY'] = info['BOUNTY'].strip(u'$€') # Strip here where it isn't 'None'
hand.koBounty = int(100*Decimal(info['BOUNTY']))
hand.isKO = True
hand.koBounty = int(100*Decimal(info['BOUNTY'][1:]))
info['BIRAKE'] = info['BIRAKE'].strip(u'$€')
hand.buyin = int(100*Decimal(info['BIAMT']))
hand.fee = int(100*Decimal(info['BIRAKE']))
else:
hand.buyin = int(Decimal(info[key][0:-3]))
hand.buyin = int(Decimal(info['BIAMT']))
hand.fee = 0
if key == 'LEVEL':
hand.level = info[key]

View File

@ -464,8 +464,11 @@ class Importer:
#pipe the Hands.id out to the HUD
for hid in to_hud:
print "fpdb_import: sending hand to hud", hand.dbid_hands, "pipe =", self.caller.pipe_to_hud
self.caller.pipe_to_hud.stdin.write("%s" % (hid) + os.linesep)
try:
print "fpdb_import: sending hand to hud", hand.dbid_hands, "pipe =", self.caller.pipe_to_hud
self.caller.pipe_to_hud.stdin.write("%s" % (hid) + os.linesep)
except IOError, e:
log.error("Failed to send hand to HUD: %s" % e)
errors = getattr(hhc, 'numErrors')
stored = getattr(hhc, 'numHands')