More Everleaf converter updates, now parsing some hand info
This commit is contained in:
parent
6de1ac1c82
commit
816a9e3b58
|
@ -60,7 +60,8 @@ class Everleaf(HandHistoryConverter):
|
||||||
self.sitename = "Everleaf"
|
self.sitename = "Everleaf"
|
||||||
self.setFileType("text")
|
self.setFileType("text")
|
||||||
self.rexx.setGameInfoRegex('.*Blinds \$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+)')
|
self.rexx.setGameInfoRegex('.*Blinds \$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+)')
|
||||||
self.rexx.setSplitHandRegex('\n\n\n')
|
self.rexx.setSplitHandRegex('\n\n\n\n')
|
||||||
|
self.rexx.setHandInfoRegex('.*#(?P<HID>[0-9]+)\n.*\nBlinds \$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+) (?P<GAMETYPE>.*) - (?P<YEAR>[0-9]+)/(?P<MON>[0-9]+)/(?P<DAY>[0-9]+) - (?P<HR>[0-9]+):(?P<MIN>[0-9]+):(?P<SEC>[0-9]+)\nTable (?P<TABLE>[ a-zA-Z]+)')
|
||||||
self.rexx.compileRegexes()
|
self.rexx.compileRegexes()
|
||||||
|
|
||||||
def readSupportedGames(self):
|
def readSupportedGames(self):
|
||||||
|
@ -76,6 +77,25 @@ class Everleaf(HandHistoryConverter):
|
||||||
|
|
||||||
return gametype
|
return gametype
|
||||||
|
|
||||||
|
def readHandInfo(self, hand):
|
||||||
|
m = self.rexx.hand_info_re.search(hand.string)
|
||||||
|
hand.handid = m.group('HID')
|
||||||
|
hand.tablename = m.group('GAMETYPE')
|
||||||
|
# These work, but the info is already in the Hand class - should be usecd for tourneys though.
|
||||||
|
# m.group('SB')
|
||||||
|
# m.group('BB')
|
||||||
|
# m.group('GAMETYPE')
|
||||||
|
|
||||||
|
# Believe Everleaf time is GMT/UTC, no transation necessary
|
||||||
|
# Stars format (Nov 10 2008): 2008/11/07 12:38:49 UTC [2008/11/07 7:38:49 ET]
|
||||||
|
# Not getting it in my HH files yet, so using
|
||||||
|
# 2008/11/10 3:58:52 ET
|
||||||
|
#TODO: Do conversion from GMT to ET
|
||||||
|
#TODO: Need some date functions to convert to different timezones (Date::Manip for perl rocked for this)
|
||||||
|
hand.starttime = "%d/%02d/%02d %d:%02d:%02d ET" %(int(m.group('YEAR')), int(m.group('MON')), int(m.group('DAY')),
|
||||||
|
int(m.group('HR')), int(m.group('MIN')), int(m.group('SEC')))
|
||||||
|
|
||||||
|
|
||||||
def readPlayerStacks(self):
|
def readPlayerStacks(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,9 @@ class HandHistoryConverter:
|
||||||
self.readFile(self.file)
|
self.readFile(self.file)
|
||||||
self.gametype = self.determineGameType()
|
self.gametype = self.determineGameType()
|
||||||
self.hands = self.splitFileIntoHands()
|
self.hands = self.splitFileIntoHands()
|
||||||
|
for hand in self.hands:
|
||||||
|
self.readHandInfo(hand)
|
||||||
|
self.writeHand("output file", hand)
|
||||||
|
|
||||||
# Functions to be implemented in the inheriting class
|
# Functions to be implemented in the inheriting class
|
||||||
def readSupportedGames(self): abstract
|
def readSupportedGames(self): abstract
|
||||||
|
@ -70,6 +73,7 @@ class HandHistoryConverter:
|
||||||
# [ ring, hold, nl , sb, bb ]
|
# [ ring, hold, nl , sb, bb ]
|
||||||
# Valid types specified in docs/tabledesign.html in Gametypes
|
# Valid types specified in docs/tabledesign.html in Gametypes
|
||||||
def determineGameType(self): abstract
|
def determineGameType(self): abstract
|
||||||
|
def readHandInfo(self, hand): abstract
|
||||||
def readPlayerStacks(self): abstract
|
def readPlayerStacks(self): abstract
|
||||||
def readBlinds(self): abstract
|
def readBlinds(self): abstract
|
||||||
def readAction(self): abstract
|
def readAction(self): abstract
|
||||||
|
@ -102,7 +106,9 @@ class HandHistoryConverter:
|
||||||
def splitFileIntoHands(self):
|
def splitFileIntoHands(self):
|
||||||
hands = []
|
hands = []
|
||||||
list = self.rexx.split_hand_re.split(self.obs)
|
list = self.rexx.split_hand_re.split(self.obs)
|
||||||
|
list.pop() #Last entry is empty
|
||||||
for l in list:
|
for l in list:
|
||||||
|
# print "'" + l + "'"
|
||||||
hands = hands + [Hand(self.sitename, self.gametype, l)]
|
hands = hands + [Hand(self.sitename, self.gametype, l)]
|
||||||
return hands
|
return hands
|
||||||
|
|
||||||
|
@ -122,8 +128,8 @@ class HandHistoryConverter:
|
||||||
|
|
||||||
def writeHand(self, file, hand):
|
def writeHand(self, file, hand):
|
||||||
"""Write out parsed data"""
|
"""Write out parsed data"""
|
||||||
# print sitename + " Game #" + handid + ": " + gametype + " (" + sb + "/" + bb + " - " + starttime
|
print "%s Game #%s: %s (%d/%d) - %s" %(hand.sitename, hand.handid, "XXXXhand.gametype", hand.sb, hand.bb, hand.starttime)
|
||||||
# print "Table '" + tablename + "' " + maxseats + "-max Seat #" + buttonpos + " is the button"
|
print "Table '%s' %d-max Seat #%s is the button" %(hand.tablename, hand.maxseats, "XXXXhand.buttonpos")
|
||||||
#
|
#
|
||||||
# counter = 1
|
# counter = 1
|
||||||
# for player in seating:
|
# for player in seating:
|
||||||
|
@ -132,12 +138,12 @@ class HandHistoryConverter:
|
||||||
# print playername + ": posts small blind " + sb
|
# print playername + ": posts small blind " + sb
|
||||||
# print playername + ": posts big blind " + bb
|
# print playername + ": posts big blind " + bb
|
||||||
#
|
#
|
||||||
# print "*** HOLE CARDS ***"
|
print "*** HOLE CARDS ***"
|
||||||
# print "Dealt to " + hero + " [" + holecards + "]"
|
# print "Dealt to " + hero + " [" + holecards + "]"
|
||||||
#
|
#
|
||||||
## ACTION STUFF
|
## ACTION STUFF
|
||||||
#
|
#
|
||||||
# print "*** SUMMARY ***"
|
print "*** SUMMARY ***"
|
||||||
# print "Total pot $" + totalpot + " | Rake $" + rake
|
# print "Total pot $" + totalpot + " | Rake $" + rake
|
||||||
# print "Board [" + boardcards + "]"
|
# print "Board [" + boardcards + "]"
|
||||||
#
|
#
|
||||||
|
@ -166,7 +172,9 @@ class Hand:
|
||||||
self.gametype = gametype
|
self.gametype = gametype
|
||||||
self.string = string
|
self.string = string
|
||||||
|
|
||||||
self.handid = None
|
self.handid = 0
|
||||||
|
self.sb = gametype[3]
|
||||||
|
self.bb = gametype[4]
|
||||||
self.tablename = "Slartibartfast"
|
self.tablename = "Slartibartfast"
|
||||||
self.maxseats = 10
|
self.maxseats = 10
|
||||||
self.counted_seats = 0
|
self.counted_seats = 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user