From 07b765482d0080873159054274ee85a72255d51b Mon Sep 17 00:00:00 2001 From: Worros Date: Tue, 27 Jan 2009 16:22:15 +0900 Subject: [PATCH 1/3] Added prelim Betfair parser. Straight copy of the current Everleaf parser --- pyfpdb/BetfairToFpdb.py | 209 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 209 insertions(+) create mode 100755 pyfpdb/BetfairToFpdb.py diff --git a/pyfpdb/BetfairToFpdb.py b/pyfpdb/BetfairToFpdb.py new file mode 100755 index 00000000..6fd6b984 --- /dev/null +++ b/pyfpdb/BetfairToFpdb.py @@ -0,0 +1,209 @@ +#!/usr/bin/env python +# -*- coding: iso-8859-15 -*- +# Copyright 2008, Carl Gherardi +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# 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 General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +######################################################################## + +import sys +import Configuration +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