p44 - implement hands.tableName/importTime
This commit is contained in:
parent
9531c8d85b
commit
18ff57027f
|
@ -3,7 +3,7 @@ Everything is subject to change and especially the order will often change. Patc
|
||||||
|
|
||||||
alpha2 (release by 17Aug)
|
alpha2 (release by 17Aug)
|
||||||
======
|
======
|
||||||
implement hands.tableName/importTime HandsPlayers.seatNo
|
HandsPlayers.seatNo
|
||||||
|
|
||||||
change tabledesign VALIGN
|
change tabledesign VALIGN
|
||||||
seperate and improve instructions for update
|
seperate and improve instructions for update
|
||||||
|
|
|
@ -370,7 +370,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
|
||||||
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
||||||
self.window.connect("delete_event", self.delete_event)
|
self.window.connect("delete_event", self.delete_event)
|
||||||
self.window.connect("destroy", self.destroy)
|
self.window.connect("destroy", self.destroy)
|
||||||
self.window.set_title("Free Poker DB - version: alpha1+, p43")
|
self.window.set_title("Free Poker DB - version: alpha1+, p44")
|
||||||
self.window.set_border_width(1)
|
self.window.set_border_width(1)
|
||||||
self.window.set_size_request(1020,400)
|
self.window.set_size_request(1020,400)
|
||||||
self.window.set_resizable(True)
|
self.window.set_resizable(True)
|
||||||
|
|
|
@ -47,7 +47,7 @@ class fpdb_db:
|
||||||
try:
|
try:
|
||||||
self.cursor.execute("SELECT * FROM Settings")
|
self.cursor.execute("SELECT * FROM Settings")
|
||||||
settings=self.cursor.fetchone()
|
settings=self.cursor.fetchone()
|
||||||
if settings[0]!=43:
|
if settings[0]!=44:
|
||||||
print "outdated or too new database version - please recreate tables"
|
print "outdated or too new database version - please recreate tables"
|
||||||
except:# _mysql_exceptions.ProgrammingError:
|
except:# _mysql_exceptions.ProgrammingError:
|
||||||
print "failed to read settings table - please recreate tables"
|
print "failed to read settings table - please recreate tables"
|
||||||
|
@ -337,7 +337,7 @@ class fpdb_db:
|
||||||
riverCheckCallRaiseChance INT,
|
riverCheckCallRaiseChance INT,
|
||||||
riverCheckCallRaiseDone INT)""")
|
riverCheckCallRaiseDone INT)""")
|
||||||
|
|
||||||
self.cursor.execute("INSERT INTO Settings VALUES (43);")
|
self.cursor.execute("INSERT INTO Settings VALUES (44);")
|
||||||
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
|
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
|
||||||
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
|
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
|
||||||
self.cursor.execute("INSERT INTO TourneysGametypes (id) VALUES (DEFAULT);")
|
self.cursor.execute("INSERT INTO TourneysGametypes (id) VALUES (DEFAULT);")
|
||||||
|
|
|
@ -83,6 +83,10 @@ def mainParser(db, cursor, site, category, hand):
|
||||||
pass
|
pass
|
||||||
elif (lineTypes[i]=="ante"):
|
elif (lineTypes[i]=="ante"):
|
||||||
fpdb_simple.parseAnteLine(hand[i], site, names, antes)
|
fpdb_simple.parseAnteLine(hand[i], site, names, antes)
|
||||||
|
elif (lineTypes[i]=="table"):
|
||||||
|
result=fpdb_simple.parseTableLine(hand[i])
|
||||||
|
maxSeats=result['maxSeats']
|
||||||
|
tableName=result['tableName']
|
||||||
else:
|
else:
|
||||||
raise fpdb_simple.FpdbError("unrecognised lineType:"+lineTypes[i])
|
raise fpdb_simple.FpdbError("unrecognised lineType:"+lineTypes[i])
|
||||||
|
|
||||||
|
@ -114,7 +118,7 @@ def mainParser(db, cursor, site, category, hand):
|
||||||
prizepool=-1
|
prizepool=-1
|
||||||
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
|
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
|
||||||
result = fpdb_save_to_db.tourney_holdem_omaha(cursor, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks,
|
result = fpdb_save_to_db.tourney_holdem_omaha(cursor, category, siteTourneyNo, buyin, fee, knockout, entries, prizepool, tourneyStartTime, payin_amounts, ranks,
|
||||||
siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData)
|
siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData, maxSeats, tableName)
|
||||||
elif (category=="razz" or category=="studhi" or category=="studhilo"):
|
elif (category=="razz" or category=="studhi" or category=="studhilo"):
|
||||||
raise fpdb_simple.FpdbError ("stud/razz are currently broken")
|
raise fpdb_simple.FpdbError ("stud/razz are currently broken")
|
||||||
result = fpdb_save_to_db.tourney_stud(cursor, category, siteTourneyNo, buyin, fee,
|
result = fpdb_save_to_db.tourney_stud(cursor, category, siteTourneyNo, buyin, fee,
|
||||||
|
@ -124,7 +128,7 @@ def mainParser(db, cursor, site, category, hand):
|
||||||
actionTypes, actionAmounts, hudImportData)
|
actionTypes, actionAmounts, hudImportData)
|
||||||
else:
|
else:
|
||||||
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
|
if (category=="holdem" or category=="omahahi" or category=="omahahilo"):
|
||||||
result = fpdb_save_to_db.ring_holdem_omaha(cursor, category, siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData)
|
result = fpdb_save_to_db.ring_holdem_omaha(cursor, category, siteHandNo, gametypeID, handStartTime, names, playerIDs, startCashes, positions, cardValues, cardSuits, boardValues, boardSuits, winnings, rakes, actionTypes, actionAmounts, actionNos, hudImportData, maxSeats, tableName)
|
||||||
elif (category=="razz" or category=="studhi" or category=="studhilo"):
|
elif (category=="razz" or category=="studhi" or category=="studhilo"):
|
||||||
raise fpdb_simple.FpdbError ("stud/razz are currently broken")
|
raise fpdb_simple.FpdbError ("stud/razz are currently broken")
|
||||||
result = fpdb_save_to_db.ring_stud(cursor, category, siteHandNo, gametypeID,
|
result = fpdb_save_to_db.ring_stud(cursor, category, siteHandNo, gametypeID,
|
||||||
|
|
|
@ -37,7 +37,7 @@ def ring_stud(cursor, category, site_hand_no, gametype_id, hand_start_time,
|
||||||
return site_hand_no
|
return site_hand_no
|
||||||
#end def ring_stud
|
#end def ring_stud
|
||||||
|
|
||||||
def ring_holdem_omaha(cursor, category, site_hand_no, gametype_id, hand_start_time, names, player_ids, start_cashes, positions, card_values, card_suits, board_values, board_suits, winnings, rakes, action_types, action_amounts, actionNos, hudImportData):
|
def ring_holdem_omaha(cursor, category, site_hand_no, gametype_id, hand_start_time, names, player_ids, start_cashes, positions, card_values, card_suits, board_values, board_suits, winnings, rakes, action_types, action_amounts, actionNos, hudImportData, maxSeats, tableName):
|
||||||
"""stores a holdem/omaha hand into the database"""
|
"""stores a holdem/omaha hand into the database"""
|
||||||
|
|
||||||
#fill up the two player card arrays
|
#fill up the two player card arrays
|
||||||
|
@ -50,7 +50,7 @@ def ring_holdem_omaha(cursor, category, site_hand_no, gametype_id, hand_start_ti
|
||||||
|
|
||||||
fpdb_simple.fill_board_cards(board_values, board_suits)
|
fpdb_simple.fill_board_cards(board_values, board_suits)
|
||||||
|
|
||||||
hands_id=fpdb_simple.storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names)
|
hands_id=fpdb_simple.storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names, tableName)
|
||||||
|
|
||||||
hands_players_ids=fpdb_simple.store_hands_players_holdem_omaha(cursor, category, hands_id, player_ids,
|
hands_players_ids=fpdb_simple.store_hands_players_holdem_omaha(cursor, category, hands_id, player_ids,
|
||||||
start_cashes, positions, card_values, card_suits, winnings, rakes)
|
start_cashes, positions, card_values, card_suits, winnings, rakes)
|
||||||
|
|
|
@ -109,6 +109,8 @@ def classifyLines(hand, category, lineTypes, lineStreets):
|
||||||
currentStreet=7
|
currentStreet=7
|
||||||
elif (hand[i].find(" shows [")!=-1):
|
elif (hand[i].find(" shows [")!=-1):
|
||||||
lineTypes.append("cards")
|
lineTypes.append("cards")
|
||||||
|
elif (hand[i].startswith("Table '")):
|
||||||
|
lineTypes.append("table")
|
||||||
else:
|
else:
|
||||||
raise FpdbError("unrecognised linetype in:"+hand[i])
|
raise FpdbError("unrecognised linetype in:"+hand[i])
|
||||||
lineStreets.append(currentStreet)
|
lineStreets.append(currentStreet)
|
||||||
|
@ -340,8 +342,8 @@ def filterCrap(site, hand):
|
||||||
toRemove.append(hand[i])
|
toRemove.append(hand[i])
|
||||||
elif (hand[i].find(" is low with [")!=-1):
|
elif (hand[i].find(" is low with [")!=-1):
|
||||||
toRemove.append(hand[i])
|
toRemove.append(hand[i])
|
||||||
elif (hand[i].find("-max Seat #")!=-1 and hand[i].find(" is the button")!=-1):
|
#elif (hand[i].find("-max Seat #")!=-1 and hand[i].find(" is the button")!=-1):
|
||||||
toRemove.append(hand[i])
|
# toRemove.append(hand[i])
|
||||||
elif (hand[i].endswith(" mucks")):
|
elif (hand[i].endswith(" mucks")):
|
||||||
toRemove.append(hand[i])
|
toRemove.append(hand[i])
|
||||||
elif (hand[i].endswith(": mucks hand")):
|
elif (hand[i].endswith(": mucks hand")):
|
||||||
|
@ -860,7 +862,18 @@ def parseSiteHandNo(topline):
|
||||||
pos1=topline.find("#")+1
|
pos1=topline.find("#")+1
|
||||||
pos2=topline.find(":")
|
pos2=topline.find(":")
|
||||||
return topline[pos1:pos2]
|
return topline[pos1:pos2]
|
||||||
#end def parseHandSiteNo
|
#end def parseSiteHandNo
|
||||||
|
|
||||||
|
def parseTableLine(line):
|
||||||
|
"""returns a dictionary with maxSeats and tableName"""
|
||||||
|
pos1=line.find('\'')+1
|
||||||
|
pos2=line.find('\'', pos1)
|
||||||
|
#print "table:",line[pos1:pos2]
|
||||||
|
pos3=pos2+2
|
||||||
|
pos4=line.find("-max")
|
||||||
|
#print "seats:",line[pos3:pos4]
|
||||||
|
return {'maxSeats':int(line[pos3:pos4]), 'tableName':line[pos1:pos2]}
|
||||||
|
#end def parseTableLine
|
||||||
|
|
||||||
#returns the hand no assigned by the poker site
|
#returns the hand no assigned by the poker site
|
||||||
def parseTourneyNo(topline):
|
def parseTourneyNo(topline):
|
||||||
|
@ -968,10 +981,8 @@ def recogniseGametypeID(cursor, topline, site_id, category, isTourney):#todo: th
|
||||||
len(result)
|
len(result)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
if category=="holdem" or category=="omahahi" or category=="omahahilo":
|
if category=="holdem" or category=="omahahi" or category=="omahahilo":
|
||||||
max_seats=10
|
|
||||||
base="hold"
|
base="hold"
|
||||||
else:
|
else:
|
||||||
max_seats=8
|
|
||||||
base="stud"
|
base="stud"
|
||||||
|
|
||||||
if category=="holdem" or category=="omahahi" or category=="studhi":
|
if category=="holdem" or category=="omahahi" or category=="studhi":
|
||||||
|
@ -1112,9 +1123,9 @@ def store_board_cards(cursor, hands_id, board_values, board_suits):
|
||||||
board_values[4], board_suits[4]))
|
board_values[4], board_suits[4]))
|
||||||
#end def store_board_cards
|
#end def store_board_cards
|
||||||
|
|
||||||
def storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names):
|
def storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names, tableName):
|
||||||
#stores into table hands
|
#stores into table hands
|
||||||
cursor.execute ("INSERT INTO Hands (siteHandNo, gametypeId, handStart, seats) VALUES (%s, %s, %s, %s)", (site_hand_no, gametype_id, hand_start_time, len(names)))
|
cursor.execute ("INSERT INTO Hands (siteHandNo, gametypeId, handStart, seats, tableName, importTime) VALUES (%s, %s, %s, %s, %s, %s)", (site_hand_no, gametype_id, hand_start_time, len(names), tableName, datetime.datetime.today()))
|
||||||
#todo: find a better way of doing this...
|
#todo: find a better way of doing this...
|
||||||
cursor.execute("SELECT id FROM Hands WHERE siteHandNo=%s AND gametypeId=%s", (site_hand_no, gametype_id))
|
cursor.execute("SELECT id FROM Hands WHERE siteHandNo=%s AND gametypeId=%s", (site_hand_no, gametype_id))
|
||||||
return cursor.fetchall()[0][0]
|
return cursor.fetchall()[0][0]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user