From b772ba49ce5cc918537a5fb30d94c6fd0fdc8fa9 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sun, 27 Dec 2009 03:04:23 +0000 Subject: [PATCH 01/65] raise fpdbparseerror on a bug --- pyfpdb/Hand.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 3467216a..1bdfe250 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -480,8 +480,6 @@ Card ranks will be uppercased self.totalcollected += Decimal(entry[1]) - - def getGameTypeAsString(self): """\ Map the tuple self.gametype onto the pokerstars string describing it @@ -1406,6 +1404,8 @@ class Pot(object): # Return any uncalled bet. committed = sorted([ (v,k) for (k,v) in self.committed.items()]) + if len(committed)<2: + raise FpdbParseError("length of committed array is too small") lastbet = committed[-1][0] - committed[-2][0] if lastbet > 0: # uncalled returnto = committed[-1][1] From 12e89306b5bccdef08aea2ea56101465ba4985fd Mon Sep 17 00:00:00 2001 From: steffen123 Date: Thu, 27 May 2010 22:01:17 +0200 Subject: [PATCH 02/65] dirty but working patch to make it load utf8 files (specifically, FTP) --- pyfpdb/HandHistoryConverter.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index 5b65b955..aedd2191 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -98,6 +98,13 @@ follow : whether to tail -f the input""" self.status = True self.parsedObjectType = "HH" #default behaviour : parsing HH files, can be "Summary" if the parsing encounters a Summary File + + found=False + for item in self.codepage: + if item=="utf-8": + found=True + if not found: + self.codepage.append("utf-8") if autostart: self.start() From 300e5fbbed4fcb195d3175c76b1d7e864db6a3bf Mon Sep 17 00:00:00 2001 From: steffen123 Date: Fri, 28 May 2010 02:31:04 +0200 Subject: [PATCH 03/65] it now records and displays fold stats (not too thoroughly tested) --- pyfpdb/DerivedStats.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index f5278b99..a951d0b7 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -146,6 +146,8 @@ class DerivedStats(): self.aggr(self.hand, i) self.calls(self.hand, i) self.bets(self.hand, i) + if i>0: + self.folds(self.hand, i) # Winnings is a non-negative value of money collected from the pot, which already includes the # rake taken out. hand.collectees is Decimal, database requires cents @@ -408,10 +410,16 @@ class DerivedStats(): def aggr(self, hand, i): aggrers = set() + others = set() # Growl - actionStreets contains 'BLINDSANTES', which isn't actually an action street + + firstAggrMade=False for act in hand.actions[hand.actionStreets[i+1]]: + if firstAggrMade: + others.add(act[0]) if act[1] in ('completes', 'bets', 'raises'): aggrers.add(act[0]) + firstAggrMade=True for player in hand.players: #print "DEBUG: actionStreet[%s]: %s" %(hand.actionStreets[i+1], i) @@ -419,6 +427,11 @@ class DerivedStats(): self.handsplayers[player[1]]['street%sAggr' % i] = True else: self.handsplayers[player[1]]['street%sAggr' % i] = False + + if len(aggrers)>0 and i>0: + for playername in others: + self.handsplayers[playername]['otherRaisedStreet%s' % i] = True + #print "otherRaised detected on handid "+str(hand.handid)+" for "+playername+" on street "+str(i) def calls(self, hand, i): callers = [] @@ -429,11 +442,18 @@ class DerivedStats(): # CG - I'm sure this stat is wrong # Best guess is that raise = 2 bets def bets(self, hand, i): - betters = [] for act in hand.actions[hand.actionStreets[i+1]]: if act[1] in ('bets'): self.handsplayers[act[0]]['street%sBets' % i] = 1 + self.handsplayers[act[0]]['street%sBets' % i] + + def folds(self, hand, i): + for act in hand.actions[hand.actionStreets[i+1]]: + if act[1] in ('folds'): + if self.handsplayers[act[0]]['otherRaisedStreet%s' % i] == True: + self.handsplayers[act[0]]['foldToOtherRaisedStreet%s' % i] = True + #print "fold detected on handid "+str(hand.handid)+" for "+act[0]+" on street "+str(i) + def countPlayers(self, hand): pass From 30d7f0dc2a95302145c8dc2db8ca9777d2587fea Mon Sep 17 00:00:00 2001 From: steffen123 Date: Fri, 28 May 2010 19:12:02 +0200 Subject: [PATCH 04/65] moved fold stats so that the file no longer indicates that they're not done --- pyfpdb/DerivedStats.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index a951d0b7..c33943de 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -67,12 +67,12 @@ class DerivedStats(): self.handsplayers[player[1]]['street%dCBDone' %i] = False self.handsplayers[player[1]]['street%dCheckCallRaiseChance' %i] = False self.handsplayers[player[1]]['street%dCheckCallRaiseDone' %i] = False + self.handsplayers[player[1]]['otherRaisedStreet%d' %i] = False + self.handsplayers[player[1]]['foldToOtherRaisedStreet%d' %i] = False #FIXME - Everything below this point is incomplete. self.handsplayers[player[1]]['tourneyTypeId'] = 1 for i in range(1,5): - self.handsplayers[player[1]]['otherRaisedStreet%d' %i] = False - self.handsplayers[player[1]]['foldToOtherRaisedStreet%d' %i] = False self.handsplayers[player[1]]['foldToStreet%dCBChance' %i] = False self.handsplayers[player[1]]['foldToStreet%dCBDone' %i] = False From e349dad1b2ccce797ebecdfb1407ffa4114a22e5 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Mon, 7 Jun 2010 03:03:52 +0200 Subject: [PATCH 05/65] Revert "dirty but working patch to make it load utf8 files (specifically, FTP)" This reverts commit 12e89306b5bccdef08aea2ea56101465ba4985fd. --- pyfpdb/HandHistoryConverter.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index aedd2191..5b65b955 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -98,13 +98,6 @@ follow : whether to tail -f the input""" self.status = True self.parsedObjectType = "HH" #default behaviour : parsing HH files, can be "Summary" if the parsing encounters a Summary File - - found=False - for item in self.codepage: - if item=="utf-8": - found=True - if not found: - self.codepage.append("utf-8") if autostart: self.start() From 5aadfde2df34b1bd379786c58e2854bf76dec348 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 8 Jun 2010 02:52:41 +0200 Subject: [PATCH 06/65] renamed test scripts to make their purpose clearer --- pyfpdb/{test1.py => test_Python.py} | 0 pyfpdb/{test2.py => test_Python_Libs.py} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename pyfpdb/{test1.py => test_Python.py} (100%) rename pyfpdb/{test2.py => test_Python_Libs.py} (100%) diff --git a/pyfpdb/test1.py b/pyfpdb/test_Python.py similarity index 100% rename from pyfpdb/test1.py rename to pyfpdb/test_Python.py diff --git a/pyfpdb/test2.py b/pyfpdb/test_Python_Libs.py similarity index 100% rename from pyfpdb/test2.py rename to pyfpdb/test_Python_Libs.py From 816be22833a79e12131297ff08990cafa315fcdd Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 8 Jun 2010 04:30:10 +0200 Subject: [PATCH 07/65] moved test_Python* to root folder so they don't collide with py.test and because it fits better there anyways --- pyfpdb/test_Python.py => test_Python.py | 0 pyfpdb/test_Python_Libs.py => test_Python_Libs.py | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename pyfpdb/test_Python.py => test_Python.py (100%) rename pyfpdb/test_Python_Libs.py => test_Python_Libs.py (100%) diff --git a/pyfpdb/test_Python.py b/test_Python.py similarity index 100% rename from pyfpdb/test_Python.py rename to test_Python.py diff --git a/pyfpdb/test_Python_Libs.py b/test_Python_Libs.py similarity index 100% rename from pyfpdb/test_Python_Libs.py rename to test_Python_Libs.py From 7a7ab098fac2efeb26fa12437540562ec7f1a08c Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 8 Jun 2010 04:32:10 +0200 Subject: [PATCH 08/65] changed run_fpdb.py permissions to executable --- run_fpdb.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 run_fpdb.py diff --git a/run_fpdb.py b/run_fpdb.py old mode 100644 new mode 100755 From aed767ef4b8bcd23226937abd4f4abf16f5b65ef Mon Sep 17 00:00:00 2001 From: steffen123 Date: Tue, 8 Jun 2010 04:33:27 +0200 Subject: [PATCH 09/65] add warning dialogue to restart after recreate as i encountered bugs under some circumstances if I didn't but it doesn't seem worth investigating --- pyfpdb/fpdb.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py index 3d9db3d7..29613d35 100755 --- a/pyfpdb/fpdb.py +++ b/pyfpdb/fpdb.py @@ -1,4 +1,5 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- #Copyright 2008 Steffen Jobbagy-Felso #This program is free software: you can redistribute it and/or modify @@ -412,6 +413,14 @@ class fpdb: #else: # for other dbs use same connection as holds global lock # self.fdb_lock.fdb.recreate_tables() + # TODO: figure out why this seems to be necessary + dia_restart = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_WARNING, + buttons=(gtk.BUTTONS_OK), message_format="Restart fpdb") + diastring = "You should now restart fpdb." + dia_restart.format_secondary_text(diastring) + + dia_restart.run() + dia_restart.destroy() elif response == gtk.RESPONSE_NO: print 'User cancelled recreating tables' #if not lock_released: From 7896ae7380ef9589f5c50568ff89efdcaa76f21e Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sun, 13 Jun 2010 07:40:59 +0200 Subject: [PATCH 10/65] expanded explanation of vpip --- pyfpdb/Stats.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pyfpdb/Stats.py b/pyfpdb/Stats.py index 74d51675..564437b8 100755 --- a/pyfpdb/Stats.py +++ b/pyfpdb/Stats.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- """Manage collecting and formatting of stats and tooltips. """ @@ -114,7 +115,7 @@ def playername(stat_dict, player): stat_dict[player]['screen_name']) def vpip(stat_dict, player): - """ Voluntarily put $ in the pot.""" + """ Voluntarily put $ in the pot pre-flop.""" stat = 0.0 try: stat = float(stat_dict[player]['vpip'])/float(stat_dict[player]['n']) @@ -123,14 +124,14 @@ def vpip(stat_dict, player): 'v=%3.1f' % (100*stat) + '%', 'vpip=%3.1f' % (100*stat) + '%', '(%d/%d)' % (stat_dict[player]['vpip'], stat_dict[player]['n']), - 'Voluntarily Put In Pot %' + 'Voluntarily Put In Pot Pre-Flop%' ) except: return (stat, '%3.1f' % (0) + '%', 'v=%3.1f' % (0) + '%', 'vpip=%3.1f' % (0) + '%', '(%d/%d)' % (0, 0), - 'Voluntarily Put In Pot %' + 'Voluntarily Put In Pot Pre-Flop%' ) def pfr(stat_dict, player): From 4d429531356fc810e307df6a2bfbdb5172908f53 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sun, 20 Jun 2010 13:52:44 +0200 Subject: [PATCH 11/65] make rename and executes work in linux --- pyfpdb/fpdb.py | 5 ++++- pyfpdb/fpdb.pyw | 6 +++++- run_fpdb.py | 5 ++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py index 191f1d15..7ac8dfec 100755 --- a/pyfpdb/fpdb.py +++ b/pyfpdb/fpdb.py @@ -25,5 +25,8 @@ import sys sys.stdout.write('fpdb.py has been renamed to fpdb.pyw - now calling fpdb.pyw ...\n\n') sys.stdout.flush() -os.execvpe('pythonw.exe', ('pythonw.exe', 'fpdb.pyw', '-r'), os.environ) +if os.name=='nt': + os.execvpe('pythonw.exe', ('pythonw.exe', 'fpdb.pyw', '-r'), os.environ) +else: + os.execvpe('python', ('python', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run) diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index 58a1b230..7b1d6cd0 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -1,4 +1,5 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- #Copyright 2008 Steffen Jobbagy-Felso #This program is free software: you can redistribute it and/or modify @@ -35,7 +36,10 @@ if os.name == 'nt' and sys.version[0:3] not in ('2.5', '2.6') and '-r' not in sy os.environ['PATH'] = tmppath print "Python " + sys.version[0:3] + ' - press return to continue\n' sys.stdin.readline() - os.execvpe('pythonw.exe', ('pythonw.exe', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run) + if os.name=='nt': + os.execvpe('pythonw.exe', ('pythonw.exe', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run) + else: + os.execvpe('python', ('python', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run) else: print "\npython 2.5 not found, please install python 2.5 or 2.6 for fpdb\n" raw_input("Press ENTER to continue.") diff --git a/run_fpdb.py b/run_fpdb.py index 82cbb9b5..dd031403 100755 --- a/run_fpdb.py +++ b/run_fpdb.py @@ -27,5 +27,8 @@ os.chdir(sys.path[0]) #print "sys.path[0] =", sys.path[0], "cwd =", os.getcwd() -os.execvpe('python', ('python', 'fpdb.pyw', '-r'), os.environ) +if os.name=='nt': + os.execvpe('pythonw.exe', ('pythonw.exe', 'fpdb.pyw', '-r'), os.environ) +else: + os.execvpe('python', ('python', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run) From de2d810ac5778a795dfa9e5ce675f00ca47f9307 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sun, 20 Jun 2010 17:34:58 +0200 Subject: [PATCH 12/65] moved currency field from Sites to Gametypes&TourneyTypes, addded Sites.code --- pyfpdb/AlchemyMappings.py | 30 ++++++++++++++++-------------- pyfpdb/AlchemyTables.py | 4 +++- pyfpdb/Database.py | 25 +++++++++++++------------ pyfpdb/SQL.py | 13 ++++++++++--- 4 files changed, 42 insertions(+), 30 deletions(-) diff --git a/pyfpdb/AlchemyMappings.py b/pyfpdb/AlchemyMappings.py index c2e088a9..7b9c20a3 100644 --- a/pyfpdb/AlchemyMappings.py +++ b/pyfpdb/AlchemyMappings.py @@ -34,8 +34,8 @@ class Gametype(MappedBase): @staticmethod def get_or_create(session, siteId, gametype): map = zip( - ['type', 'base', 'category', 'limitType', 'smallBlind', 'bigBlind', 'smallBet', 'bigBet'], - ['type', 'base', 'category', 'limitType', 'sb', 'bb', 'dummy', 'dummy', ]) + ['type', 'base', 'category', 'limitType', 'smallBlind', 'bigBlind', 'smallBet', 'bigBet', 'currency'], + ['type', 'base', 'category', 'limitType', 'sb', 'bb', 'dummy', 'dummy', 'currency']) gametype = dict([(new, gametype.get(old)) for new, old in map ]) hilo = "h" @@ -340,18 +340,20 @@ class HandPlayer(MappedBase): class Site(object): """Class reflecting Players db table""" INITIAL_DATA = [ - (1 , 'Full Tilt Poker','USD'), - (2 , 'PokerStars', 'USD'), - (3 , 'Everleaf', 'USD'), - (4 , 'Win2day', 'USD'), - (5 , 'OnGame', 'USD'), - (6 , 'UltimateBet', 'USD'), - (7 , 'Betfair', 'USD'), - (8 , 'Absolute', 'USD'), - (9 , 'PartyPoker', 'USD'), - (10, 'Partouche', 'EUR'), + (1 , 'Full Tilt Poker','FT'), + (2 , 'PokerStars', 'PS'), + (3 , 'Everleaf', 'EV'), + (4 , 'Win2day', 'W2'), + (5 , 'OnGame', 'OG'), + (6 , 'UltimateBet', 'UB'), + (7 , 'Betfair', 'BF'), + (8 , 'Absolute', 'AB'), + (9 , 'PartyPoker', 'PP'), + (10, 'Partouche', 'PA'), + (11, 'Carbon', 'CA'), + (12, 'PKR', 'PK'), ] - INITIAL_DATA_KEYS = ('id', 'name', 'currency') + INITIAL_DATA_KEYS = ('id', 'name', 'code') INITIAL_DATA_DICTS = [ dict(zip(INITIAL_DATA_KEYS, datum)) for datum in INITIAL_DATA ] @@ -380,7 +382,7 @@ class TourneyType(MappedBase): Required kwargs: buyin fee speed maxSeats knockout - rebuyOrAddon headsUp shootout matrix sng + rebuyOrAddon headsUp shootout matrix sng currency """ return get_or_create(cls, session, **kwargs)[0] diff --git a/pyfpdb/AlchemyTables.py b/pyfpdb/AlchemyTables.py index 3165a480..2b0faa86 100644 --- a/pyfpdb/AlchemyTables.py +++ b/pyfpdb/AlchemyTables.py @@ -29,6 +29,7 @@ autorates_table = Table('Autorates', metadata, gametypes_table = Table('Gametypes', metadata, Column('id', SmallInteger, primary_key=True), Column('siteId', SmallInteger, ForeignKey("Sites.id"), nullable=False), # SMALLINT + Column('currency', String(4), nullable=False), # varchar(4) NOT NULL Column('type', String(4), nullable=False), # char(4) NOT NULL Column('base', String(4), nullable=False), # char(4) NOT NULL Column('category', String(9), nullable=False), # varchar(9) NOT NULL @@ -338,7 +339,7 @@ settings_table = Table('Settings', metadata, sites_table = Table('Sites', metadata, Column('id', SmallInteger, primary_key=True), Column('name', String(32), nullable=False), # varchar(32) NOT NULL - Column('currency', String(3), nullable=False), # char(3) NOT NULL + Column('code', String(2), nullable=False), # char(2) NOT NULL mysql_charset='utf8', mysql_engine='InnoDB', ) @@ -374,6 +375,7 @@ Index('siteTourneyNo', tourneys_table.c.siteTourneyNo, tourneys_table.c.tourneyT tourney_types_table = Table('TourneyTypes', metadata, Column('id', Integer, primary_key=True), Column('siteId', SmallInteger, ForeignKey("Sites.id"), nullable=False), + Column('currency', String(4), nullable=False), # varchar(4) NOT NULL Column('buyin', Integer, nullable=False), # INT NOT NULL Column('fee', Integer, nullable=False, default=0), # INT NOT NULL Column('maxSeats', Boolean, nullable=False, default=-1), # INT NOT NULL DEFAULT -1 diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 01b78fe5..ff3dc4e3 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- """Database.py Create and manage the database objects. @@ -1343,18 +1344,18 @@ class Database: def fillDefaultData(self): c = self.get_cursor() c.execute("INSERT INTO Settings (version) VALUES (%s);" % (DB_VERSION)) - c.execute("INSERT INTO Sites (name,currency) VALUES ('Full Tilt Poker', 'USD')") - c.execute("INSERT INTO Sites (name,currency) VALUES ('PokerStars', 'USD')") - c.execute("INSERT INTO Sites (name,currency) VALUES ('Everleaf', 'USD')") - c.execute("INSERT INTO Sites (name,currency) VALUES ('Win2day', 'USD')") - c.execute("INSERT INTO Sites (name,currency) VALUES ('OnGame', 'USD')") - c.execute("INSERT INTO Sites (name,currency) VALUES ('UltimateBet', 'USD')") - c.execute("INSERT INTO Sites (name,currency) VALUES ('Betfair', 'USD')") - c.execute("INSERT INTO Sites (name,currency) VALUES ('Absolute', 'USD')") - c.execute("INSERT INTO Sites (name,currency) VALUES ('PartyPoker', 'USD')") - c.execute("INSERT INTO Sites (name,currency) VALUES ('Partouche', 'EUR')") - c.execute("INSERT INTO Sites (name,currency) VALUES ('Carbon', 'USD')") - c.execute("INSERT INTO Sites (name,currency) VALUES ('PKR', 'USD')") + c.execute("INSERT INTO Sites (name,code) VALUES ('Full Tilt Poker', 'FT')") + c.execute("INSERT INTO Sites (name,code) VALUES ('PokerStars', 'PS')") + c.execute("INSERT INTO Sites (name,code) VALUES ('Everleaf', 'EV')") + c.execute("INSERT INTO Sites (name,code) VALUES ('Win2day', 'W2')") + c.execute("INSERT INTO Sites (name,code) VALUES ('OnGame', 'OG')") + c.execute("INSERT INTO Sites (name,code) VALUES ('UltimateBet', 'UB')") + c.execute("INSERT INTO Sites (name,code) VALUES ('Betfair', 'BF')") + c.execute("INSERT INTO Sites (name,code) VALUES ('Absolute', 'AB')") + c.execute("INSERT INTO Sites (name,code) VALUES ('PartyPoker', 'PP')") + c.execute("INSERT INTO Sites (name,code) VALUES ('Partouche', 'PA')") + c.execute("INSERT INTO Sites (name,code) VALUES ('Carbon', 'CA')") + c.execute("INSERT INTO Sites (name,code) VALUES ('PKR', 'PK')") if self.backend == self.SQLITE: c.execute("INSERT INTO TourneyTypes (id, siteId, buyin, fee) VALUES (NULL, 1, 0, 0);") elif self.backend == self.PGSQL: diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 24dee18e..2e24b74e 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- """Returns a dict of SQL statements used in fpdb. """ # Copyright 2008-2009, Ray E. Barker @@ -114,18 +115,18 @@ class Sql: self.query['createSitesTable'] = """CREATE TABLE Sites ( id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id), name varchar(32) NOT NULL, - currency char(3) NOT NULL) + code char(2) NOT NULL) ENGINE=INNODB""" elif db_server == 'postgresql': self.query['createSitesTable'] = """CREATE TABLE Sites ( id SERIAL, PRIMARY KEY (id), name varchar(32), - currency char(3))""" + code char(2))""" elif db_server == 'sqlite': self.query['createSitesTable'] = """CREATE TABLE Sites ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, - currency TEXT NOT NULL)""" + code TEXT NOT NULL)""" ################################ @@ -136,6 +137,7 @@ class Sql: self.query['createGametypesTable'] = """CREATE TABLE Gametypes ( id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id), siteId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (siteId) REFERENCES Sites(id), + currency varchar(4) NOT NULL, type char(4) NOT NULL, base char(4) NOT NULL, category varchar(9) NOT NULL, @@ -150,6 +152,7 @@ class Sql: self.query['createGametypesTable'] = """CREATE TABLE Gametypes ( id SERIAL, PRIMARY KEY (id), siteId INTEGER, FOREIGN KEY (siteId) REFERENCES Sites(id), + currency varchar(4), type char(4), base char(4), category varchar(9), @@ -163,6 +166,7 @@ class Sql: self.query['createGametypesTable'] = """CREATE TABLE GameTypes ( id INTEGER PRIMARY KEY, siteId INTEGER, + currency TEXT, type TEXT, base TEXT, category TEXT, @@ -358,6 +362,7 @@ class Sql: self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes ( id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id), siteId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (siteId) REFERENCES Sites(id), + currency varchar(4) NOT NULL, buyin INT NOT NULL, fee INT NOT NULL, maxSeats INT NOT NULL DEFAULT -1, @@ -374,6 +379,7 @@ class Sql: self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes ( id SERIAL, PRIMARY KEY (id), siteId INT NOT NULL, FOREIGN KEY (siteId) REFERENCES Sites(id), + currency varchar(4) NOT NULL, buyin INT NOT NULL, fee INT NOT NULL, maxSeats INT NOT NULL DEFAULT -1, @@ -389,6 +395,7 @@ class Sql: self.query['createTourneyTypesTable'] = """CREATE TABLE TourneyTypes ( id INTEGER PRIMARY KEY, siteId INT NOT NULL, + currency TEXT NOT NULL, buyin INT NOT NULL, fee INT NOT NULL, maxSeats INT NOT NULL DEFAULT -1, From 5f240aabb7129398c42a211a3dd70e47bcb156b8 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sun, 20 Jun 2010 18:07:44 +0200 Subject: [PATCH 13/65] readd warning dialogue to restart after recreate after loosing it in merge --- pyfpdb/fpdb.pyw | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index 7b1d6cd0..878f2059 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -416,6 +416,14 @@ class fpdb: #else: # for other dbs use same connection as holds global lock # self.fdb_lock.fdb.recreate_tables() + # TODO: figure out why this seems to be necessary + dia_restart = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_WARNING, + buttons=(gtk.BUTTONS_OK), message_format="Restart fpdb") + diastring = "You should now restart fpdb." + dia_restart.format_secondary_text(diastring) + + dia_restart.run() + dia_restart.destroy() elif response == gtk.RESPONSE_NO: print 'User cancelled recreating tables' #if not lock_released: From 8e65370027fb7d87039a332ee3d28250178f2786 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sun, 20 Jun 2010 18:09:17 +0200 Subject: [PATCH 14/65] make CLI parameters to run_fpdb.py and fpdb.py work again --- pyfpdb/fpdb.py | 4 ++-- run_fpdb.py | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py index 7ac8dfec..b518994c 100755 --- a/pyfpdb/fpdb.py +++ b/pyfpdb/fpdb.py @@ -26,7 +26,7 @@ sys.stdout.write('fpdb.py has been renamed to fpdb.pyw - now calling fpdb.pyw .. sys.stdout.flush() if os.name=='nt': - os.execvpe('pythonw.exe', ('pythonw.exe', 'fpdb.pyw', '-r'), os.environ) + os.execvpe('pythonw.exe', list(('pythonw.exe', 'fpdb.pyw', '-r'))+sys.argv[1:], os.environ) else: - os.execvpe('python', ('python', 'fpdb.pyw', '-r'), os.environ) + os.execvpe('python', list(('python', 'fpdb.pyw', '-r'))+sys.argv[1:], os.environ) # first arg is ignored (name of program being run) diff --git a/run_fpdb.py b/run_fpdb.py index dd031403..faafad89 100755 --- a/run_fpdb.py +++ b/run_fpdb.py @@ -16,7 +16,6 @@ #In the "official" distribution you can find the license in #agpl-3.0.txt in the docs folder of the package. - import os import sys @@ -26,9 +25,8 @@ sys.path[0] = sys.path[0]+os.sep+"pyfpdb" os.chdir(sys.path[0]) #print "sys.path[0] =", sys.path[0], "cwd =", os.getcwd() - if os.name=='nt': - os.execvpe('pythonw.exe', ('pythonw.exe', 'fpdb.pyw', '-r'), os.environ) + os.execvpe('pythonw.exe', list(('pythonw.exe', 'fpdb.pyw', '-r'))+sys.argv[1:], os.environ) else: - os.execvpe('python', ('python', 'fpdb.pyw', '-r'), os.environ) + os.execvpe('python', list(('python', 'fpdb.pyw', '-r'))+sys.argv[1:], os.environ) # first arg is ignored (name of program being run) From ad95038edb953ff9d957764f9ccad5ed57061d3b Mon Sep 17 00:00:00 2001 From: steffen123 Date: Mon, 21 Jun 2010 13:00:09 +0200 Subject: [PATCH 15/65] changed start page text --- pyfpdb/fpdb.pyw | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index 878f2059..a3d32efe 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -887,8 +887,9 @@ class fpdb: def tab_main_help(self, widget, data=None): """Displays a tab with the main fpdb help screen""" mh_tab=gtk.Label("""Welcome to Fpdb! -For documentation please visit our website at http://fpdb.sourceforge.net/ or check the docs directory in the fpdb folder. -Please note that default.conf is no longer needed nor used, all configuration now happens in HUD_config.xml +For documentation please visit our website at http://fpdb.sourceforge.net/. +If you need help click on Contact - Get Help on our website. +Please note that default.conf is no longer needed nor used, all configuration now happens in HUD_config.xml. This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt") self.add_and_display_tab(mh_tab, "Help") From 9f9fdb7abf20a414ac4e4e33a2f8cf8404d54473 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Mon, 21 Jun 2010 13:13:19 +0200 Subject: [PATCH 16/65] removed outdated documentation and moved license files --- docs/agpl-3.0.txt => agpl-3.0.txt | 0 docs/filelist.txt | 75 -- docs/readme.txt | 79 -- docs/release-notes.txt | 93 -- docs/tabledesign.html | 1430 ----------------------------- docs/fdl-1.2.txt => fdl-1.2.txt | 0 pyfpdb/fpdb.pyw | 2 +- 7 files changed, 1 insertion(+), 1678 deletions(-) rename docs/agpl-3.0.txt => agpl-3.0.txt (100%) delete mode 100644 docs/filelist.txt delete mode 100644 docs/readme.txt delete mode 100644 docs/release-notes.txt delete mode 100644 docs/tabledesign.html rename docs/fdl-1.2.txt => fdl-1.2.txt (100%) diff --git a/docs/agpl-3.0.txt b/agpl-3.0.txt similarity index 100% rename from docs/agpl-3.0.txt rename to agpl-3.0.txt diff --git a/docs/filelist.txt b/docs/filelist.txt deleted file mode 100644 index 15e9361a..00000000 --- a/docs/filelist.txt +++ /dev/null @@ -1,75 +0,0 @@ -This is partially outdated - -File list -========= -.: -docs/ Documentation files -pyfpdb/ The main program (in python) -setup/ Directory with files for setting up this program -regression-test/ Directory with test data, query scripts (in python) and the regression test script (in bash) -utils/ A couple of things that will migrate to the main prog soon -viewer/ Directory with the GUI (in Java) - -./docs: -abbreviations.txt A list of abbreviations used and their meaning -agpl-3.0.txt License of the program (everything under /code) -benchmarks.txt Some benchmark results -codingstyle.txt Some notes on formatting. Feel free to ignore. -fdl-1.2.txt License of the documentation (the files in /) -filelist.txt This file -howto-import.txt Instructions on how to run the importer -install-in-gentoo.txt Installation instructions for Gentoo GNU/Linux -install-in-windows.txt Installation instructions for Windows -readme-dev.txt Some notes, pointers and such for developers or anyone else interested in changing fpdb -readme-overview.txt Some general info about this program - read that first -readme-user.txt Instructions on how to use fpdb -status.txt Details of support for poker types and sites -tabledesign.html Table design with comments - -./pyfpdb: -fpdb.py The main GUI. This is what the user will start and use to access the other things. -fpdb_import.py Main import program. Calls methods in the other files. - Takes one hand history file as input. This is the file - you execute, do not run the other ones individually. - Except import_gui.py of course. -fpdb_parse_logic.py Parses a holdem/omaha/razz/stud hand. -fpdb_save_to_db.py Just methods to store the parsed data into SQL. - Seperate file because these calls are very unwieldy. -fpdb_simple.py Simple methods called by the other files. Most work is - actually done in this file to make the other ones look - much easier than they are. -import_gui.py GUI interface to the importer (obselete) - -./setup: -insert-basedata.sql Fills sites and gametypes tables. Run this once after running the above. -recreate-tables.sql File for mysql to recreate the tables. THIS WILL DELETE EXISTING TABLES!!! - -./testdata: -should be self explanatory - -./utils: -dump_db_basedata.py Prints the contents of the tables sites and gametypes -fpdb_util_lib.py Helper methods for the utilities. -get_DB_stats.py Prints some counts (like no. of players in the DB) -get_player_stats.py Prints certain stats about players with CLI-passed constraints -mysql-reset-tables.sh Reset tables for MySQL. THIS WILL DELETE EXISTING TABLES!!! -print_hand.py Prints a hand in legible format. -psql-interactive.sh *nix script to connect to a PostgreSQL database in - interactive mode (note that we're currently only supporting MySQL) -regression-test.sh Resets tables and checks manually verified hands for errors - -./viewer: -todo - -License -======= -Trademarks of third parties have been used under Fair Use or similar laws. - -Copyright 2008 Steffen Jobbagy-Felso -Permission is granted to copy, distribute and/or modify this -document under the terms of the GNU Free Documentation License, -Version 1.2 as published by the Free Software Foundation; with -no Invariant Sections, no Front-Cover Texts, and with no Back-Cover -Texts. A copy of the license can be found in fdl-1.2.txt - -The program itself is licensed under AGPLv3, see agpl-3.0.txt diff --git a/docs/readme.txt b/docs/readme.txt deleted file mode 100644 index e3dbac23..00000000 --- a/docs/readme.txt +++ /dev/null @@ -1,79 +0,0 @@ -README.txt -updated 22 February 2010, REB - -fpdb - Free Poker Database - -The most accurate and up-to-date information on fpdb will be found in the wiki: -http://fpdb.wiki.sourceforge.net/ - -Other resources are: - Mailing list: http://sourceforge.net/mailarchive/forum.php?forum_name=fpdb-main - Chat room(irc): #fpdb on freenode.net - -fpdb is a free program for use with on line poker. It provides: - Tracking of your results and statistics. - Tracking of opponents' results statistics. - Win/loss graphing - Heads Up Display (HUD) with a variety of statistics - Display of mucked cards in the HUD - -fpdb supports: - Sites: - PokerStars - Full Tilt Poker - Everleaf Network - Other sites are under development and are easily added - - Games: - Holdem - Omaha (incl Hi/low) - 7 Card Stud (incl Hi/low) - Razz - Triple Draw and Badugi - Mixed Games -- HUD under development - - Operating Systems: - Linux and other Unix-like, using X - Windows - Mac OS/X -- no support for HUD - - Databases: - SQLite configured by default - MySQL - PostgreSQL - -Downloads: - Releases: http://sourceforge.net/project/showfiles.php?group_id=226872 - Development code via git: http://www.assembla.com/spaces/free_poker_tools/trac_git_tool - -Developers: - At least 10 people have contributed code or patches. Others are welcome. - -Source Code: - If you received fpdb as the Windows compressed exe, then you did not -receive souce code for fpdb or the included libraries. If you wish, you can -obtain the source code here: - - fpdb: see Downloads, above. - python: http://python.org/ - gtk: http://www.gtk.org/download.html - pygtk: http://www.pygtk.org/downloads.html - psycopg2: http://initd.org/pub/software/psycopg/ - mysqldb: http://sourceforge.net/projects/mysql-python/files/ - sqlalchemy: http://www.sqlalchemy.org/download.html - numpy: http://www.scipy.org/Download - matplotlib: http://sourceforge.net/projects/matplotlib/files/ - -License -======= -Trademarks of third parties have been used under Fair Use or similar laws. - -Copyright 2008 Steffen Jobbagy-Felso -Copyright 2009,2010 Ray E. Barker -Permission is granted to copy, distribute and/or modify this -document under the terms of the GNU Free Documentation License, -Version 1.2 as published by the Free Software Foundation; with -no Invariant Sections, no Front-Cover Texts, and with no Back-Cover -Texts. A copy of the license can be found in fdl-1.2.txt - -fpdb itself is licensed under AGPLv3, see agpl-3.0.txt. diff --git a/docs/release-notes.txt b/docs/release-notes.txt deleted file mode 100644 index c8ff9444..00000000 --- a/docs/release-notes.txt +++ /dev/null @@ -1,93 +0,0 @@ -alpha2 -====== -Hi everyone, -we are proud to announce the second alpha release of fpdb, the free/libre open source poker tracker. The biggest highlight is the HUD for Linux made by Ray (and perhaps Mac, not sure). But for everyone fpdb now also supports PS tournaments (SnG and MTT) and FTP ring games. There is also a new auto-importer though it currently only runs on one file per instance (but you can open multiple instances of fpdb). -Fpdb also parses alot of new situations into the cache table for the HUD, most of which are already available through the Linux HUD. There have also been a large number of bugfixes for all kinds of things. For full details of the changes see the git commit comments. - -You can download fpdb at https://sourceforge.net/project/showfiles.php?group_id=226872 - -Our website at http://fpdb.sourceforge.net/ will be updated shortly but in the meantime please note that the configuration file now resides in ~/.fpdb/default.conf on Linux/Mac and in C:\Documents and Settings\Application Data\fpdb\default.conf on Windows (on non-English Windows you have to translate the Documents and Settings, but not the Application data bit). Apart from that just follow the instructions on the site. I will be updating/improving the fpdb ebuild for Gentoo next week, please send me a PM or email if you would like a package for another Linux/BSD. - -To use the HUD in Linux simply run the auto importer whilst having the table open. You will also have to rename HUD_config.xml.example to HUD_config.xml and edit the database parameters in there in addition to what is written in the install guide. - -If you've been using fpdb alpha1 just delete the fpdb folder, follow the installation guide except for installing the dependencies, then run fpdb and run recreate tables. Note that you will have to reimport ALL your history files. - -For external devs (in particular Youre Toast): The table design has gone through some changes, though most of it was just renaming to make a consistent naming scheme and to make it more flexible towards stud/razz type games. I do not expect to having to make any future changes to the existing fields but I cannot yet guarantee that. There will be some additional fields in particular in the HudCache table. Please let me know if you need any further fields. I realise my naming breaks the "database designer's convention" but for this project I feel ignoring this convention for the benefit of consistent naming between Python and SQL is ok. - - -Any questions and comments please post here, send me a PM or email, post a feature request or bug report on sourceforge or use any of the other means of contact listed on our webpage. - -Enjoy, -The fpdb team - -PS: I personally will be away Sun-Tue so I probably won't be responding to anything but feel free to message me anyways, but if you post here or at SF someone else might be able to help. - -PPS: If you wanna know EXACTLY how this project is moving along follow the git tree over at [url]http://www.assembla.com/spaces/fpdb/trac_git_tool[/url] - - -alpha1 -====== -Hi everyone, -I am proud to announce the first release of my new poker tracking software fpdb (freepokerdb, very imaginative I know ;) ). You may wonder why I bothered when now with HM and PT3 there are at least two excellent packages to choose from. - -Four main reasons: -1. Fpdb is free/libre open source software. In short, this means you don't depend on me if sth. is wrong or you want something more in this program as you can freely change it yourself. You also don't have to pay anything for it. If you like it and think I deserve to be paid just drop me a mail ;) -2. HM and PT3 only support holdem. Fpdb initially supports Holdem and Omaha, with Stud and Razz mostly implemented and coming soon. -3. HM and PT3 run on Windows only, and for me at least did not work in wine even after installing Mono. Fpdb runs on any plattform that has the required software, which will cover roundabout 99.9% of PCs. Currently tested plattforms are Windows XP-x86 and Gentoo GNU/Linux-amd64 as well as -x86. - You still need to run Windows or wine to run the actual poker client though. -4. Fpdb won't irritate you with copy prevention measures. - -To install it go to https://sourceforge.net/project/showfiles.php?group_id=226872 and download the zip or tar.bz2, unpack it, and follow the instructions in docs/install-in-* for your operating system (e.g. docs\install-in-windows.txt). Sourceforge lists the release files as source files, not as binary executables - this is correct, python will automagically compile as and when required. - -This is alpha1, as the name indicates it is still at a very early stage. The importer and database are nearing completion but the GUI in particular is not very functional yet and the HUD is missing alltogether. - -If anyone wishes to help with development that would be very very welcome and I've put a few notes in docs/readme-dev.txt in the download for what you could do. Or just start coding and send me the patches :) -If you're not a programmer and you're not interested in learning it you can still help simply by trying it out and sending bug reports and feature requests. To avoid unrealistic expectations I'd like to state that it'll be a long time until fpdb reaches feature parity to established paid-for closed source software. - -Feature List (short now, growing fast ;) ): - -You can edit/add whatever you like, it's all python and SQL. The code should be fairly straightforward I think and I put some notes into readme-dev.txt but feel free to ask. - -Backend, Distribution -===================== -- Choice of MySQL/InnoDB or PostgreSQL. (not tested on PostgreSQL) -- It is possible to run the database on one PC, the importer on another, and then access the database with the table viewer or HUD from a third PC. (note: do NOT do this unencrypted over an untrusted network like your employer's LAN or the Internet!) - -Site/Game Support -================= -- Initially only full support for PS, FTP coming soon -- Supports Holdem, Omaha Hi and Omaha Hi/Lo. Stud and Razz coming soon. -- Supports No Limit, Pot Limit, Fixed Limit NL, Cap NL and Cap PL - Note that currently it does not display extra stats for NL/PL so usefulness is limited for these limit types. Suggestions welcome, I don't play these. -- Supports ring/cash games, SnG/MTT coming soon - -Tableviewer (tv) -=========== -Tv takes a history filename and loads the appropriate players' stats and displays them in a tabular format. These stats currently are: - - VPIP, PFR and Preflop 3B/4B (3B/4B is not quite correct I think) - - Raise and Fold % on flop, turn and river. Fold only counts hands when someone raised. This can be displayed per street or as one combined value each for aggression and folding. - - Number of hands this is based on. - - SD/F (aka WtSD, proportion of hands where player went to showdown after seeing flop) - - W$wSF (Won $ when seen Flop) - - W$@SD (Won $ at showdown) - For all stats it also displays how many hands this particular is based on - - -IMPORTANT: The database format WILL undergo more changes and at this point I am not planning to write a converter so please keep your history files so you can re-import when necessary. Independent of this you should always keep the original raw files in a safe place with any tracking software. Should you however end up loosing your files somehow let me know and I'll try to help. - -Please send any feedback, feature requests/suggestions, bug reports and animal names to steffen@sycamoretest.info, pick one of the contact methods listed in readme-overview.txt, send me a PM here or reply to this post. - - - -License -======= -Trademarks of third parties have been used under Fair Use or similar laws. - -Copyright 2008 Steffen Jobbagy-Felso -Permission is granted to copy, distribute and/or modify this -document under the terms of the GNU Free Documentation License, -Version 1.2 as published by the Free Software Foundation; with -no Invariant Sections, no Front-Cover Texts, and with no Back-Cover -Texts. A copy of the license can be found in fdl-1.2.txt - -The program itself is licensed under AGPLv3, see agpl-3.0.txt diff --git a/docs/tabledesign.html b/docs/tabledesign.html deleted file mode 100644 index 86898528..00000000 --- a/docs/tabledesign.html +++ /dev/null @@ -1,1430 +0,0 @@ - - - - - Free Poker DB Tabledesign - - -

See commit comments for version info, see status.txt for status.

-

Direct suggestions, praise and animal names to steffen@sycamoretest.info or check readme-overview.txt for more contacts

-

I decided to be generous on the sizes of the types - if computing experience shows one thing then its that it will come back to bite you in the ass if you save 2 bits in the wrong place. If performance and/or db size are too bad we can still shrink some fields.

-

Relationships are noted in the comment (need to double check that all are listed)

-

If you want more comments or if anything is confusing or bad let me know.

-

All money/cash amounts are stored in cents/pennies/whatever (e.g. $4.27 would be stored a 427). Chips are stored as-is (e.g. 3675 chips would be stored as 3675).

-

Notes on use/editing:

-

Any change to this must be carried to to the table creation code in fpdb_db.py or at least an entry to known bugs is to be made.

-

If the code (in particular the importer) and this document disagree then this document is to be considered authorative.

-

License
-Trademarks of third parties have been used under Fair Use or similar laws.
-Copyright 2008 Steffen Jobbagy-Felso
-Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 as published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license can be found in fdl-1.2.txt
-The program itself is licensed under AGPLv3, see agpl-3.0.txt

-

See readme.txt for copying

-

Table Settings

- - - - - - - - - - - -

Field name

Type

Comment

version

smallint

the git version of the database (ie. table design changes and major bugfixes require a bump)

-

Table Players

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Field name

Type

Comment

id

int


name

varchar(32)


siteId

smallint

references Sites.id

comment

text


commentTs

datetime (in UTC)


-


-

Table Autorates

-

An autorating is a computer-"recognised" label/category for a player. Examples could include "Calling Station" if a player has <20% each for aggression and folding postflop. Or "Tight-Aggressive/Aggressive" for players with <20% VPIP, >10% PFR and >40% postflop aggression.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Field name

Type

Comment

id

bigint


playerId

int

references Players.id

gametypeId

smallint

references Gametypes.id

description

varchar(50)

autorating description

shortDesc

char(8)

short description e.g. for display in HUD

ratingTime

datetime (in UTC)

timestamp of rating

handCount

int

number of hands rating is based on

-


-

Table Gametypes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Field name

Type

Comment

id

smallint


siteId

smallint

references sites.id

type

char(4)

valid entries:
- ring - ringgames aka cash games
- tour - tournament incl SnG

base

char(4)

The underlying structure. valid entries:
- hold - Holdem and Omaha
- stud - Stud and Razz
- draw - (incl Badugi)

category

varchar(9)

valid entries:
- holdem=Texas Hold'em
- omahahi=Omaha High only
- omahahilo=Omaha 8 or better
- razz=Razz
- studhi=7 Card Stud High only
- studhilo=7 Card Stud 8 or better
- fivedraw=Five Card Draw
- 27_1draw=2-7 Single Draw
- 27_3draw=2-7 Tripple Draw
- badugi=Badugi

limitType

char(2)

nl=No Limit
- cn=Cap No Limit
- pl=Pot Limit
- cp=Cap Pot Limit
- fl=Fixed Limit

hiLo

char(1)

Whether the game is hi, lo or both. Valid Entries:
- h - High only
- l - Low only
- s - Hi/Lo Split

smallBlind

int


bigBlind

int


smallBet

int


bigBet

int


-


-

Table Sites

- - - - - - - - - - - - - - - - - - - - - -

Field name

Type

Comment

id

smallint


name

varchar(32)


currency

char(3)

currency code, e.g. USD, GBP, EUR

-


-

Table Hands

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Field Name

Type

Comment

id

bigint


tableName

varchar(20)

The site's name for the current table

siteHandNo

bigint

the site's hand number

gametypeId

smallint

references gametypes.id

handStart

datetime (in UTC)

start date&time of the hand

importTime

datetime (in UTC)

date&time of import of this hand

seats

smallint

number of used seats (ie. that got dealt cards)

maxSeats

smallint

number of available seats

comment

text


commentTs

datetime (in UTC)


-


-

Table BoardCards

-

cardX -> can be 1 through 5

- - - - - - - - - - - - - - - - - - - - - - - - - - -

Field Name

Type

Comment

id

bigint


handId

bigint

the site's hand number

cardXValue

smallint

2-10=2-10, J=11, Q=12, K=13, A=14 (even in razz), unknown/no card=x, kept=k (draw only)

cardXSuit

char(1)

h=hearts, s=spades, d=diamonds, c=clubs, unknown/no card=x

-


-

Table HandsPlayers

-

cardX: can be 1 through 20, one for each card. In holdem only 1-2 of these are used, in omaha 1-4, in stud/razz 1-7, in single draw games 1-10 is used and in badugi 1-16 (4*4) is used.

-

For the draw games: the first 5 (badugi: 4) cards are the initial cards, the next 5 (badugi: 4) are after the first draw. If a player keeps some cards then those cards' spaces are filled with "k", short for "kept".
-Example 1: If a player gets 2-6 spades for his first five cards and decides to throw away the 4 and then gets a 7 of spades then the first 10 fields of cardXValue would be as follows: 2, 3, 4, 5, 6, k, k, 7, k, k
-Example 2: If a player gets 2, 3, 5, 8, J of spades for his first five cards and decides to throw away the 2 and the 3 and then gets a Q and K of spades then the first 10 fields of cardXValue would be as follows: 2, 3, 5, 8, J, Q, K, k, k, k
-Note that it will k in the space of which card was there previously, so in example 2 where the player kept the last 3 cards, the last 3 fields of the first draw (ie. card8-10Value) are replaced with k.

-

I did not separate this into an extra table because I felt the lost space is not sufficiently large. Also the benefit for searching is far less relevant.

-

ToDo: Original plan was to implement the many flags from hudcache as booleans - need to try this out as it will save space and may therefore be quicker.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Field Name

Type

-

Comment

id

bigint


handId

bigint

references Hands.id

playerId

int

references Players.id

startCash

int


position

char(1)

BB=B, SB=S, Button=0, Cutoff=1, etc.
- This is used in holdem/omaha only.

seatNo

smallint

The seat in which the person was sitting - necessary for HUD

card1(..7)

smallint

0=none/unknown, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As

startCards

smallint

int representing Holdem starting cards.
Hand is stored as an int 13 * x + y where x and y -are in range 0..12, and (x+2) and (y+2) represents rank of each card (2=2 .. 14=Ace).
-If x > y then pair is suited, if x < y then unsuited.
-Omaha and other games may need to use this as a key into another table. (to be decided ...)

ante

int

note: for cash this could be boolean, but in tourneys you may enter a hand with less than the full ante

winnings

int

winnings in this hand (bets, antes, etc. are NOT deducted, but rake already is)

rake

int

rake for this player for this hand (i.e. final pot(s) size = winnings + rake)

totalProfit

int

profit for this player for this hand ( i.e. winnings - (ante + bets) )

comment

text


commentTs

datetime (in UTC)


tourneysPlayersId

bigint

references TourneysPlayers.id

tourneyTypeId

bigint

references TourneyTypes.id (maybe this should be on Hands?)

wonWhenSeenStreet1(..4)

float

How many hands the player won after seeing the flop/street4 - this can be a "partial win" if the pot is split.
- To be completely clear, this stores a hand count, NOT a money amount.
- (2/3/4: Same for turn/street5, river/street6, street7)

wonAtSD

float

As wonWhenSeenStreet1, but for showdown.

street0VPI

int

did player pay to see flop, 1 or 0

street0Aggr

int

did player raise before flop, 1 or 0

street0_3BChance

int

did player have chance to 3B, 1 or 0

street0_3BDone

int

did player 3bet before flop, 1 or 0

street0_4BChance

int

did player have chance to 4B, 1 or 0

street0_4BDone

int

did player 4bet before flop, 1 or 0

other_3BStreet0

int

did other player 3bet before flop, 1 or 0

other_4BStreet0

int

did other player 4bet before flop, 1 or 0

street1Seen(/2/3/4)

int

did player see flop/street4 (.. etc)

sawShowdown

int

did player see showdown

street1Aggr

int

number of hands where player raised flop/street4

street2Aggr

int

number of hands where player raised turn/street5

street3Aggr

int

number of hands where player raised river/street6

street4Aggr

int

number of hands where player raised street7

otherRaisedStreet0

int

number of hands where someone else raised pre-flop/street3

otherRaisedStreet1

int

number of hands where someone else raised flop/street4

otherRaisedStreet2

int

number of hands where someone else raised turn/street5

otherRaisedStreet3

int

number of hands where someone else raised river/street6

otherRaisedStreet4

int

number of hands where someone else raised street7

foldToOtherRaisedStreet0

int

number of hands where someone else raised flop/street4 and the player folded

foldToOtherRaisedStreet1

int

number of hands where someone else raised flop/street4 and the player folded

foldToOtherRaisedStreet2

int

number of hands where someone else raised Turn/street5 and the player folded

foldToOtherRaisedStreet3

int

number of hands where someone else raised River/street6 and the player folded

foldToOtherRaisedStreet4

int

number of hands where someone else raised street7 and the player folded

stealAttemptChance

int

Player was in CO, BTN or SB and nobody has called yet

stealAttempted

int

Player took a chance per the above condition

foldBbToStealChance

int

Somebody tried to steal BB from player

foldedBbToSteal

int

Player folded BB to steal attempt

foldSbToStealChance

int

Somebody tried to steal SB from player

foldedSbToSteal

int

Player folded SB to steal attempt

street1CBChance

int

Player had chance to make continuation bet on flop/street4

street1CBDone

int

Player used chance to make continuation bet on flop/street4

street2CBChance

int

Player had chance to make continuation bet on turn/street5

street2CBDone

int

Player used chance to make continuation bet on turn/street5

street3CBChance

int

Player had chance to make continuation bet on river/street6

street3CBDone

int

Player used chance to make continuation bet on river/street6

street4CBChance

int

Player had chance to make continuation bet on street7

street4CBDone

int

Player used chance to make continuation bet on street7

foldToStreet1CBChance

int

Player had chance to fold to continuation bet on this street

foldToStreet1CBDone

int

Player used chance to fold to continuation bet on this street

foldToStreet2CBChance

int

Player had chance to fold to continuation bet on this street

foldToStreet2CBDone

int

Player used chance to fold to continuation bet on this street

foldToStreet3CBChance

int

Player had chance to fold to continuation bet on this street

foldToStreet3CBDone

int

Player used chance to fold to continuation bet on this street

foldToStreet4CBChance

int

Player had chance to fold to continuation bet on this street

foldToStreet4CBDone

int

Player used chance to fold to continuation bet on this street

street1CheckCallRaiseChance

int

How often player had the chance to do a check-raise or a call-raise on this street

street1CheckCallRaiseDone

int

How often player used the chance to do a check-raise or a call-raise on this street

street2CheckCallRaiseChance

int

How often player had the chance to do a check-raise or a call-raise on this street

street2CheckCallRaiseDone

int

How often player used the chance to do a check-raise or a call-raise on this street

street3CheckCallRaiseChance

int

How often player had the chance to do a check-raise or a call-raise on this street

street3CheckCallRaiseDone

int

How often player used the chance to do a check-raise or a call-raise on this street

street4CheckCallRaiseChance

int

How often player had the chance to do a check-raise or a call-raise on this street

street4CheckCallRaiseDone

int

How often player used the chance to do a check-raise or a call-raise on this street

street0Calls

int

Number of times player called on this street

street1Calls

int

Number of times player called on this street

street2Calls

int

Number of times player called on this street

street3Calls

int

Number of times player called on this street

street4Calls

int

Number of times player called on this street

street0Bets

int

Number of times player bet on this street

street1Bets

int

Number of times player bet on this street

street2Bets

int

Number of times player bet on this street

street3Bets

int

Number of times player bet on this street

street4Bets

int

Number of times player bet on this street

street0Raises

int

Number of times player raised on this street

street1Raises

int

Number of times player raised on this street

street2Raises

int

Number of times player raised on this street

street3Raises

int

Number of times player raised on this street

street4Raises

int

Number of times player raised on this street

actionString

int

Experimental - idea is to store the action on this street as a string: e.g. kkBrcfC, with - player's own choices in upper case and other players in lower case. k=check, b=bet, c=call, - r=raise. (Perhaps NL would miss out bet sizes for this?) It would then be possible to do complex - ad-hoc queries using queries like: actionString like '%B%r%C% -

-


-

Table HudCache

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Field Name

Type

Comment

id

bigint


gametypeId

smallint

references gametypes.id

playerId

int

references players.id

activeSeats

smallint

range 2-10

position

char(1)

Position for which this row applies. In this table this can be B(BB), S(SB), D(Dealer/Button), C(Cutoff), M(Middle - the 3 before cutoff) or E (Early - the 3 before Middle)

tourneyTypeId

smallint

References TourneyTypes.id

HDs

int

number of hands this player played in this gametype with this number of seats

wonWhenSeenStreet1(/2/3/4)

float

How many hands the player won after seeing the flop/street4 - this can be a "partial win" if the pot is split.
- To be completely clear, this stores a hand count, NOT a money amount.
- (/2/3/4: Same for turn/street5, river/street6, street7)

wonAtSD

float

As wonWhenSeenStreet1, but for showdown.

street0VPI

int

number of hands where player paid to see flop
- Please note that this already includes street0Aggr!
- To calculate limp just deduct street0Aggr from this number

street0Aggr

int

number of hands where player raised before flop

street0_3BChance

int

number of hands where player had chance to 3B before flop

street0_3BDone

int

number of hands where player 3bet before flop

street0_4BChance

int

number of hands where player had chance to 4B before flop

street0_4BDone

int

number of hands where player 4bet before flop

street1Seen

int

number of hands where player saw flop/street4

street2Seen

int

number of hands where player saw turn/street5

street3Seen

int

number of hands where player saw river/street6

street4Seen

int

number of hands where player saw street7

sawShowdown

int

number of hands where player saw showdown

street1Aggr

int

number of hands where player raised flop/street4

street2Aggr

int

number of hands where player raised turn/street5

street3Aggr

int

number of hands where player raised river/street6

street4Aggr

int

number of hands where player raised street7

otherRaisedStreet0

int

number of hands where someone else raised pre-flop/street3

otherRaisedStreet1

int

number of hands where someone else raised flop/street4

otherRaisedStreet2

int

number of hands where someone else raised turn/street5

otherRaisedStreet3

int

number of hands where someone else raised river/street6

otherRaisedStreet4

int

number of hands where someone else raised street7

foldToOtherRaisedStreet0

int

number of hands where someone else raised pre-flop/street3 and the player folded

foldToOtherRaisedStreet1

int

number of hands where someone else raised flop/street4 and the player folded

foldToOtherRaisedStreet2

int

number of hands where someone else raised Turn/street5 and the player folded

foldToOtherRaisedStreet3

int

number of hands where someone else raised River/street6 and the player folded

foldToOtherRaisedStreet4

int

number of hands where someone else raised street7 and the player folded

stealAttemptChance

int

Player was in CO, BTN or SB and nobody has called yet

stealAttempted

int

Player took a chance per the above condition

foldBbToStealChance

int

Somebody tried to steal BB from player

foldedBbToSteal

int

Player folded BB to steal attempt

foldSbToStealChance

int

Somebody tried to steal SB from player

foldedSbToSteal

int

Player folded SB to steal attempt

street1CBChance

int

Player had chance to make continuation bet on flop/street4

street1CBDone

int

Player used chance to make continuation bet on flop/street4

street2CBChance

int

Player had chance to make continuation bet on turn/street5

street2CBDone

int

Player used chance to make continuation bet on turn/street5

street3CBChance

int

Player had chance to make continuation bet on river/street6

street3CBDone

int

Player used chance to make continuation bet on river/street6

street4CBChance

int

Player had chance to make continuation bet on street7

street4CBDone

int

Player used chance to make continuation bet on street7

foldToStreet1CBChance

int

Player had chance to fold to continuation bet on this street

foldToStreet1CBDone

int

Player used chance to fold to continuation bet on this street

foldToStreet2CBChance

int

Player had chance to fold to continuation bet on this street

foldToStreet2CBDone

int

Player used chance to fold to continuation bet on this street

foldToStreet3CBChance

int

Player had chance to fold to continuation bet on this street

foldToStreet3CBDone

int

Player used chance to fold to continuation bet on this street

foldToStreet4CBChance

int

Player had chance to fold to continuation bet on this street

foldToStreet4CBDone

int

Player used chance to fold to continuation bet on this street

totalProfit

int

how much money in cents the player made

street1CheckCallRaiseChance

int

How often player had the chance to do a check-raise or a call-raise on this street

street1CheckCallRaiseDone

int

How often player used the chance to do a check-raise or a call-raise on this street

street2CheckCallRaiseChance

int

How often player had the chance to do a check-raise or a call-raise on this street

street2CheckCallRaiseDone

int

How often player used the chance to do a check-raise or a call-raise on this street

street3CheckCallRaiseChance

int

How often player had the chance to do a check-raise or a call-raise on this street

street3CheckCallRaiseDone

int

How often player used the chance to do a check-raise or a call-raise on this street

street4CheckCallRaiseChance

int

How often player had the chance to do a check-raise or a call-raise on this street

street4CheckCallRaiseDone

int

How often player used the chance to do a check-raise or a call-raise on this street

street0Calls

int

Number of times player called on this street

street1Calls

int

Number of times player called on this street

street2Calls

int

Number of times player called on this street

street3Calls

int

Number of times player called on this street

street4Calls

int

Number of times player called on this street

street0Bets

int

Number of times player bet on this street

street1Bets

int

Number of times player bet on this street

street2Bets

int

Number of times player bet on this street

street3Bets

int

Number of times player bet on this street

street4Bets

int

Number of times player bet on this street

street0Raises

int

Number of times player raised on this street

street1Raises

int

Number of times player raised on this street

street2Raises

int

Number of times player raised on this street

street3Raises

int

Number of times player raised on this street

street4Raises

int

Number of times player raised on this street

-

-

Table HandsActions

-

Did separate this into an extra table because it makes SELECTing across different streets so much easier. Also the space saving will be very large.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Field Name

Type

Comment

id

bigint


handPlayerId

bigint

references HandsPlayers.id

street

smallint

street number, 0-3 (preflop, flop, turn, river) for holdem/omaha or 0-4 for razz/stud

-1 for seen showdown

actionNo

smallint

action number, this is counted from zero for each street but across all players (e.g. in a heads up where the SB calls and the BB raises and the SB calls again would have numbers 0 and 1 for blinds, 2 and 4 for call and 3 for bet)
- Note that the blinds are counted as an action, so if the SB stays in the hand it'll always be action #0

action

char(5)

Bet stands for bring in, complete, bet, double bet, raise and double raise, since they all - technically - do the same thing. Unbet is used for when an uncalled bet is returned, this will have a negative value for amount.

-

Other valid values: blind call check fold

allIn

boolean

Whether the player went all-in on this action

amount

int

amount put into the middle for this action

comment

text


commentTs

datetime (in UTC)


-


-

Tournament Tables

-


-

Table Tourneys

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Field name

Type

Comment

id

int


tourneyTypeId

smallint

References TourneyTypes.id

siteTourneyNo

bigint


entries

int

-1 if unknown

prizepool

int

Need this as separate field to support rebuy/addon

-1 if unknown

startTime

datetime (in UTC)

Empty if unknown

comment

text


commentTs

datetime (in UTC)


-


-

Table TourneyTypes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Field name

Type

Comment

id

int


siteId

smallint

References Sites.id

buyin

int

Buy-in in cents. Without rebuy/add-on

fee

int


knockout

int


rebuyOrAddon

boolean

Whether rebuys or add-ons are possible

-


-

Table TourneysPlayers

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Field Name

Type

Comment

id

bigint


tourneyId

int

References Tourneys.id

playerId

int

References Players.id

payinAmount

int

Buyin, fee, rebuys and add-ons

rank

int

Finishing rank

winnings

signed int

Winnings (not profit) by this player, -1 if unknown.

comment

text


commentTs

datetime (in UTC)


-


-

Possible Changes

- - - - - - - - - - - - - - - - - - - - - -

Table

Comment

BoardCards

Remove as these attributes are now stored on Hands

HandsActions

Remove if/when these attributes are stored on Hands or elsewhere

HandsPlayers

Move tourneyTypeId field to Hands table.

Comments

Comment fields on various tables should probably be moved to a single comment table. Aim - should be to where possible reduce tables to a list of fixed length not-null columns and have - the larger, sparser comment columns in a dedicated table. (May not be possible or practical but - something to aim at.)

- - diff --git a/docs/fdl-1.2.txt b/fdl-1.2.txt similarity index 100% rename from docs/fdl-1.2.txt rename to fdl-1.2.txt diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index a3d32efe..3e9c2871 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -890,7 +890,7 @@ class fpdb: For documentation please visit our website at http://fpdb.sourceforge.net/. If you need help click on Contact - Get Help on our website. Please note that default.conf is no longer needed nor used, all configuration now happens in HUD_config.xml. -This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt") +This program is licensed under the AGPL3, see agpl-3.0.txt in the fpdb installation directory.") self.add_and_display_tab(mh_tab, "Help") def tab_table_viewer(self, widget, data=None): From 0cd213b6023c72a7d1adbdc19e9c4ec87a3e6d6f Mon Sep 17 00:00:00 2001 From: steffen123 Date: Mon, 21 Jun 2010 13:42:23 +0200 Subject: [PATCH 17/65] removed two obselete files from utils --- utils/dump_db_basedata.py | 38 ------------------ utils/get_db_stats.py | 83 --------------------------------------- 2 files changed, 121 deletions(-) delete mode 100755 utils/dump_db_basedata.py delete mode 100755 utils/get_db_stats.py diff --git a/utils/dump_db_basedata.py b/utils/dump_db_basedata.py deleted file mode 100755 index f796c8ea..00000000 --- a/utils/dump_db_basedata.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/python - -#Copyright 2008 Steffen Jobbagy-Felso -#This program is free software: you can redistribute it and/or modify -#it under the terms of the GNU Affero General Public License as published by -#the Free Software Foundation, version 3 of the License. -# -#This program is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. -# -#You should have received a copy of the GNU Affero General Public License -#along with this program. If not, see . -#In the "official" distribution you can find the license in -#agpl-3.0.txt in the docs folder of the package. - -import sys -import MySQLdb - -db = MySQLdb.connect("localhost", "fpdb", sys.argv[1], "fpdb") -cursor = db.cursor() -print "Connected to MySQL on localhost. Printing dev-supplied base data:" - -cursor.execute("SELECT * FROM sites") -print "Sites" -print "=====" -print cursor.fetchall() - -cursor.execute("SELECT * FROM gametypes") -print "Gametypes" -print "=========" -result=cursor.fetchall() -for i in range (len(result)): - print result[i] - -cursor.close() -db.close() diff --git a/utils/get_db_stats.py b/utils/get_db_stats.py deleted file mode 100755 index 182baa38..00000000 --- a/utils/get_db_stats.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/python - -#Copyright 2008 Steffen Jobbagy-Felso -#This program is free software: you can redistribute it and/or modify -#it under the terms of the GNU Affero General Public License as published by -#the Free Software Foundation, version 3 of the License. -# -#This program is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. -# -#You should have received a copy of the GNU Affero General Public License -#along with this program. If not, see . -#In the "official" distribution you can find the license in -#agpl-3.0.txt in the docs folder of the package. - -import sys -import MySQLdb - -db = MySQLdb.connect("localhost", "fpdb", sys.argv[1], "fpdb") -cursor = db.cursor() -print "Connected to MySQL on localhost. Printing summary stats:" - -cursor.execute("SELECT id FROM Players") -print "Players:",cursor.rowcount -cursor.execute("SELECT id FROM Autorates") -print "Autorates:",cursor.rowcount - -cursor.execute("SELECT id FROM Sites") -print "Sites:",cursor.rowcount -cursor.execute("SELECT id FROM Gametypes") -print "Gametypes:",cursor.rowcount - -cursor.execute("SELECT id FROM Hands") -print "Total Hands:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.type='ring'") -print "Hands, Ring:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.type='stt'") -print "Hands, STT:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.type='mtt'") -print "Hands, MTT:",cursor.rowcount - -print "" -print "Hands per category and type" -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.limitType='cn'") -print "Hands, Cap No Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.limitType='cp'") -print "Hands, Cap Pot Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='holdem' AND Gametypes.limitType='nl'") -print "Hands, Holdem No Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='holdem' AND Gametypes.limitType='pl'") -print "Hands, Holdem Pot Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='holdem' AND Gametypes.limitType='fl'") -print "Hands, Holdem Fixed Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='omahahi' AND Gametypes.limitType='nl'") -print "Hands, Omaha Hi No Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='omahahi' AND Gametypes.limitType='pl'") -print "Hands, Omaha Hi Pot Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='omahahi' AND Gametypes.limitType='fl'") -print "Hands, Omaha Hi Fixed Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='omahahilo' AND Gametypes.limitType='nl'") -print "Hands, Omaha Hi/Lo No Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='omahahilo' AND Gametypes.limitType='pl'") -print "Hands, Omaha Hi/Lo Pot Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='omahahilo' AND Gametypes.limitType='fl'") -print "Hands, Omaha Hi/Lo Fixed Limit:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='razz'") -print "Hands, Razz:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='studhi'") -print "Hands, Stud Hi:",cursor.rowcount -cursor.execute("SELECT Hands.id FROM Hands INNER JOIN Gametypes ON Hands.gametypeId = Gametypes.id WHERE Gametypes.category='studhilo'") -print "Hands, Stud Hi/Lo:",cursor.rowcount -print "" -cursor.execute("SELECT id FROM BoardCards") -print "Board_cards:",cursor.rowcount -cursor.execute("SELECT id FROM HandsPlayers") -print "Hands_players:",cursor.rowcount -cursor.execute("SELECT id FROM HandsActions") -print "Hands_actions:",cursor.rowcount - -cursor.close() -db.close() From e244a5d50213d7bb68f79f50f45f0984a3f94dc2 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Mon, 21 Jun 2010 15:41:45 +0200 Subject: [PATCH 18/65] minor spelling correction --- pyfpdb/Hand.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 71fc6ced..e57a8ecc 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -345,7 +345,7 @@ For sites (currently only Carbon Poker) which record "all in" as a special actio self.actions['BLINDSANTES'].append(act) if blindtype == 'both': - # work with the real ammount. limit games are listed as $1, $2, where + # work with the real amount. limit games are listed as $1, $2, where # the SB 0.50 and the BB is $1, after the turn the minimum bet amount is $2.... amount = self.bb self.bets['BLINDSANTES'][player].append(Decimal(self.sb)) From cfcec2182e6285d27db7603938776fe9dc88f1d1 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Mon, 21 Jun 2010 15:48:22 +0200 Subject: [PATCH 19/65] removed fields from Tourneys buyinChips, rebuyChips, addonChips, rebuyAmount, addonAmount and koBounty --- pyfpdb/AlchemyTables.py | 6 ------ pyfpdb/SQL.py | 37 +++---------------------------------- 2 files changed, 3 insertions(+), 40 deletions(-) diff --git a/pyfpdb/AlchemyTables.py b/pyfpdb/AlchemyTables.py index 2b0faa86..0aa5ad85 100644 --- a/pyfpdb/AlchemyTables.py +++ b/pyfpdb/AlchemyTables.py @@ -353,17 +353,11 @@ tourneys_table = Table('Tourneys', metadata, Column('prizepool', Integer), # INT NOT NULL Column('tourStartTime', DateTime), # DATETIME NOT NULL Column('tourEndTime', DateTime), # DATETIME - Column('buyinChips', Integer), # INT Column('tourneyName', String(40)), # varchar(40) # Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn Column('matrixIdProcessed',SmallInteger, default=0), # TINYINT UNSIGNED DEFAULT 0 - Column('rebuyChips', Integer, default=0), # INT DEFAULT 0 - Column('addonChips', Integer, default=0), # INT DEFAULT 0 - Column('rebuyAmount', MoneyColumn, default=0), # INT DEFAULT 0 - Column('addonAmount', MoneyColumn, default=0), # INT DEFAULT 0 Column('totalRebuys', Integer, default=0), # INT DEFAULT 0 Column('totalAddons', Integer, default=0), # INT DEFAULT 0 - Column('koBounty', Integer, default=0), # INT DEFAULT 0 Column('comment', Text), # TEXT Column('commentTs', DateTime), # DATETIME mysql_charset='utf8', diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 8776178b..33c247cb 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -421,16 +421,10 @@ class Sql: prizepool INT NOT NULL, startTime DATETIME NOT NULL, endTime DATETIME, - buyinChips INT, tourneyName varchar(40), matrixIdProcessed TINYINT UNSIGNED DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */ - rebuyChips INT DEFAULT 0, - addonChips INT DEFAULT 0, - rebuyAmount INT DEFAULT 0, - addonAmount INT DEFAULT 0, totalRebuys INT DEFAULT 0, totalAddons INT DEFAULT 0, - koBounty INT DEFAULT 0, comment TEXT, commentTs DATETIME) ENGINE=INNODB""" @@ -443,16 +437,10 @@ class Sql: prizepool INT, startTime timestamp without time zone, endTime timestamp without time zone, - buyinChips INT, tourneyName varchar(40), matrixIdProcessed SMALLINT DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */ - rebuyChips INT DEFAULT 0, - addonChips INT DEFAULT 0, - rebuyAmount INT DEFAULT 0, - addonAmount INT DEFAULT 0, totalRebuys INT DEFAULT 0, totalAddons INT DEFAULT 0, - koBounty INT DEFAULT 0, comment TEXT, commentTs timestamp without time zone)""" elif db_server == 'sqlite': @@ -464,16 +452,10 @@ class Sql: prizepool INT, startTime REAL, endTime REAL, - buyinChips INT, tourneyName TEXT, matrixIdProcessed INT UNSIGNED DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */ - rebuyChips INT DEFAULT 0, - addonChips INT DEFAULT 0, - rebuyAmount INT DEFAULT 0, - addonAmount INT DEFAULT 0, totalRebuys INT DEFAULT 0, totalAddons INT DEFAULT 0, - koBounty INT DEFAULT 0, comment TEXT, commentTs REAL)""" ################################ @@ -3614,16 +3596,10 @@ class Sql: t.prizepool, t.startTime, t.endTime, - t.buyinChips, t.tourneyName, t.matrixIdProcessed, - t.rebuyChips, - t.addonChips, - t.rebuyAmount, - t.addonAmount, t.totalRebuys, t.totalAddons, - t.koBounty, t.comment FROM Tourneys t INNER JOIN TourneyTypes tt ON (t.tourneyTypeId = tt.id) @@ -3632,11 +3608,10 @@ class Sql: self.query['insertTourney'] = """INSERT INTO Tourneys (tourneyTypeId, siteTourneyNo, entries, prizepool, - startTime, endTime, buyinChips, tourneyName, matrixIdProcessed, - rebuyChips, addonChips, rebuyAmount, addonAmount, totalRebuys, - totalAddons, koBounty, comment, commentTs) + startTime, endTime, tourneyName, matrixIdProcessed, + totalRebuys, totalAddons, comment, commentTs) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, - %s, %s, %s, %s, %s, %s, %s, %s) + %s, %s) """ self.query['updateTourney'] = """UPDATE Tourneys @@ -3645,16 +3620,10 @@ class Sql: prizepool = %s, startTime = %s, endTime = %s, - buyinChips = %s, tourneyName = %s, matrixIdProcessed = %s, - rebuyChips = %s, - addonChips = %s, - rebuyAmount = %s, - addonAmount = %s, totalRebuys = %s, totalAddons = %s, - koBounty = %s, comment = %s, commentTs = %s WHERE id=%s From d83c68d57823fa6b0b0b9ff65fd92f998e619a73 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Mon, 21 Jun 2010 15:54:32 +0200 Subject: [PATCH 20/65] fix silly mistake i made when changing start screen text --- pyfpdb/fpdb.pyw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index 92d3f6f7..6d61038f 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -890,7 +890,7 @@ class fpdb: For documentation please visit our website at http://fpdb.sourceforge.net/. If you need help click on Contact - Get Help on our website. Please note that default.conf is no longer needed nor used, all configuration now happens in HUD_config.xml. -This program is licensed under the AGPL3, see agpl-3.0.txt in the fpdb installation directory.") +This program is licensed under the AGPL3, see agpl-3.0.txt in the fpdb installation directory.""") self.add_and_display_tab(mh_tab, "Help") def tab_table_viewer(self, widget, data=None): From e6fd3afbba04bf28e20b0223f527b9e3a74a6d70 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Mon, 21 Jun 2010 16:45:15 +0200 Subject: [PATCH 21/65] renamed totalRebuys/AddOns to totalRebuyCount/AddOnCount --- pyfpdb/AlchemyTables.py | 4 ++-- pyfpdb/FulltiltToFpdb.py | 4 ++-- pyfpdb/SQL.py | 22 +++++++++++----------- pyfpdb/Tourney.py | 13 +++++++------ 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/pyfpdb/AlchemyTables.py b/pyfpdb/AlchemyTables.py index 0aa5ad85..003716b6 100644 --- a/pyfpdb/AlchemyTables.py +++ b/pyfpdb/AlchemyTables.py @@ -356,8 +356,8 @@ tourneys_table = Table('Tourneys', metadata, Column('tourneyName', String(40)), # varchar(40) # Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn Column('matrixIdProcessed',SmallInteger, default=0), # TINYINT UNSIGNED DEFAULT 0 - Column('totalRebuys', Integer, default=0), # INT DEFAULT 0 - Column('totalAddons', Integer, default=0), # INT DEFAULT 0 + Column('totalRebuyCount', Integer, default=0), # INT DEFAULT 0 + Column('totalAddOnCount', Integer, default=0), # INT DEFAULT 0 Column('comment', Text), # TEXT Column('commentTs', DateTime), # DATETIME mysql_charset='utf8', diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index 2c6370e6..1503e10d 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -582,8 +582,8 @@ class Fulltilt(HandHistoryConverter): "PRIZEPOOL" : "prizepool", "REBUY_AMOUNT" : "rebuyAmount", "ADDON_AMOUNT" : "addOnAmount", - "REBUY_TOTAL" : "totalRebuys", - "ADDONS_TOTAL" : "totalAddOns", + "REBUY_TOTAL" : "totalRebuyCount", + "ADDONS_TOTAL" : "totalAddOnCount", "REBUY_CHIPS" : "rebuyChips", "ADDON_CHIPS" : "addOnChips", "STARTTIME" : "starttime", diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 33c247cb..ae6be545 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -423,8 +423,8 @@ class Sql: endTime DATETIME, tourneyName varchar(40), matrixIdProcessed TINYINT UNSIGNED DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */ - totalRebuys INT DEFAULT 0, - totalAddons INT DEFAULT 0, + totalRebuyCount INT DEFAULT 0, + totalAddOnCount INT DEFAULT 0, comment TEXT, commentTs DATETIME) ENGINE=INNODB""" @@ -439,8 +439,8 @@ class Sql: endTime timestamp without time zone, tourneyName varchar(40), matrixIdProcessed SMALLINT DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */ - totalRebuys INT DEFAULT 0, - totalAddons INT DEFAULT 0, + totalRebuyCount INT DEFAULT 0, + totalAddOnCount INT DEFAULT 0, comment TEXT, commentTs timestamp without time zone)""" elif db_server == 'sqlite': @@ -454,8 +454,8 @@ class Sql: endTime REAL, tourneyName TEXT, matrixIdProcessed INT UNSIGNED DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */ - totalRebuys INT DEFAULT 0, - totalAddons INT DEFAULT 0, + totalRebuyCount INT DEFAULT 0, + totalAddOnCount INT DEFAULT 0, comment TEXT, commentTs REAL)""" ################################ @@ -3598,8 +3598,8 @@ class Sql: t.endTime, t.tourneyName, t.matrixIdProcessed, - t.totalRebuys, - t.totalAddons, + t.totalRebuyCount, + t.totalAddOnCount, t.comment FROM Tourneys t INNER JOIN TourneyTypes tt ON (t.tourneyTypeId = tt.id) @@ -3609,7 +3609,7 @@ class Sql: self.query['insertTourney'] = """INSERT INTO Tourneys (tourneyTypeId, siteTourneyNo, entries, prizepool, startTime, endTime, tourneyName, matrixIdProcessed, - totalRebuys, totalAddons, comment, commentTs) + totalRebuyCount, totalAddOnCount, comment, commentTs) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) """ @@ -3622,8 +3622,8 @@ class Sql: endTime = %s, tourneyName = %s, matrixIdProcessed = %s, - totalRebuys = %s, - totalAddons = %s, + totalRebuyCount = %s, + totalAddonCount = %s, comment = %s, commentTs = %s WHERE id=%s diff --git a/pyfpdb/Tourney.py b/pyfpdb/Tourney.py index 281a6710..5cc5d03a 100644 --- a/pyfpdb/Tourney.py +++ b/pyfpdb/Tourney.py @@ -1,4 +1,5 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- #Copyright 2009 Stephane Alessio #This program is free software: you can redistribute it and/or modify @@ -73,10 +74,10 @@ class Tourney(object): self.subTourneyFee = None self.rebuyChips = 0 self.addOnChips = 0 - self.rebuyAmount = 0 - self.addOnAmount = 0 - self.totalRebuys = 0 - self.totalAddOns = 0 + self.rebuyAmount = 0 + self.addOnAmount = 0 + self.totalRebuyCount = 0 + self.totalAddOnCount = 0 self.koBounty = 0 self.tourneyComment = None self.players = [] @@ -121,8 +122,8 @@ class Tourney(object): ("ADDON CHIPS", self.addOnChips), ("REBUY AMOUNT", self.rebuyAmount), ("ADDON AMOUNT", self.addOnAmount), - ("TOTAL REBUYS", self.totalRebuys), - ("TOTAL ADDONS", self.totalAddOns), + ("TOTAL REBUYS", self.totalRebuyCount), + ("TOTAL ADDONS", self.totalAddOnCount), ("KO BOUNTY", self.koBounty), ("TOURNEY COMMENT", self.tourneyComment) ) From e46b0b7a0f4a9fd11e6584832c1c6e1342ccca6b Mon Sep 17 00:00:00 2001 From: steffen123 Date: Mon, 21 Jun 2010 17:12:20 +0200 Subject: [PATCH 22/65] renamed tourneyplayers to tourneysplayers in a few places --- pyfpdb/AlchemyMappings.py | 8 ++++---- pyfpdb/FulltiltToFpdb.py | 8 ++++---- pyfpdb/SummaryEverleaf.py | 7 ++++--- pyfpdb/TournamentTracker.py | 3 ++- pyfpdb/Tourney.py | 4 ++-- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/pyfpdb/AlchemyMappings.py b/pyfpdb/AlchemyMappings.py index 7b9c20a3..86b78bd9 100644 --- a/pyfpdb/AlchemyMappings.py +++ b/pyfpdb/AlchemyMappings.py @@ -185,7 +185,7 @@ class HandInternal(DerivedStats): # fetch and update tourney players for hp in self.handPlayers: - tp = TourneyPlayer.get_or_create(session, tour.id, hp.playerId) + tp = TourneysPlayer.get_or_create(session, tour.id, hp.playerId) # FIXME: other TourneysPlayers should be added here session.flush() @@ -387,7 +387,7 @@ class TourneyType(MappedBase): return get_or_create(cls, session, **kwargs)[0] -class TourneyPlayer(MappedBase): +class TourneysPlayer(MappedBase): """Class reflecting TourneysPlayers db table""" @classmethod @@ -439,7 +439,7 @@ mapper (Gametype, gametypes_table, properties={ }) mapper (Player, players_table, properties={ 'playerHands': relation(HandPlayer, backref='player'), - 'playerTourney': relation(TourneyPlayer, backref='player'), + 'playerTourney': relation(TourneysPlayer, backref='player'), }) mapper (Site, sites_table, properties={ 'gametypes': relation(Gametype, backref = 'site'), @@ -457,7 +457,7 @@ mapper (Tourney, tourneys_table) mapper (TourneyType, tourney_types_table, properties={ 'tourneys': relation(Tourney, backref='type'), }) -mapper (TourneyPlayer, tourneys_players_table) +mapper (TourneysPlayer, tourneys_players_table) class LambdaKeyDict(defaultdict): """Operates like defaultdict but passes key argument to the factory function""" diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index 1503e10d..b99cc073 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -66,7 +66,7 @@ class Fulltilt(HandHistoryConverter): ''', re.VERBOSE) re_Button = re.compile('^The button is in seat #(?P