diff --git a/pyfpdb/OnGameToFpdb.py b/pyfpdb/OnGameToFpdb.py index fd5efe31..f51995d0 100755 --- a/pyfpdb/OnGameToFpdb.py +++ b/pyfpdb/OnGameToFpdb.py @@ -42,10 +42,10 @@ class OnGame(HandHistoryConverter): siteId = 5 # Needs to match id entry in Sites database mixes = { } # Legal mixed games - sym = {'USD': "\$", 'CAD': "\$", 'T$': "", "EUR": u"\u20ac", "GBP": "\xa3"} # ADD Euro, Sterling, etc HERE + sym = {'USD': "\$", 'CAD': "\$", 'T$': "", "EUR": u"\u20ac", "GBP": "\xa3"} substitutions = { 'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes - 'LS' : u"\$|\xe2\x82\xac|\u20ac" # legal currency symbols - Euro(cp1252, utf-8) + 'LS' : u"\$|\xe2\x82\xac|\u20ac" # legal currency symbols - Euro(cp1252, utf-8) } currencies = { u'\u20ac':'EUR', u'\xe2\x82\xac':'EUR', '$':'USD', '':'T$' } @@ -71,9 +71,11 @@ class OnGame(HandHistoryConverter): #TODO: detect play money # "Play money" rather than "Real money" and set currency accordingly re_HandInfo = re.compile(u""" - \*\*\*\*\*\sHistory\sfor\shand\s(?P[-A-Z\d]+).* + \*\*\*\*\*\sHistory\sfor\shand\s(?P[-A-Z\d]+) + (\s\(TOURNAMENT:\s"NL\sHoldem",\s(?P[-A-Z\d]+),\sbuy-in:\s[%(LS)s](?P\d+))? + .* Start\shand:\s(?P.*) - Table:\s(\[SPEED\]\s)?(?P[-\'\w\s\.]+)\s\[\d+\]\s\( + Table:\s(\[SPEED\]\s)?(?P
[-\'\w\#\s\.]+)\s\[\d+\]\s\( ( (?PNO_LIMIT|Limit|LIMIT|Pot\sLimit|POT_LIMIT)\s (?PTEXAS_HOLDEM|OMAHA_HI|SEVEN_CARD_STUD|SEVEN_CARD_STUD_HI_LO|RAZZ|FIVE_CARD_DRAW)\s @@ -99,6 +101,7 @@ class OnGame(HandHistoryConverter): #Seat 1: .Lucchess ($4.17 in chips) #Seat 1: phantomaas ($27.11) #Seat 5: mleo17 ($9.37) + #Seat 2: Montferat (1500) re_PlayerInfo = re.compile(u'Seat (?P[0-9]+):\s(?P.*)\s\((%(LS)s)?(?P[.0-9]+)\)' % substitutions) def compilePlayerRegexs(self, hand): @@ -146,6 +149,7 @@ class OnGame(HandHistoryConverter): ["ring", "hold", "nl"], ["ring", "stud", "fl"], ["ring", "draw", "fl"], + ["tour", "hold", "nl"], ] def determineGameType(self, handText): @@ -164,6 +168,9 @@ class OnGame(HandHistoryConverter): #print "DEBUG: mg: %s" % mg info['type'] = 'ring' + if mg['TID'] != None: + info['type'] = 'tour' + if 'CURRENCY' in mg: info['currency'] = self.currencies[mg['CURRENCY']] @@ -216,6 +223,10 @@ class OnGame(HandHistoryConverter): # Need to remove non-alphanumerics for MySQL hand.handid = hand.handid.replace('R','') hand.handid = hand.handid.replace('-','') + if key == 'TID': + hand.tourNo = info[key] + if key == 'BUYIN': + hand.buyin = info[key] if key == 'TABLE': hand.tablename = info[key]