From 9d7395a61c6a6b8c9ba4a9ab3b3b156e9c6dda36 Mon Sep 17 00:00:00 2001 From: eblade Date: Wed, 11 Mar 2009 23:10:31 -0400 Subject: [PATCH 01/14] unbreak psuedo-recursion --- pyfpdb/fpdb_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index d86c4214..54b48dee 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -200,7 +200,7 @@ class Importer: self.updated[file] = time() # If modified in the last minute run an immediate import. # This codepath only runs first time the file is found. - if (time() - stat_info.st_mtime) < 60: + if os.path.isdir(file) or (time() - stat_info.st_mtime) < 60: # TODO attach a HHC thread to the file # TODO import the output of the HHC thread -- this needs to wait for the HHC to block? self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1]) From ff675fb3aea6282ba82eae564045e018996ac4a7 Mon Sep 17 00:00:00 2001 From: Matt Turnbull Date: Thu, 12 Mar 2009 03:15:34 +0000 Subject: [PATCH 02/14] import working? --- pyfpdb/Hand.py | 4 ---- pyfpdb/fpdb_import.py | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index f77b9425..9591525e 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -102,10 +102,6 @@ If a player has None chips he won't be added.""" else: logging.error("markstreets didn't match") -#def addHoleCards -- to Holdem subclass - - - def checkPlayerExists(self,player): if player not in [p[1] for p in self.players]: print "checkPlayerExists", player, "fail" diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index d86c4214..15c25ac8 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -252,9 +252,9 @@ class Importer: supp = conv.readSupportedGames() # Should this be done by HHC on init? #gt = conv.determineGameType() # TODO: Check that gt is in supp - error appropriately if not - conv.processFile() + #conv.processFile() if(conv.getStatus()): - (stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(conv.getProcessedFile(), site) + (stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(out_path, site) else: # conversion didn't work # TODO: appropriate response? From cd3d4ef835d90fb4d0f517b3d48dd2309e38206a Mon Sep 17 00:00:00 2001 From: Matt Turnbull Date: Thu, 12 Mar 2009 03:58:42 +0000 Subject: [PATCH 03/14] no longer 'safely' appends -- will now overwrite out_path. --- pyfpdb/HandHistoryConverter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index 7ed679a4..a627766e 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -90,7 +90,7 @@ class HandHistoryConverter(threading.Thread): else: # TODO: out_path should be sanity checked before opening. Perhaps in fpdb_import? # I'm not sure what we're looking for, although we don't want out_path==in_path!='-' - self.out_fh = open(self.out_path, 'a') #TODO: append may be overly conservative. + self.out_fh = open(self.out_path, 'w') # doomswitch is now on :| self.sitename = sitename self.follow = follow self.compiledPlayers = set() From fbbd2c4d5cc0d7b795b85b8ba547eb3f91393a1a Mon Sep 17 00:00:00 2001 From: eblade Date: Thu, 12 Mar 2009 00:10:34 -0400 Subject: [PATCH 04/14] asdfsadfsadfasdfsadf --- pyfpdb/Database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 11038a68..4abac8ec 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -149,7 +149,7 @@ class Database: cv = "card%dValue" % i if cv not in d or d[cv] == None: break - elif d[key] == 0: + elif d[cv] == 0: cards += "xx" else: cs = "card%dSuit" % i From 02c5cfb39eff8f5c2c054f8078805c58d4640ca3 Mon Sep 17 00:00:00 2001 From: eblade Date: Thu, 12 Mar 2009 01:18:31 -0400 Subject: [PATCH 05/14] remove call to hhc.processFile as someone removed that function --- pyfpdb/fpdb_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index 54b48dee..6adf3ec4 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -252,7 +252,7 @@ class Importer: supp = conv.readSupportedGames() # Should this be done by HHC on init? #gt = conv.determineGameType() # TODO: Check that gt is in supp - error appropriately if not - conv.processFile() +# conv.processFile() if(conv.getStatus()): (stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(conv.getProcessedFile(), site) else: From 76ca6beab01857647aaa1fd775af76807652026c Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 12 Mar 2009 15:17:46 +0900 Subject: [PATCH 06/14] Update Betfair importer a bit No longer crashes on test file, but doesn't actually import anything yet. --- pyfpdb/BetfairToFpdb.py | 253 +++++++++++++++++++++------------------ pyfpdb/FulltiltToFpdb.py | 1 - 2 files changed, 138 insertions(+), 116 deletions(-) diff --git a/pyfpdb/BetfairToFpdb.py b/pyfpdb/BetfairToFpdb.py index 6fd6b984..a4420434 100755 --- a/pyfpdb/BetfairToFpdb.py +++ b/pyfpdb/BetfairToFpdb.py @@ -1,5 +1,6 @@ #!/usr/bin/env python -# -*- coding: iso-8859-15 -*- +# -*- coding: utf-8 -*- +# # Copyright 2008, Carl Gherardi # # This program is free software; you can redistribute it and/or modify @@ -18,111 +19,103 @@ ######################################################################## import sys -import Configuration +import logging from HandHistoryConverter import * # Betfair HH format -#***** Betfair Poker Hand History for Game 466894418 ***** -#NL $0.02/$0.04 Texas Hold'em - Tuesday, January 13, 18:58:55 GMT 2009 -#Table Rookie 102 6-max (Real Money) -#Seat 1 is the button -#Total number of active players : 3 -#Seat 1: wilco16 ( $5.12 ) -#Seat 2: fredo2003 ( $6.12 ) -#Seat 4: Didlidaa ( $3.61 ) -#Seat 5: Heck ( $4.47 ) -#Seat 6: MoDDe200009 ( $0 ) -#Didlidaa posts big blind [$0.04] -#** Dealing down cards ** -#Heck calls [$0.04] -#wilco16 calls [$0.04] -#Didlidaa checks -#** Dealing Flop ** [ 2c, Kd, Jh ] -#Didlidaa checks -#Heck checks -#wilco16 checks -#** Dealing Turn ** [ 5c ] -#Didlidaa checks -#Heck bets [$0.12] -#wilco16 folds -#Didlidaa calls [$0.12] -#** Dealing River ** [ Kc ] -#Didlidaa checks -#Heck bets [$0.18] -#Didlidaa calls [$0.18] -#** Showdown ** -#Heck shows [ Qs, 6c ] a pair of Kings -#Didlidaa shows [ Ad, 5h ] two pair, Kings and Fives -#** Hand Conclusion ** -#Didlidaa wins $0.69 from main pot with two pair, Kings and Fives -#************ Game 466894418 ends ************ - - class Betfair(HandHistoryConverter): - def __init__(self, config, file): - print "Initialising Betfair converter class" - HandHistoryConverter.__init__(self, config, file, sitename="Betfair") # Call super class init. - self.sitename = "Betfair" - self.setFileType("text", "cp1252") - self.rexx.setGameInfoRegex('.*Blinds \$?(?P[.0-9]+)/\$?(?P[.0-9]+)') - self.rexx.setSplitHandRegex('\n\n+') - self.rexx.setHandInfoRegex('.*#(?P[0-9]+)\n.*\nBlinds \$?(?P[.0-9]+)/\$?(?P[.0-9]+) (?P.*) - (?P\d\d\d\d/\d\d/\d\d - \d\d:\d\d:\d\d)\nTable (?P[ a-zA-Z]+)\nSeat (?P
[ a-zA-Z]+)\nSeat (?P
[ a-zA-Z]+)\nSeat (?P
[ a-zA-Z0-9]+) \d-max \(Real Money\)\nSeat (?P
[ a-zA-Z0-9]+) \d-max \(Real Money\)\nSeat (?P