Merge branch 'master' of git://git.assembla.com/fpdboz.git
This commit is contained in:
commit
f42912fd4c
|
@ -86,7 +86,7 @@ class Everleaf(HandHistoryConverter):
|
||||||
self.rexx.compileRegexes()
|
self.rexx.compileRegexes()
|
||||||
|
|
||||||
def readSupportedGames(self):
|
def readSupportedGames(self):
|
||||||
pass
|
return [["ring", "hold", "nl"]]
|
||||||
|
|
||||||
def determineGameType(self):
|
def determineGameType(self):
|
||||||
# Cheating with this regex, only support nlhe at the moment
|
# Cheating with this regex, only support nlhe at the moment
|
||||||
|
|
|
@ -88,7 +88,7 @@ class HandHistoryConverter:
|
||||||
self.hhbase = os.path.expanduser(self.hhbase)
|
self.hhbase = os.path.expanduser(self.hhbase)
|
||||||
self.hhdir = os.path.join(self.hhbase,sitename)
|
self.hhdir = os.path.join(self.hhbase,sitename)
|
||||||
self.gametype = []
|
self.gametype = []
|
||||||
# self.ofile = os.path.join(self.hhdir,file)
|
self.ofile = os.path.join(self.hhdir,file)
|
||||||
self.rexx = FpdbRegex.FpdbRegex()
|
self.rexx = FpdbRegex.FpdbRegex()
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -110,6 +110,7 @@ class HandHistoryConverter:
|
||||||
print "Cowardly refusing to continue after failed sanity check"
|
print "Cowardly refusing to continue after failed sanity check"
|
||||||
return
|
return
|
||||||
self.readFile(self.file)
|
self.readFile(self.file)
|
||||||
|
outfile = open(self.ofile, 'w')
|
||||||
self.gametype = self.determineGameType()
|
self.gametype = self.determineGameType()
|
||||||
self.hands = self.splitFileIntoHands()
|
self.hands = self.splitFileIntoHands()
|
||||||
for hand in self.hands:
|
for hand in self.hands:
|
||||||
|
@ -137,19 +138,22 @@ class HandHistoryConverter:
|
||||||
hand.totalPot()
|
hand.totalPot()
|
||||||
self.getRake(hand)
|
self.getRake(hand)
|
||||||
|
|
||||||
hand.writeHand(sys.stderr)
|
hand.writeHand(outfile)
|
||||||
#if(hand.involved == True):
|
#if(hand.involved == True):
|
||||||
#self.writeHand("output file", hand)
|
#self.writeHand("output file", hand)
|
||||||
#hand.printHand()
|
#hand.printHand()
|
||||||
#else:
|
#else:
|
||||||
#pass #Don't write out observed hands
|
#pass #Don't write out observed hands
|
||||||
|
|
||||||
|
outfile.close()
|
||||||
endtime = time.time()
|
endtime = time.time()
|
||||||
print "Processed %d hands in %d seconds" % (len(self.hands), endtime-starttime)
|
print "Processed %d hands in %d seconds" % (len(self.hands), endtime-starttime)
|
||||||
|
|
||||||
#####
|
#####
|
||||||
# These functions are parse actions that may be overridden by the inheriting class
|
# These functions are parse actions that may be overridden by the inheriting class
|
||||||
#
|
# This function should return a list of lists looking like:
|
||||||
|
# return [["ring", "hold", "nl"], ["tour", "hold", "nl"]]
|
||||||
|
# Showing all supported games limits and types
|
||||||
|
|
||||||
def readSupportedGames(self): abstract
|
def readSupportedGames(self): abstract
|
||||||
|
|
||||||
|
@ -259,3 +263,10 @@ class HandHistoryConverter:
|
||||||
result*=100
|
result*=100
|
||||||
return result
|
return result
|
||||||
#end def float2int
|
#end def float2int
|
||||||
|
|
||||||
|
def getStatus(self):
|
||||||
|
#TODO: Return a status of true if file processed ok
|
||||||
|
return True
|
||||||
|
|
||||||
|
def getProcessedFile(self):
|
||||||
|
return self.ofile
|
||||||
|
|
|
@ -361,7 +361,7 @@ def clean_title(name):
|
||||||
' \(deep hu\)', ' \(deep 6\)', ' \(2\)',
|
' \(deep hu\)', ' \(deep 6\)', ' \(2\)',
|
||||||
' \(edu\)', ' \(edu, 6 max\)', ' \(6\)',
|
' \(edu\)', ' \(edu, 6 max\)', ' \(6\)',
|
||||||
' \(speed\)',
|
' \(speed\)',
|
||||||
' no all-in', ' fast', ',', ' 50BB min', '\s+$']:
|
' no all-in', ' fast', ',', ' 50BB min', '50bb min', '\s+$']:
|
||||||
name = re.sub(pattern, '', name)
|
name = re.sub(pattern, '', name)
|
||||||
name = name.rstrip()
|
name = name.rstrip()
|
||||||
return name
|
return name
|
||||||
|
|
|
@ -33,6 +33,7 @@ import fpdb_simple
|
||||||
import fpdb_db
|
import fpdb_db
|
||||||
import fpdb_parse_logic
|
import fpdb_parse_logic
|
||||||
import Configuration
|
import Configuration
|
||||||
|
import EverleafToFpdb
|
||||||
|
|
||||||
# database interface modules
|
# database interface modules
|
||||||
try:
|
try:
|
||||||
|
@ -66,8 +67,10 @@ class Importer:
|
||||||
#Set defaults
|
#Set defaults
|
||||||
self.callHud = self.config.get_import_parameters().get("callFpdbHud")
|
self.callHud = self.config.get_import_parameters().get("callFpdbHud")
|
||||||
if 'minPrint' not in self.settings:
|
if 'minPrint' not in self.settings:
|
||||||
|
#TODO: Is this value in the xml file?
|
||||||
self.settings['minPrint'] = 30
|
self.settings['minPrint'] = 30
|
||||||
if 'handCount' not in self.settings:
|
if 'handCount' not in self.settings:
|
||||||
|
#TODO: Is this value in the xml file?
|
||||||
self.settings['handCount'] = 0
|
self.settings['handCount'] = 0
|
||||||
self.fdb = fpdb_db.fpdb_db() # sets self.fdb.db self.fdb.cursor and self.fdb.sql
|
self.fdb = fpdb_db.fpdb_db() # sets self.fdb.db self.fdb.cursor and self.fdb.sql
|
||||||
self.fdb.do_connect(self.config)
|
self.fdb.do_connect(self.config)
|
||||||
|
@ -185,8 +188,19 @@ class Importer:
|
||||||
if(filter == "passthrough"):
|
if(filter == "passthrough"):
|
||||||
(stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(file, site)
|
(stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(file, site)
|
||||||
else:
|
else:
|
||||||
# TODO: Load filter, and run filtered file though main importer
|
conv = None
|
||||||
(stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(file, site)
|
# Load filter, process file, pass returned filename to import_fpdb_file
|
||||||
|
if(filter == "EverleafToFpdb"):
|
||||||
|
conv = EverleafToFpdb(self.config, file)
|
||||||
|
|
||||||
|
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()
|
||||||
|
if(conv.getStatus()):
|
||||||
|
(stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(conv.getProcessedFile(ofile), site)
|
||||||
|
|
||||||
|
#This will barf if conv.getStatus != True
|
||||||
return (stored, duplicates, partial, errors, ttime)
|
return (stored, duplicates, partial, errors, ttime)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user