Merge branch 'master' into siteneutral

This commit is contained in:
Worros 2009-03-14 05:32:16 +09:00
commit 3683a82e0f
6 changed files with 28 additions and 71 deletions

View File

@ -43,6 +43,7 @@ out_path (default '-' = sys.stdout)
follow : whether to tail -f the input
autostart: whether to run the thread (or you can call start() yourself)
debugging: if False, pass on partially supported game types. If true, have a go and error..."""
print "DEBUG: XXXXXXXXXXXXXXX"
HandHistoryConverter.__init__(self, in_path, out_path, sitename="Everleaf", follow=follow)
logging.info("Initialising Everleaf converter class")
self.filetype = "text"
@ -130,12 +131,10 @@ or None if we fail to get the info """
info['bb'] = mg['BB']
if 'CURRENCY' in mg:
info['currency'] = currencies[mg['CURRENCY']]
if info['currency'] == 'T$':
info['type'] = 'tour'
# NB: SB, BB must be interpreted as blinds or bets depending on limit type.
if not self.debugging and info['base']=='stud':
logging.warning("Not processing Everleaf Stud hand")
#return None
return info

View File

@ -22,9 +22,9 @@ import sys
import logging
from HandHistoryConverter import *
# FullTilt HH Format converter
# Fulltilt HH Format converter
class FullTilt(HandHistoryConverter):
class Fulltilt(HandHistoryConverter):
# Static regexes
re_GameInfo = re.compile('- (?P<CURRENCY>\$|)?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+) (Ante \$(?P<ANTE>[.0-9]+) )?- (?P<LIMIT>(No Limit|Pot Limit|Limit))? (?P<GAME>(Hold\'em|Omaha Hi|Razz))')
@ -39,8 +39,8 @@ class FullTilt(HandHistoryConverter):
in_path (default '-' = sys.stdin)
out_path (default '-' = sys.stdout)
follow : whether to tail -f the input"""
HandHistoryConverter.__init__(self, in_path, out_path, sitename="FullTilt", follow=follow)
logging.info("Initialising FullTilt converter class")
HandHistoryConverter.__init__(self, in_path, out_path, sitename="Fulltilt", follow=follow)
logging.info("Initialising Fulltilt converter class")
self.filetype = "text"
self.codepage = "cp1252"
if autostart:
@ -314,4 +314,4 @@ if __name__ == "__main__":
LOG_FILENAME = './logging.out'
logging.basicConfig(filename=LOG_FILENAME,level=options.verbosity)
e = FullTilt(in_path = options.ipath, out_path = options.opath, follow = options.follow)
e = Fulltilt(in_path = options.ipath, out_path = options.opath, follow = options.follow)

View File

@ -29,6 +29,7 @@ from Exceptions import *
class Hand:
UPS = {'a':'A', 't':'T', 'j':'J', 'q':'Q', 'k':'K', 'S':'s', 'C':'c', 'H':'h', 'D':'d'}
LCS = {'H':'h', 'D':'d', 'C':'c', 'S':'s'}
def __init__(self, sitename, gametype, handText):
self.sitename = sitename
self.gametype = gametype
@ -316,32 +317,6 @@ Map the tuple self.gametype onto the pokerstars string describing it
return retstring
def lookupLimitBetSize(self):
#Lookup table for limit games
betlist = {
"Everleaf" : { "0.10" : ("0.02", "0.05"),
"0.20" : ("0.05", "0.10"),
"0.50" : ("0.10", "0.25"),
"1" : ("0.25", "0.50"),
"2" : ("0.50", "1.00"),
"4" : ("1.00", "2.00"),
"6" : ("1.00", "3.00")
},
"FullTilt" : { "0.10" : ("0.02", "0.05"),
"0.20" : ("0.05", "0.10"),
"1" : ("0.25", "0.50"),
"2" : ("0.50", "1"),
"4" : ("1", "2")
}
}
try:
ret = betlist[self.sitename][self.bb]
except:
logging.warning("Don't know the small blind/big blind size for %s, big bet size %s." % (self.sitename, self.bb))
ret = (Decimal(self.sb)/2,Decimal(self.bb)/2)
return ret
def writeHand(self, fh=sys.__stdout__):
print >>fh, "Override me"
@ -449,23 +424,6 @@ Card ranks will be uppercased
#Only print stacks of players who do something preflop
print >>fh, _("Seat %s: %s ($%s in chips) " %(player[0], player[1], player[2]))
#May be more than 1 bb posting
if self.gametype['limitType'] == "fl":
(smallbet, bigbet) = self.lookupLimitBetSize()
else:
smallbet = self.sb
bigbet = self.bb
# for a in self.posted:
# if(a[1] == "small blind"):
# print >>fh, _("%s: posts small blind $%s" %(a[0], smallbet))
# if(a[1] == "big blind"):
# print >>fh, _("%s: posts big blind $%s" %(a[0], bigbet))
# if(a[1] == "both"):
# print >>fh, _("%s: posts small & big blinds $%.2f" %(a[0], (Decimal(smallbet) + Decimal(bigbet))))
# I think these can just be actions in 'blindsantes' round
if self.actions['BLINDSANTES']:
for act in self.actions['BLINDSANTES']:
self.printActionLine(act, fh)

View File

@ -43,11 +43,13 @@ import Configuration
import Stats
import Mucked
import Database
import HUD_main
import HUD_main
import Utils
def importName(module_name, name):
def importName(module_name, name, params):
"""Import a named object 'name' from module 'module_name'."""
# Recipe 16.3 in the Python Cookbook, 2nd ed. Thanks!!!!
# Modded by Carl G to support additional params
try:
module = __import__(module_name, globals(), locals(), [name])
except:

View File

@ -33,8 +33,6 @@ import fpdb_simple
import fpdb_db
import fpdb_parse_logic
import Configuration
import EverleafToFpdb
import FulltiltToFpdb
# database interface modules
try:
@ -228,7 +226,6 @@ class Importer:
conv = None
# Load filter, process file, pass returned filename to import_fpdb_file
# TODO: Shouldn't we be able to use some sort of lambda or something to just call a Python object by whatever name we specify? then we don't have to hardcode them,
print "converting %s" % file
hhbase = self.config.get_import_parameters().get("hhArchiveBase")
hhbase = os.path.expanduser(hhbase)
@ -238,21 +235,22 @@ class Importer:
except:
out_path = os.path.join(hhdir, "x"+strftime("%d-%m-%y")+os.path.basename(file))
# someone can just create their own python module for it
if filter in ("EverleafToFpdb","Everleaf"):
conv = EverleafToFpdb.Everleaf(in_path = file, out_path = out_path)
elif filter == "FulltiltToFpdb":
conv = FulltiltToFpdb.FullTilt(in_path = file, out_path = out_path)
filter_name = filter.replace("ToFpdb", "")
mod = __import__(filter)
obj = getattr(mod, filter_name, None)
if callable(obj):
conv = obj(in_path = file, out_path = out_path)
if(conv.getStatus()):
(stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(out_path, site)
else:
# conversion didn't work
# TODO: appropriate response?
return (0, 0, 0, 1, 0)
else:
print "Unknown filter ", filter
print "Unknown filter filter_name:'%s' in filter:'%s'" %(filter_name, filter)
return
if(conv.getStatus()):
(stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(out_path, site)
else:
# conversion didn't work
# TODO: appropriate response?
return (0, 0, 0, 1, 0)
#This will barf if conv.getStatus != True
return (stored, duplicates, partial, errors, ttime)

View File

@ -31,7 +31,7 @@ Blinds 10/20 NL Hold'em - 2009/02/25 - 17:30:32
Table 2
Seat 1 is the button
Total number of players: 10""",
{'type':'ring', 'base':"hold", 'category':'holdem', 'limitType':'nl', 'sb':'10', 'bb':'20', 'currency':'T$'}),
{'type':'tour', 'base':"hold", 'category':'holdem', 'limitType':'nl', 'sb':'10', 'bb':'20', 'currency':'T$'}),
("""Everleaf Gaming Game #65087798
***** Hand history for game #65087798 *****
@ -43,7 +43,7 @@ Table Plymouth""",
***** Hand history for game #65295370 *****
Blinds $0.50/$1 PL Omaha - 2008/12/07 - 21:59:48
Table Guanajuato""",
{'type':'ring', 'base':'hold', 'category':'omahahi', 'limitType':'pl', 'sb':'0.50', 'bb':'1','currency':'USD'})
{'type':'ring', 'base':'hold', 'category':'omahahi', 'limitType':'pl', 'sb':'0.50', 'bb':'1','currency':'USD'}),
)
for (header, info) in pairs: