Merge branch 'master' of git://git.assembla.com/fpdboz
This commit is contained in:
commit
34fdc549fd
|
@ -599,37 +599,6 @@ class FpdbSQLQueries:
|
||||||
################################
|
################################
|
||||||
|
|
||||||
|
|
||||||
# Returns all cash game handIds and the money won(winnings is the final pot)
|
|
||||||
# by the playerId for a single site.
|
|
||||||
if(self.dbname == 'MySQL InnoDB') or (self.dbname == 'PostgreSQL'):
|
|
||||||
self.query['getRingWinningsAllGamesPlayerIdSite'] = """SELECT handId, winnings FROM HandsPlayers
|
|
||||||
INNER JOIN Players ON HandsPlayers.playerId = Players.id
|
|
||||||
INNER JOIN Hands ON Hands.id = HandsPlayers.handId
|
|
||||||
WHERE Players.name = %s AND Players.siteId = %s AND (tourneysPlayersId IS NULL)
|
|
||||||
ORDER BY handStart"""
|
|
||||||
elif(self.dbname == 'SQLite'):
|
|
||||||
#Probably doesn't work.
|
|
||||||
self.query['getRingWinningsAllGamesPlayerIdSite'] = """SELECT handId, winnings FROM HandsPlayers
|
|
||||||
INNER JOIN Players ON HandsPlayers.playerId = Players.id
|
|
||||||
INNER JOIN Hands ON Hands.id = HandsPlayers.handId
|
|
||||||
WHERE Players.name = %s AND Players.siteId = %s AND (tourneysPlayersId IS NULL)
|
|
||||||
ORDER BY handStart"""
|
|
||||||
|
|
||||||
# Returns the profit for a given ring game handId, Total pot - money invested by playerId
|
|
||||||
if(self.dbname == 'MySQL InnoDB') or (self.dbname == 'PostgreSQL'):
|
|
||||||
self.query['getRingProfitFromHandId'] = """SELECT SUM(amount) FROM HandsActions
|
|
||||||
INNER JOIN HandsPlayers ON HandsActions.handPlayerId = HandsPlayers.id
|
|
||||||
INNER JOIN Players ON HandsPlayers.playerId = Players.id
|
|
||||||
WHERE Players.name = %s AND HandsPlayers.handId = %s
|
|
||||||
AND Players.siteId = %s AND (tourneysPlayersId IS NULL)"""
|
|
||||||
elif(self.dbname == 'SQLite'):
|
|
||||||
#Probably doesn't work.
|
|
||||||
self.query['getRingProfitFromHandId'] = """SELECT SUM(amount) FROM HandsActions
|
|
||||||
INNER JOIN HandsPlayers ON HandsActions.handPlayerId = HandsPlayers.id
|
|
||||||
INNER JOIN Players ON HandsPlayers.playerId = Players.id
|
|
||||||
WHERE Players.name = %s AND HandsPlayers.handId = %s
|
|
||||||
AND Players.siteId = %s AND (tourneysPlayersId IS NULL)"""
|
|
||||||
|
|
||||||
if(self.dbname == 'MySQL InnoDB') or (self.dbname == 'PostgreSQL'):
|
if(self.dbname == 'MySQL InnoDB') or (self.dbname == 'PostgreSQL'):
|
||||||
self.query['getPlayerId'] = """SELECT id from Players where name = %s"""
|
self.query['getPlayerId'] = """SELECT id from Players where name = %s"""
|
||||||
elif(self.dbname == 'SQLite'):
|
elif(self.dbname == 'SQLite'):
|
||||||
|
|
|
@ -113,10 +113,19 @@ follow : whether to tail -f the input"""
|
||||||
|
|
||||||
def readHandInfo(self, hand):
|
def readHandInfo(self, hand):
|
||||||
m = self.re_HandInfo.search(hand.handText,re.DOTALL)
|
m = self.re_HandInfo.search(hand.handText,re.DOTALL)
|
||||||
#print m.groups()
|
|
||||||
|
if(m == None):
|
||||||
|
logging.info("Didn't match re_HandInfo")
|
||||||
|
logging.info(hand.handText)
|
||||||
|
return None
|
||||||
|
|
||||||
hand.handid = m.group('HID')
|
hand.handid = m.group('HID')
|
||||||
hand.tablename = m.group('TABLE')
|
hand.tablename = m.group('TABLE')
|
||||||
hand.starttime = time.strptime(m.group('DATETIME'), "%H:%M:%S ET - %Y/%m/%d")
|
hand.starttime = time.strptime(m.group('DATETIME'), "%H:%M:%S ET - %Y/%m/%d")
|
||||||
|
hand.maxseats = 8 # assume 8-max until we see otherwise
|
||||||
|
if m.group('TABLEATTRIBUTES'):
|
||||||
|
m2 = re.search("(deep )?(\d+)( max)?", m.group('TABLEATTRIBUTES'))
|
||||||
|
hand.maxseats = int(m2.group(2))
|
||||||
# These work, but the info is already in the Hand class - should be used for tourneys though.
|
# These work, but the info is already in the Hand class - should be used for tourneys though.
|
||||||
# m.group('SB')
|
# m.group('SB')
|
||||||
# m.group('BB')
|
# m.group('BB')
|
||||||
|
|
|
@ -45,7 +45,7 @@ class GuiAutoImport (threading.Thread):
|
||||||
|
|
||||||
self.importer = fpdb_import.Importer(self,self.settings, self.config)
|
self.importer = fpdb_import.Importer(self,self.settings, self.config)
|
||||||
self.importer.setCallHud(True)
|
self.importer.setCallHud(True)
|
||||||
self.importer.setMinPrint(30)
|
self.importer.setMinPrint(settings['minPrint'])
|
||||||
self.importer.setQuiet(False)
|
self.importer.setQuiet(False)
|
||||||
self.importer.setFailOnError(False)
|
self.importer.setFailOnError(False)
|
||||||
self.importer.setHandCount(0)
|
self.importer.setHandCount(0)
|
||||||
|
@ -227,13 +227,15 @@ if __name__== "__main__":
|
||||||
|
|
||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
parser.add_option("-q", "--quiet", action="store_false", dest="gui", default=True, help="don't start gui")
|
parser.add_option("-q", "--quiet", action="store_false", dest="gui", default=True, help="don't start gui")
|
||||||
|
parser.add_option("-m", "--minPrint", "--status", dest="minPrint", default="0", type="int",
|
||||||
|
help="How often to print a one-line status report (0 (default) means never)")
|
||||||
(options, sys.argv) = parser.parse_args()
|
(options, sys.argv) = parser.parse_args()
|
||||||
|
|
||||||
config = Configuration.Config()
|
config = Configuration.Config()
|
||||||
# db = fpdb_db.fpdb_db()
|
# db = fpdb_db.fpdb_db()
|
||||||
|
|
||||||
settings = {}
|
settings = {}
|
||||||
|
settings['minPrint'] = options.minPrint
|
||||||
if os.name == 'nt': settings['os'] = 'windows'
|
if os.name == 'nt': settings['os'] = 'windows'
|
||||||
else: settings['os'] = 'linuxmac'
|
else: settings['os'] = 'linuxmac'
|
||||||
|
|
||||||
|
|
|
@ -60,8 +60,8 @@ class GuiBulkImport():
|
||||||
self.importer.setFailOnError(self.chk_fail.get_active())
|
self.importer.setFailOnError(self.chk_fail.get_active())
|
||||||
self.importer.setThreads(int(self.spin_threads.get_text()))
|
self.importer.setThreads(int(self.spin_threads.get_text()))
|
||||||
self.importer.setHandsInDB(self.n_hands_in_db)
|
self.importer.setHandsInDB(self.n_hands_in_db)
|
||||||
cb_model = self.cb.get_model()
|
cb_model = self.cb_dropindexes.get_model()
|
||||||
cb_index = self.cb.get_active()
|
cb_index = self.cb_dropindexes.get_active()
|
||||||
if cb_index:
|
if cb_index:
|
||||||
self.importer.setDropIndexes(cb_model[cb_index][0])
|
self.importer.setDropIndexes(cb_model[cb_index][0])
|
||||||
else:
|
else:
|
||||||
|
@ -159,13 +159,13 @@ class GuiBulkImport():
|
||||||
self.lab_drop.set_justify(gtk.JUSTIFY_RIGHT)
|
self.lab_drop.set_justify(gtk.JUSTIFY_RIGHT)
|
||||||
|
|
||||||
# ComboBox - drop indexes
|
# ComboBox - drop indexes
|
||||||
self.cb = gtk.combo_box_new_text()
|
self.cb_dropindexes = gtk.combo_box_new_text()
|
||||||
self.cb.append_text('auto')
|
self.cb_dropindexes.append_text('auto')
|
||||||
self.cb.append_text("don't drop")
|
self.cb_dropindexes.append_text("don't drop")
|
||||||
self.cb.append_text('drop')
|
self.cb_dropindexes.append_text('drop')
|
||||||
self.cb.set_active(0)
|
self.cb_dropindexes.set_active(0)
|
||||||
self.table.attach(self.cb, 4, 5, 1, 2, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK)
|
self.table.attach(self.cb_dropindexes, 4, 5, 1, 2, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK)
|
||||||
self.cb.show()
|
self.cb_dropindexes.show()
|
||||||
|
|
||||||
# label - filter
|
# label - filter
|
||||||
self.lab_filter = gtk.Label("Site filter:")
|
self.lab_filter = gtk.Label("Site filter:")
|
||||||
|
@ -176,7 +176,10 @@ class GuiBulkImport():
|
||||||
# ComboBox - filter
|
# ComboBox - filter
|
||||||
self.cbfilter = gtk.combo_box_new_text()
|
self.cbfilter = gtk.combo_box_new_text()
|
||||||
self.cbfilter.append_text("passthrough")
|
self.cbfilter.append_text("passthrough")
|
||||||
self.cbfilter.append_text("Everleaf")
|
self.cbfilter.append_text("BetfairToFpdb")
|
||||||
|
self.cbfilter.append_text("EverleafToFpdb")
|
||||||
|
self.cbfilter.append_text("FulltiltToFpdb")
|
||||||
|
self.cbfilter.append_text("PokerStarsToFpdb")
|
||||||
self.cbfilter.set_active(0)
|
self.cbfilter.set_active(0)
|
||||||
self.table.attach(self.cbfilter, 3, 4, 2, 3, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK)
|
self.table.attach(self.cbfilter, 3, 4, 2, 3, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK)
|
||||||
self.cbfilter.show()
|
self.cbfilter.show()
|
||||||
|
@ -195,31 +198,45 @@ class GuiBulkImport():
|
||||||
|
|
||||||
# see how many hands are in the db and adjust accordingly
|
# see how many hands are in the db and adjust accordingly
|
||||||
tcursor = db.db.cursor()
|
tcursor = db.db.cursor()
|
||||||
tcursor.execute("Select max(id) from Hands;")
|
tcursor.execute("Select count(1) from Hands;")
|
||||||
row = tcursor.fetchone()
|
row = tcursor.fetchone()
|
||||||
tcursor.close()
|
tcursor.close()
|
||||||
self.n_hands_in_db = row[0]
|
self.n_hands_in_db = row[0]
|
||||||
if self.n_hands_in_db == 0:
|
if self.n_hands_in_db == 0:
|
||||||
self.cb.set_active(2)
|
self.cb_dropindexes.set_active(2)
|
||||||
self.cb.set_sensitive(False)
|
self.cb_dropindexes.set_sensitive(False)
|
||||||
self.lab_drop.set_sensitive(False)
|
self.lab_drop.set_sensitive(False)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def main(argv=None):
|
||||||
|
"""main can also be called in the python interpreter, by supplying the command line as the argument.
|
||||||
|
>>>import GuiBulkImport
|
||||||
|
>>>GuiBulkImport.main("-f ~/data/hands")"""
|
||||||
|
if argv is None:
|
||||||
|
argv = sys.argv[1:]
|
||||||
|
else:
|
||||||
|
argv = argv.split(" ")
|
||||||
|
|
||||||
def destroy(*args): # call back for terminating the main eventloop
|
def destroy(*args): # call back for terminating the main eventloop
|
||||||
gtk.main_quit()
|
gtk.main_quit()
|
||||||
|
|
||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
parser.add_option("-f", "--file", dest="filename", help="Input file in quiet mode", metavar="FILE")
|
parser.add_option("-f", "--file", dest="filename", metavar="FILE", default=None,
|
||||||
parser.add_option("-q", "--quiet", action="store_false", dest="gui", default=True, help="don't start gui")
|
help="Input file in quiet mode")
|
||||||
parser.add_option("-x", "--convert", dest="filtername", help="Conversion filter", default="passthrough")
|
parser.add_option("-q", "--quiet", action="store_false", dest="gui", default=True,
|
||||||
(options, sys.argv) = parser.parse_args()
|
help="don't start gui; deprecated (just give a filename with -f).")
|
||||||
|
parser.add_option("-c", "--convert", dest="filtername", default="passthrough", metavar="FILTER",
|
||||||
|
help="Conversion filter (*passthrough, FullTiltToFpdb, PokerStarsToFpdb, EverleafToFpdb)")
|
||||||
|
parser.add_option("-x", "--failOnError", action="store_true", default=False,
|
||||||
|
help="If this option is passed it quits when it encounters any error")
|
||||||
|
parser.add_option("-m", "--minPrint", "--status", dest="minPrint", default="0", type="int",
|
||||||
|
help="How often to print a one-line status report (0 (default) means never)")
|
||||||
|
(options, sys.argv) = parser.parse_args(args = argv)
|
||||||
|
|
||||||
config = Configuration.Config()
|
config = Configuration.Config()
|
||||||
db = fpdb_db.fpdb_db()
|
db = fpdb_db.fpdb_db()
|
||||||
|
|
||||||
settings = {}
|
settings = {}
|
||||||
|
settings['minPrint'] = options.minPrint
|
||||||
if os.name == 'nt': settings['os'] = 'windows'
|
if os.name == 'nt': settings['os'] = 'windows'
|
||||||
else: settings['os'] = 'linuxmac'
|
else: settings['os'] = 'linuxmac'
|
||||||
|
|
||||||
|
@ -228,7 +245,10 @@ if __name__ == '__main__':
|
||||||
settings.update(config.get_import_parameters())
|
settings.update(config.get_import_parameters())
|
||||||
settings.update(config.get_default_paths())
|
settings.update(config.get_default_paths())
|
||||||
|
|
||||||
if(options.gui == True):
|
if not options.gui:
|
||||||
|
print """-q is deprecated. Just use "-f filename" instead"""
|
||||||
|
# This is because -q on its own causes an error, so -f is necessary and sufficient for cmd line use
|
||||||
|
if not options.filename:
|
||||||
i = GuiBulkImport(db, settings, config)
|
i = GuiBulkImport(db, settings, config)
|
||||||
main_window = gtk.Window()
|
main_window = gtk.Window()
|
||||||
main_window.connect('destroy', destroy)
|
main_window.connect('destroy', destroy)
|
||||||
|
@ -239,8 +259,13 @@ if __name__ == '__main__':
|
||||||
#Do something useful
|
#Do something useful
|
||||||
importer = fpdb_import.Importer(False,settings, config)
|
importer = fpdb_import.Importer(False,settings, config)
|
||||||
importer.setDropIndexes("auto")
|
importer.setDropIndexes("auto")
|
||||||
importer.setFailOnError(True)
|
importer.setFailOnError(options.failOnError)
|
||||||
importer.addImportFile(options.filename, filter=options.filtername)
|
importer.addBulkImportImportFileOrDir(os.path.expanduser(options.filename), filter=options.filtername)
|
||||||
importer.setCallHud(False)
|
importer.setCallHud(False)
|
||||||
importer.runImport()
|
importer.runImport()
|
||||||
importer.clearFileList()
|
importer.clearFileList()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.exit(main())
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,9 @@ from HandHistoryConverter import *
|
||||||
# PokerStars HH Format
|
# PokerStars HH Format
|
||||||
|
|
||||||
class PokerStars(HandHistoryConverter):
|
class PokerStars(HandHistoryConverter):
|
||||||
|
|
||||||
# Static regexes
|
# Static regexes
|
||||||
re_GameInfo = re.compile("PokerStars Game #(?P<HID>[0-9]+):\s+(HORSE)? \(?(?P<GAME>Hold\'em|Razz|7 Card Stud|Omaha Hi/Lo|Badugi) (?P<LIMIT>No Limit|Limit|Pot Limit),? \(?(?P<CURRENCY>\$|)?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+)\) - (?P<DATETIME>.*$)", re.MULTILINE)
|
re_GameInfo = re.compile("PokerStars Game #(?P<HID>[0-9]+):\s+(HORSE)? \(?(?P<GAME>Hold\'em|Razz|7 Card Stud|Omaha|Omaha Hi/Lo|Badugi) (?P<LIMIT>No Limit|Limit|Pot Limit),? \(?(?P<CURRENCY>\$|)?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+)\) - (?P<DATETIME>.*$)", re.MULTILINE)
|
||||||
re_SplitHands = re.compile('\n\n+')
|
re_SplitHands = re.compile('\n\n+')
|
||||||
re_HandInfo = re.compile("^Table \'(?P<TABLE>[- a-zA-Z]+)\'(?P<TABLEATTRIBUTES>.+?$)?", re.MULTILINE)
|
re_HandInfo = re.compile("^Table \'(?P<TABLE>[- a-zA-Z]+)\'(?P<TABLEATTRIBUTES>.+?$)?", re.MULTILINE)
|
||||||
re_Button = re.compile('Seat #(?P<BUTTON>\d+) is the button', re.MULTILINE)
|
re_Button = re.compile('Seat #(?P<BUTTON>\d+) is the button', re.MULTILINE)
|
||||||
|
@ -80,7 +80,7 @@ follow : whether to tail -f the input"""
|
||||||
info = {'type':'ring'}
|
info = {'type':'ring'}
|
||||||
|
|
||||||
m = self.re_GameInfo.search(handText)
|
m = self.re_GameInfo.search(handText)
|
||||||
if not m:
|
if not m:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
mg = m.groupdict()
|
mg = m.groupdict()
|
||||||
|
@ -89,7 +89,7 @@ follow : whether to tail -f the input"""
|
||||||
limits = { 'No Limit':'nl', 'Pot Limit':'pl', 'Limit':'fl' }
|
limits = { 'No Limit':'nl', 'Pot Limit':'pl', 'Limit':'fl' }
|
||||||
games = { # base, category
|
games = { # base, category
|
||||||
"Hold'em" : ('hold','holdem'),
|
"Hold'em" : ('hold','holdem'),
|
||||||
'Omaha Hi' : ('hold','omahahi'),
|
'Omaha' : ('hold','omahahi'),
|
||||||
'Omaha Hi/Lo' : ('hold','omahahilo'),
|
'Omaha Hi/Lo' : ('hold','omahahilo'),
|
||||||
'Razz' : ('stud','razz'),
|
'Razz' : ('stud','razz'),
|
||||||
'7 Card Stud' : ('stud','studhi'),
|
'7 Card Stud' : ('stud','studhi'),
|
||||||
|
@ -114,7 +114,12 @@ follow : whether to tail -f the input"""
|
||||||
def readHandInfo(self, hand):
|
def readHandInfo(self, hand):
|
||||||
info = {}
|
info = {}
|
||||||
m = self.re_HandInfo.search(hand.handText,re.DOTALL)
|
m = self.re_HandInfo.search(hand.handText,re.DOTALL)
|
||||||
if m: info.update(m.groupdict())
|
if m:
|
||||||
|
info.update(m.groupdict())
|
||||||
|
# TODO: Be less lazy and parse maxseats from the HandInfo regex
|
||||||
|
if m.group('TABLEATTRIBUTES'):
|
||||||
|
m2 = re.search("\s*(\d+)-max", m.group('TABLEATTRIBUTES'))
|
||||||
|
hand.maxseats = int(m2.group(1))
|
||||||
m = self.re_GameInfo.search(hand.handText)
|
m = self.re_GameInfo.search(hand.handText)
|
||||||
if m: info.update(m.groupdict())
|
if m: info.update(m.groupdict())
|
||||||
m = self.re_Button.search(hand.handText)
|
m = self.re_Button.search(hand.handText)
|
||||||
|
|
|
@ -337,7 +337,7 @@ class fpdb:
|
||||||
new_ps_thread=GuiPositionalStats.GuiPositionalStats(self.db, self.config, self.querydict)
|
new_ps_thread=GuiPositionalStats.GuiPositionalStats(self.db, self.config, self.querydict)
|
||||||
self.threads.append(new_ps_thread)
|
self.threads.append(new_ps_thread)
|
||||||
ps_tab=new_ps_thread.get_vbox()
|
ps_tab=new_ps_thread.get_vbox()
|
||||||
self.add_and_display_tab(ps_tab, "Ppositional Stats")
|
self.add_and_display_tab(ps_tab, "Positional Stats")
|
||||||
|
|
||||||
|
|
||||||
def tab_main_help(self, widget, data):
|
def tab_main_help(self, widget, data):
|
||||||
|
|
|
@ -115,6 +115,7 @@ class Importer:
|
||||||
# Called from GuiBulkImport to add a file or directory.
|
# Called from GuiBulkImport to add a file or directory.
|
||||||
def addBulkImportImportFileOrDir(self, inputPath,filter = "passthrough"):
|
def addBulkImportImportFileOrDir(self, inputPath,filter = "passthrough"):
|
||||||
"""Add a file or directory for bulk import"""
|
"""Add a file or directory for bulk import"""
|
||||||
|
|
||||||
# Bulk import never monitors
|
# Bulk import never monitors
|
||||||
# if directory, add all files in it. Otherwise add single file.
|
# if directory, add all files in it. Otherwise add single file.
|
||||||
# TODO: only add sane files?
|
# TODO: only add sane files?
|
||||||
|
@ -124,7 +125,6 @@ class Importer:
|
||||||
self.addImportFile(os.path.join(inputPath, subdir[0], file), site="default", filter=filter)
|
self.addImportFile(os.path.join(inputPath, subdir[0], file), site="default", filter=filter)
|
||||||
else:
|
else:
|
||||||
self.addImportFile(inputPath, site="default", filter=filter)
|
self.addImportFile(inputPath, site="default", filter=filter)
|
||||||
|
|
||||||
#Add a directory of files to filelist
|
#Add a directory of files to filelist
|
||||||
#Only one import directory per site supported.
|
#Only one import directory per site supported.
|
||||||
#dirlist is a hash of lists:
|
#dirlist is a hash of lists:
|
||||||
|
@ -172,7 +172,15 @@ class Importer:
|
||||||
|
|
||||||
def calculate_auto(self):
|
def calculate_auto(self):
|
||||||
"""An heuristic to determine a reasonable value of drop/don't drop"""
|
"""An heuristic to determine a reasonable value of drop/don't drop"""
|
||||||
if len(self.filelist) == 1: return "don't drop"
|
if len(self.filelist) == 1: return "don't drop"
|
||||||
|
if 'handsInDB' not in self.settings:
|
||||||
|
try:
|
||||||
|
tmpcursor = self.fdb.db.cursor()
|
||||||
|
tmpcursor.execute("Select count(1) from Hands;")
|
||||||
|
self.settings['handsInDB'] = tmpcursor.fetchone()[0]
|
||||||
|
tmpcursor.close()
|
||||||
|
except:
|
||||||
|
pass # if this fails we're probably doomed anyway
|
||||||
if self.settings['handsInDB'] < 5000: return "drop"
|
if self.settings['handsInDB'] < 5000: return "drop"
|
||||||
if len(self.filelist) < 50: return "don't drop"
|
if len(self.filelist) < 50: return "don't drop"
|
||||||
if self.settings['handsInDB'] > 50000: return "don't drop"
|
if self.settings['handsInDB'] > 50000: return "don't drop"
|
||||||
|
@ -348,7 +356,6 @@ class Importer:
|
||||||
isTourney=fpdb_simple.isTourney(hand[0])
|
isTourney=fpdb_simple.isTourney(hand[0])
|
||||||
if not isTourney:
|
if not isTourney:
|
||||||
fpdb_simple.filterAnteBlindFold(site,hand)
|
fpdb_simple.filterAnteBlindFold(site,hand)
|
||||||
hand=fpdb_simple.filterCrap(site, hand, isTourney)
|
|
||||||
self.hand=hand
|
self.hand=hand
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -64,6 +64,8 @@ def mainParser(backend, db, cursor, site, category, hand, config):
|
||||||
|
|
||||||
fpdb_simple.isAlreadyInDB(cursor, gametypeID, siteHandNo)
|
fpdb_simple.isAlreadyInDB(cursor, gametypeID, siteHandNo)
|
||||||
|
|
||||||
|
hand=fpdb_simple.filterCrap(site, hand, isTourney)
|
||||||
|
|
||||||
#part 2: classify lines by type (e.g. cards, action, win, sectionchange) and street
|
#part 2: classify lines by type (e.g. cards, action, win, sectionchange) and street
|
||||||
fpdb_simple.classifyLines(hand, category, lineTypes, lineStreets)
|
fpdb_simple.classifyLines(hand, category, lineTypes, lineStreets)
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,11 @@ SQLITE = 4
|
||||||
|
|
||||||
fastStoreHudCache = True # set this to True to test the new storeHudCache routine
|
fastStoreHudCache = True # set this to True to test the new storeHudCache routine
|
||||||
|
|
||||||
saveActions = False # set this to False to avoid storing action data
|
saveActions = True # set this to False to avoid storing action data
|
||||||
# Pros: speeds up imports
|
# Pros: speeds up imports
|
||||||
# Cons: no action data is saved, so you need to keep the hand histories
|
# Cons: no action data is saved, so you need to keep the hand histories
|
||||||
# variance not available on stats page
|
# variance not available on stats page
|
||||||
|
# no graphs
|
||||||
|
|
||||||
#stores a stud/razz hand into the database
|
#stores a stud/razz hand into the database
|
||||||
def ring_stud(config, backend, db, cursor, base, category, site_hand_no, gametype_id, hand_start_time
|
def ring_stud(config, backend, db, cursor, base, category, site_hand_no, gametype_id, hand_start_time
|
||||||
|
@ -69,8 +70,10 @@ def ring_holdem_omaha(config, backend, db, cursor, base, category, site_hand_no,
|
||||||
"""stores a holdem/omaha hand into the database"""
|
"""stores a holdem/omaha hand into the database"""
|
||||||
|
|
||||||
import_options = config.get_import_parameters()
|
import_options = config.get_import_parameters()
|
||||||
saveActions = True if import_options['saveActions'] == 'True' else False
|
saveActions = False if import_options['saveActions'] == 'False' else True
|
||||||
fastStoreHudCache = True if import_options['fastStoreHudCache'] == 'True' else False
|
fastStoreHudCache = False if import_options['fastStoreHudCache'] == 'False' else True
|
||||||
|
|
||||||
|
# print "DEBUG: saveActions = '%s' fastStoreHudCache = '%s'"%(saveActions, fastStoreHudCache)
|
||||||
|
|
||||||
t0 = time()
|
t0 = time()
|
||||||
fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits)
|
fpdb_simple.fillCardArrays(len(names), base, category, card_values, card_suits)
|
||||||
|
|
|
@ -29,6 +29,7 @@ MYSQL_INNODB = 2
|
||||||
PGSQL = 3
|
PGSQL = 3
|
||||||
SQLITE = 4
|
SQLITE = 4
|
||||||
|
|
||||||
|
|
||||||
# Data Structures for index and foreign key creation
|
# Data Structures for index and foreign key creation
|
||||||
# drop_code is an int with possible values: 0 - don't drop for bulk import
|
# drop_code is an int with possible values: 0 - don't drop for bulk import
|
||||||
# 1 - drop during bulk import
|
# 1 - drop during bulk import
|
||||||
|
@ -714,7 +715,7 @@ def filterCrap(site, hand, isTourney):
|
||||||
hand[i] = False
|
hand[i] = False
|
||||||
elif (hand[i].find(": ")!=-1 and site=="ftp" and hand[i].find("Seat ")==-1 and hand[i].find(": Table")==-1): #filter ftp chat
|
elif (hand[i].find(": ")!=-1 and site=="ftp" and hand[i].find("Seat ")==-1 and hand[i].find(": Table")==-1): #filter ftp chat
|
||||||
hand[i] = False
|
hand[i] = False
|
||||||
if isTourney:
|
if isTourney and not hand[i] == False:
|
||||||
if (hand[i].endswith(" is sitting out") and (not hand[i].startswith("Seat "))):
|
if (hand[i].endswith(" is sitting out") and (not hand[i].startswith("Seat "))):
|
||||||
hand[i] = False
|
hand[i] = False
|
||||||
elif hand[i]:
|
elif hand[i]:
|
||||||
|
@ -1511,11 +1512,14 @@ def storeActions(cursor, handsPlayersIds, actionTypes, allIns, actionAmounts, ac
|
||||||
#stores into table hands_actions
|
#stores into table hands_actions
|
||||||
#print "start of storeActions, actionNos:",actionNos
|
#print "start of storeActions, actionNos:",actionNos
|
||||||
#print " action_amounts:",action_amounts
|
#print " action_amounts:",action_amounts
|
||||||
|
inserts = []
|
||||||
for i in xrange(len(actionTypes)): #iterate through streets
|
for i in xrange(len(actionTypes)): #iterate through streets
|
||||||
for j in xrange(len(actionTypes[i])): #iterate through names
|
for j in xrange(len(actionTypes[i])): #iterate through names
|
||||||
for k in xrange(len(actionTypes[i][j])): #iterate through individual actions of that player on that street
|
for k in xrange(len(actionTypes[i][j])): #iterate through individual actions of that player on that street
|
||||||
cursor.execute ("INSERT INTO HandsActions (handPlayerId, street, actionNo, action, allIn, amount) VALUES (%s, %s, %s, %s, %s, %s)"
|
# Add inserts into a list and let
|
||||||
, (handsPlayersIds[j], i, actionNos[i][j][k], actionTypes[i][j][k], allIns[i][j][k], actionAmounts[i][j][k]))
|
inserts = inserts + [(handsPlayersIds[j], i, actionNos[i][j][k], actionTypes[i][j][k], allIns[i][j][k], actionAmounts[i][j][k])]
|
||||||
|
|
||||||
|
cursor.executemany("INSERT INTO HandsActions (handPlayerId, street, actionNo, action, allIn, amount) VALUES (%s, %s, %s, %s, %s, %s)", inserts)
|
||||||
#end def storeActions
|
#end def storeActions
|
||||||
|
|
||||||
def store_board_cards(cursor, hands_id, board_values, board_suits):
|
def store_board_cards(cursor, hands_id, board_values, board_suits):
|
||||||
|
|
|
@ -4,7 +4,10 @@ from Hand import *
|
||||||
import py
|
import py
|
||||||
|
|
||||||
#regression-test-files/stars/badugi/ring-fl-badugi.txt
|
#regression-test-files/stars/badugi/ring-fl-badugi.txt
|
||||||
# s0rrow: start $30.00 end: $22.65 total: ($7.35)
|
# s0rrow: input: $30.00 end: $22.65 total: ($7.35)
|
||||||
|
#regression-test-files/stars/plo/PLO-6max.txt
|
||||||
|
# s0rrow: input: $18.35 end: $0 total: ($18.35)
|
||||||
|
# Notes: last hand #25975302416 s0rrow aifp against 2 players
|
||||||
|
|
||||||
gametype = {'type':'ring', 'base':'draw', 'category':'badugi', 'limitType':'fl', 'sb':'0.25', 'bb':'0.50','currency':'USD'}
|
gametype = {'type':'ring', 'base':'draw', 'category':'badugi', 'limitType':'fl', 'sb':'0.25', 'bb':'0.50','currency':'USD'}
|
||||||
text = ""
|
text = ""
|
||||||
|
@ -30,7 +33,10 @@ def testGameInfo():
|
||||||
{'type':'ring', 'base':'hold', 'category':'omahahilo', 'limitType':'fl', 'sb':'2', 'bb':'4','currency':'USD'}),
|
{'type':'ring', 'base':'hold', 'category':'omahahilo', 'limitType':'fl', 'sb':'2', 'bb':'4','currency':'USD'}),
|
||||||
|
|
||||||
(u"PokerStars Game #25923772706: Badugi Limit ($0.25/$0.50) - 2009/03/13 16:40:58 ET",
|
(u"PokerStars Game #25923772706: Badugi Limit ($0.25/$0.50) - 2009/03/13 16:40:58 ET",
|
||||||
{'type':'ring', 'base':'draw', 'category':'badugi', 'limitType':'fl', 'sb':'0.25', 'bb':'0.50','currency':'USD'})
|
{'type':'ring', 'base':'draw', 'category':'badugi', 'limitType':'fl', 'sb':'0.25', 'bb':'0.50','currency':'USD'}),
|
||||||
|
|
||||||
|
(u"PokerStars Game #25974627364: Omaha Pot Limit ($0.05/$0.10) - 2009/03/15 0:29:00 ET",
|
||||||
|
{'type':'ring', 'base':'hold', 'category':'omahahi', 'limitType':'pl', 'sb':'0.05', 'bb':'0.10','currency':'USD'})
|
||||||
)
|
)
|
||||||
for (header, info) in pairs:
|
for (header, info) in pairs:
|
||||||
yield checkGameInfo, hhc, header, info
|
yield checkGameInfo, hhc, header, info
|
||||||
|
|
Loading…
Reference in New Issue
Block a user