p103 - reading small blinds now rather than assuming them

This commit is contained in:
steffen123
2008-09-24 05:47:17 +01:00
parent c19c933942
commit 005627b9d7
3 changed files with 17 additions and 7 deletions
+8 -1
View File
@@ -39,7 +39,14 @@ def mainParser(db, cursor, site, category, hand):
#print "parse logic, siteID:",siteID,"site:",site
isTourney=fpdb_simple.isTourney(hand[0])
gametypeID=fpdb_simple.recogniseGametypeID(cursor, hand[0], siteID, category, isTourney)
smallBlindLine=0
for i in range(len(hand)):
if hand[i].find("posts small blind")!=-1 or hand[i].find("posts the small blind")!=-1:
smallBlindLine=i
#print "found small blind line:",smallBlindLine
break
#print "small blind line:",smallBlindLine
gametypeID=fpdb_simple.recogniseGametypeID(cursor, hand[0], hand[smallBlindLine], siteID, category, isTourney)
if isTourney:
if site!="ps":
raise fpdb_simple.FpdbError("tourneys are only supported on PS right now")
+7 -3
View File
@@ -972,7 +972,7 @@ def recogniseCategory(line):
#end def recogniseCategory
#returns the int for the gametype_id for the given line
def recogniseGametypeID(cursor, topline, site_id, category, isTourney):#todo: this method is messy
def recogniseGametypeID(cursor, topline, smallBlindLine, site_id, category, isTourney):#todo: this method is messy
#if (topline.find("HORSE")!=-1):
# raise FpdbError("recogniseGametypeID: HORSE is not yet supported.")
@@ -1043,8 +1043,12 @@ def recogniseGametypeID(cursor, topline, site_id, category, isTourney):#todo: th
hiLo='s'
if (limit_type=="fl"):
big_blind=small_bet #todo: read this
small_blind=big_blind/2 #todo: read this
big_blind=small_bet
if smallBlindLine==topline:
raise fpdb_simple.FpdbError("invalid small blind line")
else:
pos=smallBlindLine.rfind("$")+1
small_blind=float2int(smallBlindLine[pos:])
cursor.execute("""INSERT INTO Gametypes
(siteId, type, base, category, limitType, hiLo, smallBlind, bigBlind, smallBet, bigBet)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", (site_id, type, base, category, limit_type, hiLo, small_blind, big_blind, small_bet, big_bet))