diff --git a/pyfpdb/CarbonToFpdb.py b/pyfpdb/CarbonToFpdb.py
new file mode 100644
index 00000000..cf9fc8d3
--- /dev/null
+++ b/pyfpdb/CarbonToFpdb.py
@@ -0,0 +1,109 @@
+#!/usr/bin/env python
+# 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
+
+########################################################################
+
+# Standard Library modules
+import Configuration
+import traceback
+import sys
+import re
+import xml.dom.minidom
+from xml.dom.minidom import Node
+from HandHistoryConverter import HandHistoryConverter
+
+# Carbon format looks like:
+
+# 1)
+# 2)
+# 3)
+#
+# ...
+# 4)
+#
+#
+# 5)
+#
+# 6)
+#
+# ....
+#
+
+# The full sequence for a NHLE cash game is:
+# BLINDS, PREFLOP, POSTFLOP, POSTTURN, POSTRIVER, SHOWDOWN, END_OF_GAME
+# This sequence can be terminated after BLINDS at any time by END_OF_FOLDED_GAME
+
+
+class CarbonPoker(HandHistoryConverter):
+ def __init__(self, config, filename):
+ print "Initialising Carbon Poker converter class"
+ HandHistoryConverter.__init__(self, config, filename, "Carbon") # Call super class init
+ self.setFileType("xml")
+
+ def readSupportedGames(self):
+ pass
+ def determineGameType(self):
+ gametype = []
+ desc_node = self.doc.getElementsByTagName("description")
+ #TODO: no examples of non ring type yet
+ gametype = gametype + ["ring"]
+ type = desc_node[0].getAttribute("type")
+ if(type == "Holdem"):
+ gametype = gametype + ["hold"]
+ else:
+ print "Unknown gametype: '%s'" % (type)
+
+ stakes = desc_node[0].getAttribute("stakes")
+ #TODO: no examples of anything except nlhe
+ m = re.match('(?PNo Limit)\s\(\$?(?P[.0-9]+)/\$?(?P[.0-9]+)\)', stakes)
+
+ if(m.group('LIMIT') == "No Limit"):
+ gametype = gametype + ["nl"]
+
+ gametype = gametype + [self.float2int(m.group('SB'))]
+ gametype = gametype + [self.float2int(m.group('BB'))]
+
+ return gametype
+
+ def readPlayerStacks(self):
+ pass
+ def readBlinds(self):
+ pass
+ def readAction(self):
+ pass
+
+ # Override read function as xml.minidom barfs on the Carbon layout
+ # This is pretty dodgy
+ def readFile(self, filename):
+ print "Carbon: Reading file: '%s'" %(filename)
+ infile=open(filename, "rU")
+ self.obs = infile.read()
+ infile.close()
+ self.obs = "\n" + self.obs + ""
+ try:
+ doc = xml.dom.minidom.parseString(self.obs)
+ self.doc = doc
+ except:
+ traceback.print_exc(file=sys.stderr)
+
+if __name__ == "__main__":
+ c = Configuration.Config()
+ e = CarbonPoker(c, "regression-test-files/carbon-poker/Niagara Falls (15245216).xml")
+ e.processFile()
+ print str(e)
+
diff --git a/pyfpdb/CliFpdb.py b/pyfpdb/CliFpdb.py
index 47649728..4e2a4361 100755
--- a/pyfpdb/CliFpdb.py
+++ b/pyfpdb/CliFpdb.py
@@ -53,7 +53,7 @@ if __name__ == "__main__":
(options, sys.argv) = parser.parse_args()
- settings={'imp-callFpdbHud':False, 'db-backend':2}
+ settings={'callFpdbHud':False, 'db-backend':2}
settings['db-host']=options.server
settings['db-user']=options.user
settings['db-password']=options.password
diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py
index f013da54..99582935 100755
--- a/pyfpdb/Configuration.py
+++ b/pyfpdb/Configuration.py
@@ -178,11 +178,12 @@ class Popup:
class Import:
def __init__(self, node):
- self.interval = node.getAttribute("interval")
- self.callFpdbHud = node.getAttribute("callFpdbHud")
+ self.interval = node.getAttribute("interval")
+ self.callFpdbHud = node.getAttribute("callFpdbHud")
+ self.hhArchiveBase = node.getAttribute("hhArchiveBase")
def __str__(self):
- return " interval = %s\n callFpdbHud = %s\n" % (self.interval, self.callFpdbHud)
+ return " interval = %s\n callFpdbHud = %s\n hhArchiveBase = %s" % (self.interval, self.callFpdbHud, self.hhArchiveBase)
class Tv:
def __init__(self, node):
@@ -437,11 +438,13 @@ class Config:
def get_import_parameters(self):
imp = {}
try:
- imp['imp-callFpdbHud'] = self.imp.callFpdbHud
- imp['hud-defaultInterval'] = int(self.imp.interval)
- except: # Default import parameters
- imp['imp-callFpdbHud'] = True
- imp['hud-defaultInterval'] = 10
+ imp['callFpdbHud'] = self.callFpdbHud
+ imp['interval'] = self.interval
+ imp['hhArchiveBase'] = self.hhArchiveBase
+ except: # Default params
+ imp['callFpdbHud'] = True
+ imp['interval'] = 10
+ imp['hhArchiveBase'] = "~/.fpdb/HandHistories/"
return imp
def get_default_paths(self, site = "PokerStars"):
@@ -565,7 +568,9 @@ if __name__== "__main__":
print "----------- END MUCKED WINDOW FORMATS -----------"
print "\n----------- IMPORT -----------"
-# print c.imp
+ tmp = c.get_import_parameters()
+ for param in tmp:
+ print " " + str(param) + ": " + str(tmp[param])
print "----------- END IMPORT -----------"
print "\n----------- TABLE VIEW -----------"
diff --git a/pyfpdb/EverleafToFpdb.py b/pyfpdb/EverleafToFpdb.py
index 9f6b760b..277e85fd 100644
--- a/pyfpdb/EverleafToFpdb.py
+++ b/pyfpdb/EverleafToFpdb.py
@@ -16,25 +16,117 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
########################################################################
-from HandHistoryConverter import HandHistoryConverter
+import sys
+import Configuration
+from HandHistoryConverter import *
+
+# Everleaf HH format
+
+#Everleaf Gaming Game #55198191
+#***** Hand history for game #55198191 *****
+#Blinds $0.50/$1 NL Hold'em - 2008/09/01 - 10:02:11
+#Table Speed Kuala
+#Seat 8 is the button
+#Total number of players: 10
+#Seat 1: spicybum ( $ 77.50 USD )
+#Seat 2: harrydebeng ( new player )
+#Seat 3: EricBlade ( new player )
+#Seat 4: dollar_hecht ( $ 16.40 USD )
+#Seat 5: Apolon76 ( $ 154.10 USD )
+#Seat 6: dogge ( new player )
+#Seat 7: RonKoro ( $ 25.53 USD )
+#Seat 8: jay68w ( $ 48.50 USD )
+#Seat 9: KillerQueen1 ( $ 51.28 USD )
+#Seat 10: Cheburashka ( $ 49.61 USD )
+#KillerQueen1: posts small blind [$ 0.50 USD]
+#Cheburashka: posts big blind [$ 1 USD]
+#** Dealing down cards **
+#spicybum folds
+#dollar_hecht calls [$ 1 USD]
+#Apolon76 folds
+#RonKoro folds
+#jay68w raises [$ 4.50 USD]
+#KillerQueen1 folds
+#Cheburashka folds
+#dollar_hecht folds
+#jay68w does not show cards
+#jay68w wins $ 3.50 USD from main pot
+
+
class Everleaf(HandHistoryConverter):
- def __init__(self):
+ def __init__(self, config, file):
print "Initialising Everleaf converter class"
+ HandHistoryConverter.__init__(self, config, file, "Everleaf") # Call super class init.
+ self.sitename = "Everleaf"
+ self.setFileType("text")
+ self.rexx.setGameInfoRegex('.*Blinds \$?(?P[.0-9]+)/\$?(?P[.0-9]+)')
+ self.rexx.setSplitHandRegex('\n\n\n\n')
+ self.rexx.setHandInfoRegex('.*#(?P[0-9]+)\n.*\nBlinds \$?(?P[.0-9]+)/\$?(?P[.0-9]+) (?P.*) - (?P[0-9]+)/(?P[0-9]+)/(?P[0-9]+) - (?P
[0-9]+):(?P[0-9]+):(?P[0-9]+)\nTable (?P[ a-zA-Z]+)\nSeat (?P