Merge branch 'master' of git://git.assembla.com/fpdboz
This commit is contained in:
		
						commit
						3490ec8091
					
				|  | @ -1930,100 +1930,99 @@ class Database: | |||
|         #print "DEBUG: %s %s %s" %(hid, pids, pdata) | ||||
|         inserts = [] | ||||
|         for p in pdata: | ||||
|             #NOTE: Insert new stats at right place because SQL needs strict order | ||||
|             line = [] | ||||
|             line = [0]*89 | ||||
| 
 | ||||
|             line.append(1)  # HDs | ||||
|             line.append(pdata[p]['street0VPI']) | ||||
|             line.append(pdata[p]['street0Aggr'])                  | ||||
|             line.append(pdata[p]['street0_3BChance'])             | ||||
|             line.append(pdata[p]['street0_3BDone'])               | ||||
|             line.append(pdata[p]['street0_4BChance'])             | ||||
|             line.append(pdata[p]['street0_4BDone'])               | ||||
|             line.append(pdata[p]['street0_FoldTo3BChance'])       | ||||
|             line.append(pdata[p]['street0_FoldTo3BDone'])         | ||||
|             line.append(pdata[p]['street0_FoldTo4BChance'])       | ||||
|             line.append(pdata[p]['street0_FoldTo4BDone'])         | ||||
|             line.append(pdata[p]['other3BStreet0'])               | ||||
|             line.append(pdata[p]['other4BStreet0'])               | ||||
|             line.append(pdata[p]['street1Seen'])                  | ||||
|             line.append(pdata[p]['street2Seen'])                  | ||||
|             line.append(pdata[p]['street3Seen'])                  | ||||
|             line.append(pdata[p]['street4Seen'])                  | ||||
|             line.append(pdata[p]['sawShowdown'])                  | ||||
|             line.append(pdata[p]['street1Aggr'])                  | ||||
|             line.append(pdata[p]['street2Aggr'])                  | ||||
|             line.append(pdata[p]['street3Aggr'])                  | ||||
|             line.append(pdata[p]['street4Aggr'])                  | ||||
|             line.append(pdata[p]['otherRaisedStreet0'])           | ||||
|             line.append(pdata[p]['otherRaisedStreet1'])           | ||||
|             line.append(pdata[p]['otherRaisedStreet2'])           | ||||
|             line.append(pdata[p]['otherRaisedStreet3'])           | ||||
|             line.append(pdata[p]['otherRaisedStreet4'])           | ||||
|             line.append(pdata[p]['foldToOtherRaisedStreet0'])     | ||||
|             line.append(pdata[p]['foldToOtherRaisedStreet1'])     | ||||
|             line.append(pdata[p]['foldToOtherRaisedStreet2'])     | ||||
|             line.append(pdata[p]['foldToOtherRaisedStreet3'])     | ||||
|             line.append(pdata[p]['foldToOtherRaisedStreet4'])     | ||||
|             line.append(pdata[p]['wonWhenSeenStreet1']) | ||||
|             line.append(pdata[p]['wonWhenSeenStreet2']) | ||||
|             line.append(pdata[p]['wonWhenSeenStreet3']) | ||||
|             line.append(pdata[p]['wonWhenSeenStreet4']) | ||||
|             line.append(pdata[p]['wonAtSD']) | ||||
|             line.append(pdata[p]['raiseFirstInChance'])           | ||||
|             line.append(pdata[p]['raisedFirstIn'])                | ||||
|             line.append(pdata[p]['foldBbToStealChance'])          | ||||
|             line.append(pdata[p]['foldedBbToSteal'])              | ||||
|             line.append(pdata[p]['foldSbToStealChance'])          | ||||
|             line.append(pdata[p]['foldedSbToSteal'])              | ||||
|             line.append(pdata[p]['street1CBChance'])              | ||||
|             line.append(pdata[p]['street1CBDone'])                | ||||
|             line.append(pdata[p]['street2CBChance'])              | ||||
|             line.append(pdata[p]['street2CBDone'])                | ||||
|             line.append(pdata[p]['street3CBChance'])              | ||||
|             line.append(pdata[p]['street3CBDone'])                | ||||
|             line.append(pdata[p]['street4CBChance'])              | ||||
|             line.append(pdata[p]['street4CBDone'])                | ||||
|             line.append(pdata[p]['foldToStreet1CBChance'])        | ||||
|             line.append(pdata[p]['foldToStreet1CBDone'])          | ||||
|             line.append(pdata[p]['foldToStreet2CBChance'])        | ||||
|             line.append(pdata[p]['foldToStreet2CBDone'])          | ||||
|             line.append(pdata[p]['foldToStreet3CBChance'])        | ||||
|             line.append(pdata[p]['foldToStreet3CBDone'])          | ||||
|             line.append(pdata[p]['foldToStreet4CBChance'])        | ||||
|             line.append(pdata[p]['foldToStreet4CBDone'])          | ||||
|             line.append(pdata[p]['totalProfit']) | ||||
|             line.append(pdata[p]['street1CheckCallRaiseChance'])  | ||||
|             line.append(pdata[p]['street1CheckCallRaiseDone'])    | ||||
|             line.append(pdata[p]['street2CheckCallRaiseChance'])  | ||||
|             line.append(pdata[p]['street2CheckCallRaiseDone'])    | ||||
|             line.append(pdata[p]['street3CheckCallRaiseChance'])  | ||||
|             line.append(pdata[p]['street3CheckCallRaiseDone'])    | ||||
|             line.append(pdata[p]['street4CheckCallRaiseChance'])  | ||||
|             line.append(pdata[p]['street4CheckCallRaiseDone'])    | ||||
|             line.append(pdata[p]['street0Calls'])                 | ||||
|             line.append(pdata[p]['street1Calls'])                 | ||||
|             line.append(pdata[p]['street2Calls'])                 | ||||
|             line.append(pdata[p]['street3Calls'])                 | ||||
|             line.append(pdata[p]['street4Calls'])                 | ||||
|             line.append(pdata[p]['street0Bets'])                  | ||||
|             line.append(pdata[p]['street1Bets'])                  | ||||
|             line.append(pdata[p]['street2Bets'])                  | ||||
|             line.append(pdata[p]['street3Bets'])                  | ||||
|             line.append(pdata[p]['street4Bets'])                  | ||||
|             line.append(pdata[p]['street0Raises'])                | ||||
|             line.append(pdata[p]['street1Raises'])                | ||||
|             line.append(pdata[p]['street2Raises'])                | ||||
|             line.append(pdata[p]['street3Raises'])                | ||||
|             line.append(pdata[p]['street4Raises'])                | ||||
|             line[0] = 1 # HDs | ||||
|             if pdata[p]['street0VPI']:                  line[1] = 1 | ||||
|             if pdata[p]['street0Aggr']:                 line[2] = 1 | ||||
|             if pdata[p]['street0_3BChance']:            line[3] = 1 | ||||
|             if pdata[p]['street0_3BDone']:              line[4] = 1 | ||||
|             if pdata[p]['street0_4BChance']:            line[5] = 1 | ||||
|             if pdata[p]['street0_4BDone']:              line[6] = 1 | ||||
|             if pdata[p]['street0_FoldTo3BChance']:      line[7] = 1 | ||||
|             if pdata[p]['street0_FoldTo3BDone']:        line[8] = 1 | ||||
|             if pdata[p]['street0_FoldTo4BChance']:      line[9] = 1 | ||||
|             if pdata[p]['street0_FoldTo4BDone']:        line[10] = 1 | ||||
|             if pdata[p]['other3BStreet0']:              line[11] = 1 | ||||
|             if pdata[p]['other4BStreet0']:              line[12] = 1 | ||||
|             if pdata[p]['street1Seen']:                 line[13] = 1 | ||||
|             if pdata[p]['street2Seen']:                 line[14] = 1 | ||||
|             if pdata[p]['street3Seen']:                 line[15] = 1 | ||||
|             if pdata[p]['street4Seen']:                 line[16] = 1 | ||||
|             if pdata[p]['sawShowdown']:                 line[17] = 1 | ||||
|             if pdata[p]['street1Aggr']:                 line[18] = 1 | ||||
|             if pdata[p]['street2Aggr']:                 line[19] = 1 | ||||
|             if pdata[p]['street3Aggr']:                 line[20] = 1 | ||||
|             if pdata[p]['street4Aggr']:                 line[21] = 1 | ||||
|             if pdata[p]['otherRaisedStreet0']:          line[22] = 1 | ||||
|             if pdata[p]['otherRaisedStreet1']:          line[23] = 1 | ||||
|             if pdata[p]['otherRaisedStreet2']:          line[24] = 1 | ||||
|             if pdata[p]['otherRaisedStreet3']:          line[25] = 1 | ||||
|             if pdata[p]['otherRaisedStreet4']:          line[26] = 1 | ||||
|             if pdata[p]['foldToOtherRaisedStreet0']:    line[27] = 1 | ||||
|             if pdata[p]['foldToOtherRaisedStreet1']:    line[28] = 1 | ||||
|             if pdata[p]['foldToOtherRaisedStreet2']:    line[29] = 1 | ||||
|             if pdata[p]['foldToOtherRaisedStreet3']:    line[30] = 1 | ||||
|             if pdata[p]['foldToOtherRaisedStreet4']:    line[31] = 1 | ||||
|             line[32] = pdata[p]['wonWhenSeenStreet1'] | ||||
|             line[33] = pdata[p]['wonWhenSeenStreet2'] | ||||
|             line[34] = pdata[p]['wonWhenSeenStreet3'] | ||||
|             line[35] = pdata[p]['wonWhenSeenStreet4'] | ||||
|             line[36] = pdata[p]['wonAtSD'] | ||||
|             if pdata[p]['raiseFirstInChance']:          line[37] = 1 | ||||
|             if pdata[p]['raisedFirstIn']:               line[38] = 1 | ||||
|             if pdata[p]['foldBbToStealChance']:         line[39] = 1 | ||||
|             if pdata[p]['foldedBbToSteal']:             line[40] = 1 | ||||
|             if pdata[p]['foldSbToStealChance']:         line[41] = 1 | ||||
|             if pdata[p]['foldedSbToSteal']:             line[42] = 1 | ||||
|             if pdata[p]['street1CBChance']:             line[43] = 1 | ||||
|             if pdata[p]['street1CBDone']:               line[44] = 1 | ||||
|             if pdata[p]['street2CBChance']:             line[45] = 1 | ||||
|             if pdata[p]['street2CBDone']:               line[46] = 1 | ||||
|             if pdata[p]['street3CBChance']:             line[47] = 1 | ||||
|             if pdata[p]['street3CBDone']:               line[48] = 1 | ||||
|             if pdata[p]['street4CBChance']:             line[49] = 1 | ||||
|             if pdata[p]['street4CBDone']:               line[50] = 1 | ||||
|             if pdata[p]['foldToStreet1CBChance']:       line[51] = 1 | ||||
|             if pdata[p]['foldToStreet1CBDone']:         line[52] = 1 | ||||
|             if pdata[p]['foldToStreet2CBChance']:       line[53] = 1 | ||||
|             if pdata[p]['foldToStreet2CBDone']:         line[54] = 1 | ||||
|             if pdata[p]['foldToStreet3CBChance']:       line[55] = 1 | ||||
|             if pdata[p]['foldToStreet3CBDone']:         line[56] = 1 | ||||
|             if pdata[p]['foldToStreet4CBChance']:       line[57] = 1 | ||||
|             if pdata[p]['foldToStreet4CBDone']:         line[58] = 1 | ||||
|             line[59] = pdata[p]['totalProfit'] | ||||
|             if pdata[p]['street1CheckCallRaiseChance']: line[60] = 1 | ||||
|             if pdata[p]['street1CheckCallRaiseDone']:   line[61] = 1 | ||||
|             if pdata[p]['street2CheckCallRaiseChance']: line[62] = 1 | ||||
|             if pdata[p]['street2CheckCallRaiseDone']:   line[63] = 1 | ||||
|             if pdata[p]['street3CheckCallRaiseChance']: line[64] = 1 | ||||
|             if pdata[p]['street3CheckCallRaiseDone']:   line[65] = 1 | ||||
|             if pdata[p]['street4CheckCallRaiseChance']: line[66] = 1 | ||||
|             if pdata[p]['street4CheckCallRaiseDone']:   line[67] = 1 | ||||
|             if pdata[p]['street0Calls']:                line[68] = 1 | ||||
|             if pdata[p]['street1Calls']:                line[69] = 1 | ||||
|             if pdata[p]['street2Calls']:                line[70] = 1 | ||||
|             if pdata[p]['street3Calls']:                line[71] = 1 | ||||
|             if pdata[p]['street4Calls']:                line[72] = 1 | ||||
|             if pdata[p]['street0Bets']:                 line[73] = 1 | ||||
|             if pdata[p]['street1Bets']:                 line[74] = 1 | ||||
|             if pdata[p]['street2Bets']:                 line[75] = 1 | ||||
|             if pdata[p]['street3Bets']:                 line[76] = 1 | ||||
|             if pdata[p]['street4Bets']:                 line[77] = 1 | ||||
|             if pdata[p]['street0Raises']:               line[78] = 1 | ||||
|             if pdata[p]['street1Raises']:               line[79] = 1 | ||||
|             if pdata[p]['street2Raises']:               line[80] = 1 | ||||
|             if pdata[p]['street3Raises']:               line[81] = 1 | ||||
|             if pdata[p]['street4Raises']:               line[82] = 1 | ||||
| 
 | ||||
|             line.append(gid)          # gametypeId | ||||
|             line.append(pids[p])      # playerId | ||||
|             line.append(len(pids))    # activeSeats | ||||
|             line[83] = gid    # gametypeId | ||||
|             line[84] = pids[p]    # playerId | ||||
|             line[85] = len(pids)    # activeSeats | ||||
|             pos = {'B':'B', 'S':'S', 0:'D', 1:'C', 2:'M', 3:'M', 4:'M', 5:'E', 6:'E', 7:'E', 8:'E', 9:'E' } | ||||
|             line.append(pos[pdata[p]['position']]) | ||||
|             line.append(pdata[p]['tourneyTypeId']) | ||||
|             line.append(styleKey)    # styleKey | ||||
|             line[86] = pos[pdata[p]['position']] | ||||
|             line[87] = pdata[p]['tourneyTypeId'] | ||||
|             line[88] = styleKey    # styleKey | ||||
|             inserts.append(line) | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -420,12 +420,15 @@ class Filters(threading.Thread): | |||
|         self.limits[limit] = w.get_active() | ||||
|         log.debug(_("self.limit[%s] set to %s") %(limit, self.limits[limit])) | ||||
|         if limit.isdigit() or (len(limit) > 2 and (limit[-2:] == 'nl' or limit[-2:] == 'fl' or limit[-2:] == 'pl')): | ||||
|             # turning a leaf limit on with 'None' checked turns 'None' off | ||||
|             if self.limits[limit]: | ||||
|                 if self.cbNoLimits is not None: | ||||
|                     self.cbNoLimits.set_active(False) | ||||
|             # turning a leaf limit off with 'All' checked turns 'All' off | ||||
|             else: | ||||
|                 if self.cbAllLimits is not None: | ||||
|                     self.cbAllLimits.set_active(False) | ||||
|             # turning off a leaf limit turns off the corresponding fl. nl, or pl | ||||
|             if not self.limits[limit]: | ||||
|                 if limit.isdigit(): | ||||
|                     if self.cbFL is not None: | ||||
|  | @ -438,24 +441,28 @@ class Filters(threading.Thread): | |||
|                         self.cbPL.set_active(False) | ||||
|         elif limit == "all": | ||||
|             if self.limits[limit]: | ||||
|                 #for cb in self.cbLimits.values(): | ||||
|                 #    cb.set_active(True) | ||||
|                 if self.cbFL is not None: | ||||
|                     self.cbFL.set_active(True) | ||||
|                 if self.cbNL is not None: | ||||
|                     self.cbNL.set_active(True) | ||||
|                 if self.cbPL is not None: | ||||
|                     self.cbPL.set_active(True) | ||||
|                 if self.num_limit_types == 1: | ||||
|                     for cb in self.cbLimits.values(): | ||||
|                         cb.set_active(True) | ||||
|                 else: | ||||
|                     if self.cbFL is not None: | ||||
|                         self.cbFL.set_active(True) | ||||
|                     if self.cbNL is not None: | ||||
|                         self.cbNL.set_active(True) | ||||
|                     if self.cbPL is not None: | ||||
|                         self.cbPL.set_active(True) | ||||
|         elif limit == "none": | ||||
|             if self.limits[limit]: | ||||
|                 for cb in self.cbLimits.values(): | ||||
|                     cb.set_active(False) | ||||
|                 if self.cbNL is not None: | ||||
|                     self.cbNL.set_active(False) | ||||
|                 if self.cbFL is not None: | ||||
|                     self.cbFL.set_active(False) | ||||
|                 if self.cbPL is not None: | ||||
|                     self.cbPL.set_active(False) | ||||
|                 if self.num_limit_types == 1: | ||||
|                     for cb in self.cbLimits.values(): | ||||
|                         cb.set_active(False) | ||||
|                 else: | ||||
|                     if self.cbNL is not None: | ||||
|                         self.cbNL.set_active(False) | ||||
|                     if self.cbFL is not None: | ||||
|                         self.cbFL.set_active(False) | ||||
|                     if self.cbPL is not None: | ||||
|                         self.cbPL.set_active(False) | ||||
|         elif limit == "fl": | ||||
|             if not self.limits[limit]: | ||||
|                 # only toggle all fl limits off if they are all currently on | ||||
|  | @ -765,11 +772,11 @@ class Filters(threading.Thread): | |||
| 
 | ||||
|                 dest = vbox3  # for ring/tour buttons | ||||
|                 if "LimitType" in display and display["LimitType"] == True: | ||||
|                     num_limit_types = 0 | ||||
|                     if self.found['fl']:  num_limit_types = num_limit_types + 1 | ||||
|                     if self.found['pl']:  num_limit_types = num_limit_types + 1 | ||||
|                     if self.found['nl']:  num_limit_types = num_limit_types + 1 | ||||
|                     if num_limit_types > 1: | ||||
|                     self.num_limit_types = 0 | ||||
|                     if self.found['fl']:  self.num_limit_types = self.num_limit_types + 1 | ||||
|                     if self.found['pl']:  self.num_limit_types = self.num_limit_types + 1 | ||||
|                     if self.found['nl']:  self.num_limit_types = self.num_limit_types + 1 | ||||
|                     if self.num_limit_types > 1: | ||||
|                        if self.found['fl']: | ||||
|                            hbox = gtk.HBox(False, 0) | ||||
|                            vbox3.pack_start(hbox, False, False, 0) | ||||
|  |  | |||
|  | @ -49,6 +49,7 @@ class Fulltilt(HandHistoryConverter): | |||
|                         '6.00': ('1.00', '3.00'),       '6': ('1.00', '3.00'), | ||||
|                         '8.00': ('2.00', '4.00'),       '8': ('2.00', '4.00'), | ||||
|                        '10.00': ('2.00', '5.00'),      '10': ('2.00', '5.00'), | ||||
|                        '16.00': ('4.00', '8.00'),      '16': ('4.00', '8.00'), | ||||
|                        '20.00': ('5.00', '10.00'),     '20': ('5.00', '10.00'), | ||||
|                        '30.00': ('10.00', '15.00'),    '30': ('10.00', '15.00'), | ||||
|                        '40.00': ('10.00', '20.00'),    '40': ('10.00', '20.00'), | ||||
|  | @ -88,7 +89,7 @@ class Fulltilt(HandHistoryConverter): | |||
|                                     [%(LS)s]?(?P<CAP>[.0-9]+\sCap\s)? | ||||
|                                     (?P<GAMETYPE>[-\da-zA-Z\/\'\s]+)\s-\s | ||||
|                                     (?P<DATETIME>.*$) | ||||
|                                     (?P<PARTIAL>\(partial\))?\n | ||||
|                                     (?P<PARTIAL>\(partial\))?\s | ||||
|                                     (?:.*?\n(?P<CANCELLED>Hand\s\#(?P=HID)\shas\sbeen\scanceled))? | ||||
|                                  ''' % substitutions, re.MULTILINE|re.VERBOSE) | ||||
|     re_TourneyExtraInfo  = re.compile('''(((?P<TOURNEY_NAME>[^$]+)? | ||||
|  | @ -147,7 +148,7 @@ class Fulltilt(HandHistoryConverter): | |||
|     re_Mixed        = re.compile(r'\s\-\s(?P<MIXED>HA|HORSE|HOSE)\s\-\s', re.VERBOSE) | ||||
|     re_Max          = re.compile("(?P<MAX>\d+)( max)?", re.MULTILINE) | ||||
|     # NB: if we ever match "Full Tilt Poker" we should also match "FullTiltPoker", which PT Stud erroneously exports. | ||||
|     re_DateTime     = re.compile("""((?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)\s(?P<TZ>\w+)\s-\s(?P<Y>[0-9]{4})\/(?P<M>[0-9]{2})\/(?P<D>[0-9]{2})|(?P<H2>[0-9]+):(?P<MIN2>[0-9]+)\s(?P<TZ2>\w+)\s-\s\w+\,\s(?P<M2>\w+)\s(?P<D2>\d+)\,\s(?P<Y2>[0-9]{4}))""", re.MULTILINE) | ||||
|     re_DateTime     = re.compile("""((?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)\s(?P<TZ>\w+)\s-\s(?P<Y>[0-9]{4})\/(?P<M>[0-9]{2})\/(?P<D>[0-9]{2})|(?P<H2>[0-9]+):(?P<MIN2>[0-9]+)\s(?P<TZ2>\w+)\s-\s\w+\,\s(?P<M2>\w+)\s(?P<D2>\d+)\,\s(?P<Y2>[0-9]{4}))(?P<PARTIAL>\s\(partial\))?""", re.MULTILINE) | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|  | @ -283,10 +284,13 @@ class Fulltilt(HandHistoryConverter): | |||
|                     datetimestr = "%s/%s/%s %s:%s" % (a.group('Y2'), a.group('M2'),a.group('D2'),a.group('H2'),a.group('MIN2')) | ||||
|                     timezone = a.group('TZ2') | ||||
|                     hand.startTime = datetime.datetime.strptime(datetimestr, "%Y/%B/%d %H:%M") | ||||
|                 if a.group('PARTIAL'): | ||||
|                     raise FpdbParseError(hid=m.group('HID')) | ||||
| 
 | ||||
|             hand.startTime = HandHistoryConverter.changeTimezone(hand.startTime, timezone, "UTC") | ||||
| 
 | ||||
|         if m.group("CANCELLED") or m.group("PARTIAL"): | ||||
|             # It would appear this can't be triggered as DATETIME is a bit greedy | ||||
|             raise FpdbParseError(hid=m.group('HID')) | ||||
| 
 | ||||
|         if m.group('TABLEATTRIBUTES'): | ||||
|  | @ -351,7 +355,7 @@ class Fulltilt(HandHistoryConverter): | |||
|             n = self.re_SummarySitout.finditer(post) | ||||
|             for b in n: | ||||
|                 del plist[b.group('PNAME')] | ||||
|                 print "DEBUG: Deleting '%s' from player dict" %(b.group('PNAME')) | ||||
|                 #print "DEBUG: Deleting '%s' from player dict" %(b.group('PNAME')) | ||||
| 
 | ||||
|         # Add remaining players | ||||
|         for a in plist: | ||||
|  |  | |||
|  | @ -15,6 +15,9 @@ | |||
| #along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
| #In the "official" distribution you can find the license in agpl-3.0.txt. | ||||
| 
 | ||||
| import L10n | ||||
| _ = L10n.get_translation() | ||||
| 
 | ||||
| import threading | ||||
| import pygtk | ||||
| pygtk.require('2.0') | ||||
|  | @ -22,18 +25,6 @@ import gtk | |||
| import os | ||||
| from time import time, strftime | ||||
|      | ||||
| import locale | ||||
| lang=locale.getdefaultlocale()[0][0:2] | ||||
| if lang=="en": | ||||
|     def _(string): return string | ||||
| else: | ||||
|     import gettext | ||||
|     try: | ||||
|         trans = gettext.translation("fpdb", localedir="locale", languages=[lang]) | ||||
|         trans.install() | ||||
|     except IOError: | ||||
|         def _(string): return string | ||||
| 
 | ||||
| import fpdb_import | ||||
| import Database | ||||
| import Filters | ||||
|  |  | |||
|  | @ -15,6 +15,9 @@ | |||
| #along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
| #In the "official" distribution you can find the license in agpl-3.0.txt. | ||||
| 
 | ||||
| import L10n | ||||
| _ = L10n.get_translation() | ||||
| 
 | ||||
| import xml.dom.minidom | ||||
| from xml.dom.minidom import Node | ||||
| 
 | ||||
|  | @ -23,18 +26,6 @@ pygtk.require('2.0') | |||
| import gtk | ||||
| import gobject | ||||
| 
 | ||||
| import locale | ||||
| lang=locale.getdefaultlocale()[0][0:2] | ||||
| if lang=="en": | ||||
|     def _(string): return string | ||||
| else: | ||||
|     import gettext | ||||
|     try: | ||||
|         trans = gettext.translation("fpdb", localedir="locale", languages=[lang]) | ||||
|         trans.install() | ||||
|     except IOError: | ||||
|         def _(string): return string | ||||
| 
 | ||||
| import Configuration | ||||
| 
 | ||||
| rewrite = { 'general' : 'General',                   'supported_databases' : 'Databases' | ||||
|  |  | |||
|  | @ -339,7 +339,7 @@ class GuiRingPlayerStats (GuiPlayerStats.GuiPlayerStats): | |||
|     #end def createStatsTable | ||||
| 
 | ||||
|     def reset_style_render_func(self, treeviewcolumn, cell, model, iter): | ||||
|         cell.set_property('foreground', 'black') | ||||
|         cell.set_property('foreground', None) | ||||
|     #end def reset_style_render_func | ||||
| 
 | ||||
|     def ledger_style_render_func(self, tvcol, cell, model, iter): | ||||
|  |  | |||
|  | @ -434,7 +434,7 @@ class GuiTourneyPlayerStats (GuiPlayerStats.GuiPlayerStats): | |||
|     #end def refreshStats | ||||
|      | ||||
|     def reset_style_render_func(self, treeviewcolumn, cell, model, iter): | ||||
|         cell.set_property('foreground', 'black') | ||||
|         cell.set_property('foreground', None) | ||||
|     #end def reset_style_render_func | ||||
| 
 | ||||
|     def sortCols(self, col, nums): | ||||
|  |  | |||
|  | @ -23,6 +23,9 @@ | |||
| 
 | ||||
| Main for FreePokerTools HUD. | ||||
| """ | ||||
| import L10n | ||||
| _ = L10n.get_translation() | ||||
| 
 | ||||
| #    Standard Library modules | ||||
| import sys | ||||
| import os | ||||
|  | @ -51,21 +54,6 @@ elif sys.platform == 'darwin': | |||
| else: # This is bad--figure out the values for the various windows flavors | ||||
|     import WinTables as Tables | ||||
| 
 | ||||
| import locale | ||||
| lang = locale.getdefaultlocale()[0][0:2] | ||||
| print "lang:", lang | ||||
| if lang == "en": | ||||
|     def _(string): | ||||
|         return string | ||||
| else: | ||||
|     import gettext | ||||
|     try: | ||||
|         trans = gettext.translation("fpdb", localedir="locale", languages=[lang]) | ||||
|         trans.install() | ||||
|     except IOError: | ||||
|         def _(string): | ||||
|             return string | ||||
| 
 | ||||
| # get config and set up logger | ||||
| c = Configuration.Config(file=options.config, dbname=options.dbname) | ||||
| log = Configuration.get_logger("logging.conf", "hud", log_dir=c.dir_log, log_file='HUD-log.txt') | ||||
|  |  | |||
|  | @ -1140,7 +1140,7 @@ class DrawHand(Hand): | |||
|             hhc.markStreets(self) | ||||
|             # markStreets in Draw may match without dealing cards | ||||
|             if self.streets['DEAL'] == None: | ||||
|                 raise FpdbParseError(_("DrawHand.__init__: street 'DEAL' is empty. Hand cancelled?")) | ||||
|                 raise FpdbParseError(_("DrawHand.__init__: street 'DEAL' is empty. Hand cancelled? '%s'" % self.handid)) | ||||
|             hhc.readBlinds(self) | ||||
|             hhc.readAntes(self) | ||||
|             hhc.readButton(self) | ||||
|  |  | |||
|  | @ -49,7 +49,7 @@ class OnGame(HandHistoryConverter): | |||
|                     } | ||||
|     currencies = { u'\u20ac':'EUR', u'\xe2\x82\xac':'EUR', '$':'USD', '':'T$' } | ||||
| 
 | ||||
|     limits = { 'NO_LIMIT':'nl', 'LIMIT':'fl'} | ||||
|     limits = { 'NO_LIMIT':'nl', 'POT_LIMIT':'pl', 'LIMIT':'fl'} | ||||
| 
 | ||||
|     games = {                          # base, category | ||||
|                           "TEXAS_HOLDEM" : ('hold','holdem'), | ||||
|  | @ -73,7 +73,7 @@ class OnGame(HandHistoryConverter): | |||
|             Start\shand:\s(?P<DATETIME>.*) | ||||
|             Table:\s(?P<TABLE>[-\'\w\s]+)\s\[\d+\]\s\( | ||||
|             ( | ||||
|             (?P<LIMIT>NO_LIMIT|Limit|LIMIT|Pot\sLimit)\s | ||||
|             (?P<LIMIT>NO_LIMIT|Limit|LIMIT|Pot\sLimit|POT_LIMIT)\s | ||||
|             (?P<GAME>TEXAS_HOLDEM|OMAHA_HI|SEVEN_CARD_STUD|SEVEN_CARD_STUD_HI_LO|RAZZ|FIVE_CARD_DRAW)\s | ||||
|             (?P<CURRENCY>%(LS)s|)?(?P<SB>[.0-9]+)/ | ||||
|             (%(LS)s)?(?P<BB>[.0-9]+) | ||||
|  | @ -140,6 +140,7 @@ class OnGame(HandHistoryConverter): | |||
|     def readSupportedGames(self): | ||||
|         return [ | ||||
|                 ["ring", "hold", "fl"], | ||||
|                 ["ring", "hold", "pl"], | ||||
|                 ["ring", "hold", "nl"], | ||||
|                 ["ring", "stud", "fl"], | ||||
|                 ["ring", "draw", "fl"], | ||||
|  | @ -158,6 +159,7 @@ class OnGame(HandHistoryConverter): | |||
|             raise FpdbParseError(_("Unable to recognise gametype from: '%s'") % tmp) | ||||
| 
 | ||||
|         mg = m.groupdict() | ||||
|         #print "DEBUG: mg: %s" % mg | ||||
| 
 | ||||
|         info['type'] = 'ring' | ||||
|         if 'CURRENCY' in mg: | ||||
|  | @ -314,9 +316,9 @@ class OnGame(HandHistoryConverter): | |||
|         m = self.re_Action.finditer(hand.streets[street]) | ||||
|         for action in m: | ||||
|             #acts = action.groupdict() | ||||
|             #log.debug("readaction: acts: %s" %acts) | ||||
|             #print "readaction: acts: %s" %acts | ||||
|             if action.group('ATYPE') == ' raises': | ||||
|                 hand.addRaiseBy( street, action.group('PNAME'), action.group('BET') ) | ||||
|                 hand.addRaiseTo( street, action.group('PNAME'), action.group('BET') ) | ||||
|             elif action.group('ATYPE') == ' calls': | ||||
|                 hand.addCall( street, action.group('PNAME'), action.group('BET') ) | ||||
|             elif action.group('ATYPE') == ' bets': | ||||
|  |  | |||
|  | @ -49,7 +49,8 @@ class PartyPoker(HandHistoryConverter): | |||
|     currencies = {"\$": "USD", "$": "USD", u"\xe2\x82\xac": "EUR", u"\u20ac": "EUR", '': "T$"} | ||||
|     substitutions = { | ||||
|                      'LEGAL_ISO' : "USD|EUR",            # legal ISO currency codes | ||||
|                             'LS' : "\$|\u20AC|\xe2\x82\xac|"    # legal currency symbols - Euro(cp1252, utf-8) | ||||
|                             'LS' : u"\$|\u20ac|\xe2\x82\xac|",    # Currency symbols - Euro(cp1252, utf-8) | ||||
|                            'NUM' : u".,\d", | ||||
|                     } | ||||
| 
 | ||||
|     # Static regexes | ||||
|  | @ -81,7 +82,7 @@ class PartyPoker(HandHistoryConverter): | |||
|     re_PlayerInfo   = re.compile(u""" | ||||
|           Seat\s(?P<SEAT>\d+):\s | ||||
|           (?P<PNAME>.*)\s | ||||
|           \(\s*[%(LS)s]?(?P<CASH>[0-9,.]+)\s*(?:%(LEGAL_ISO)s|)\s*\) | ||||
|           \(\s*[%(LS)s]?(?P<CASH>[%(NUM)s]+)\s*(?:%(LEGAL_ISO)s|)\s*\) | ||||
|           """ % substitutions, re.VERBOSE| re.UNICODE) | ||||
| 
 | ||||
|     re_HandInfo     = re.compile(""" | ||||
|  |  | |||
|  | @ -84,8 +84,8 @@ class PokerStars(HandHistoryConverter): | |||
| 
 | ||||
|     # Static regexes | ||||
|     re_GameInfo     = re.compile(u""" | ||||
|           PokerStars\sGame\s\#(?P<HID>[0-9]+):\s+ | ||||
|           (Tournament\s\#                # open paren of tournament info | ||||
|           PokerStars(\sHome)?\sGame\s\#(?P<HID>[0-9]+):\s+ | ||||
|           (\{.*\}\s+)?(Tournament\s\#                # open paren of tournament info | ||||
|           (?P<TOURNO>\d+),\s | ||||
|           # here's how I plan to use LS | ||||
|           (?P<BUYIN>(?P<BIAMT>[%(LS)s\d\.]+)?\+?(?P<BIRAKE>[%(LS)s\d\.]+)?\+?(?P<BOUNTY>[%(LS)s\d\.]+)?\s?(?P<TOUR_ISO>%(LEGAL_ISO)s)?|Freeroll)\s+)? | ||||
|  |  | |||
|  | @ -109,9 +109,9 @@ class RushNotes(Aux_Window): | |||
|         notepath = site_params_dict['site_path']  # this is a temporary hijack of site-path | ||||
|         self.heroid = self.hud.db_connection.get_player_id(self.config, sitename, heroname) | ||||
|         self.notefile = notepath + "/" + heroname + ".xml" | ||||
|         self.rushtables = ("Mach 10", "Lightning", "Celerity", "Flash", "Zoom") | ||||
|         self.rushtables = ("Mach 10", "Lightning", "Celerity", "Flash", "Zoom", "Apollo") | ||||
| 
 | ||||
|         if not os.path.isfile(self.notefile): | ||||
|         if not (os.path.isfile(self.notefile)): | ||||
|             self.active = False | ||||
|             return | ||||
|         else: | ||||
|  | @ -130,29 +130,34 @@ class RushNotes(Aux_Window): | |||
|         xmlnotefile.unlink | ||||
| 
 | ||||
|         # | ||||
|         # Create a fresh queue file with skeleton XML | ||||
|         # if queue file does not exist create a fresh queue file with skeleton XML | ||||
|         # This is possibly not totally safe, if multiple threads arrive | ||||
|         # here at the same time, but the consequences are not serious | ||||
|         # | ||||
| 
 | ||||
|         self.queuefile = self.notefile + ".queue" | ||||
|         queuedom = minidom.Document() | ||||
|         if not (os.path.isfile(self.queuefile)): | ||||
| 
 | ||||
|         pld=queuedom.createElement("PLAYERDATA") | ||||
|         queuedom.appendChild(pld) | ||||
|             queuedom = minidom.Document() | ||||
| 
 | ||||
|         nts=queuedom.createElement("NOTES") | ||||
|         pld.appendChild(nts) | ||||
|             pld=queuedom.createElement("PLAYERDATA") | ||||
|             queuedom.appendChild(pld) | ||||
| 
 | ||||
|         nte = queuedom.createElement("NOTE") | ||||
|         nte = queuedom.createTextNode("\n") | ||||
|         nts.insertBefore(nte,None) | ||||
|             nts=queuedom.createElement("NOTES") | ||||
|             pld.appendChild(nts) | ||||
| 
 | ||||
|         outputfile = open(self.queuefile, 'w') | ||||
|         queuedom.writexml(outputfile) | ||||
|         outputfile.close() | ||||
|         queuedom.unlink | ||||
|             nte = queuedom.createElement("NOTE") | ||||
|             nte = queuedom.createTextNode("\n") | ||||
|             nts.insertBefore(nte,None) | ||||
| 
 | ||||
|             outputfile = open(self.queuefile, 'w') | ||||
|             queuedom.writexml(outputfile) | ||||
|             outputfile.close() | ||||
|             queuedom.unlink | ||||
| 
 | ||||
|         if (debugmode): | ||||
|             #initialise logfiles | ||||
|             debugfile=open("~Rushdebug.init", "w") | ||||
|             debugfile=open("~Rushdebug.init", "a") | ||||
|             debugfile.write("conf="+str(config)+"\n") | ||||
|             debugfile.write("spdi="+str(site_params_dict)+"\n") | ||||
|             debugfile.write("para="+str(params)+"\n") | ||||
|  | @ -161,8 +166,6 @@ class RushNotes(Aux_Window): | |||
|             debugfile.write("queu="+self.queuefile+"\n") | ||||
|             debugfile.close() | ||||
| 
 | ||||
|             open("~Rushdebug.data", "w").close() | ||||
| 
 | ||||
| 
 | ||||
|     def update_data(self, new_hand_id, db_connection): | ||||
|         #this method called once for every hand processed | ||||
|  | @ -204,16 +207,19 @@ class RushNotes(Aux_Window): | |||
|             vpip=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'vpip')[3] + " ") | ||||
|             pfr=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'pfr')[3] + " ") | ||||
|             three_B=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'three_B')[3] + " ") | ||||
|             four_B=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'four_B')[3] + " ")             | ||||
|             cbet=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'cbet')[3] + " ") | ||||
|              | ||||
|             fbbsteal=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'f_BB_steal')[3] + " ") | ||||
| 
 | ||||
|             f_3bet=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'f_3bet')[3] + " ") | ||||
|             f_4bet=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'f_4bet')[3] + " ") | ||||
|                          | ||||
|             steal=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'steal')[3] + " ") | ||||
|             ffreq1=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'ffreq1')[3] + " ") | ||||
|             agg_freq=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'agg_freq')[3] + " ") | ||||
|             BBper100=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'BBper100')[3]) | ||||
|             if BBper100[6] == "-": BBper100=BBper100[0:6] + "(" + BBper100[7:] + ")" | ||||
| 
 | ||||
| 
 | ||||
|             # | ||||
|             # grab villain known starting hands | ||||
|             # only those where they VPIP'd, so limp in the BB will not be shown | ||||
|  | @ -269,10 +275,13 @@ class RushNotes(Aux_Window): | |||
|             # for later search/replace by Merge module | ||||
|             # | ||||
|             xmlqueuedict[playername] = ("~fpdb~" + "\n" + | ||||
|                                         n + vpip + pfr + three_B + fbbsteal + "\n" + | ||||
|                                         steal + cbet + ffreq1 + "\n" + | ||||
|                                         n + vpip + pfr + "\n" + | ||||
|                                         steal + cbet + fbbsteal + ffreq1 + "\n" + | ||||
|                                         three_B + four_B + f_3bet + f_4bet + "\n" + | ||||
|                                         agg_freq + BBper100 + "\n" + | ||||
|                                         PFcall+"\n"+PFaggr+"\n"+PFdefend +"\n" | ||||
|                                         PFcall+"\n"+ | ||||
|                                         PFaggr+"\n"+ | ||||
|                                         PFdefend +"\n"+ | ||||
|                                         "~ends~") | ||||
| 
 | ||||
|         if (debugmode): | ||||
|  |  | |||
|  | @ -105,8 +105,6 @@ if not os.path.isfile(sys.argv[1]): | |||
| 
 | ||||
| if not os.path.isfile((sys.argv[1]+".queue")): | ||||
|     print "Nothing found to merge, quitting" | ||||
|     print "Did the HUD not get started during the last session?" | ||||
|     print "Has the HUD been stopped and started without merging?" | ||||
|     quit() | ||||
| 
 | ||||
| print "***************************************************************" | ||||
|  | @ -117,7 +115,7 @@ print "has stopped completely" | |||
| print "***************************************************************" | ||||
| print | ||||
| print "read from: ", sys.argv[1] | ||||
| print "merge with: ", sys.argv[1]+".queue" | ||||
| print "updated with: ", sys.argv[1]+".queue" | ||||
| 
 | ||||
| #read queue and turn into a dict | ||||
| queuedict = {} | ||||
|  | @ -172,7 +170,7 @@ mergednotes.close() | |||
| 
 | ||||
| xmlnotefile.unlink | ||||
| 
 | ||||
| print "Merged file has been written to: ", sys.argv[1]+".merged" | ||||
| print "written to: ", sys.argv[1]+".merged" | ||||
| print "" | ||||
| print "number in queue: ", statqueue | ||||
| print "existing players updated: ", statupdated | ||||
|  | @ -180,5 +178,7 @@ print "new players added: ", statadded | |||
| print "\n" | ||||
| print "Use a viewer to check the contents of the merge file." | ||||
| print "If you are happy, carry out the following steps:" | ||||
| print "1 Rename or delete the existing notes file (normally <heroname>.xml" | ||||
| print "1 Rename or delete the existing notes file (normally <heroname>.xml)" | ||||
| print "2 Rename the .merged file to become the new notes file" | ||||
| print "3 Delete the .queue file (it will be created at the next rush autoimport)" | ||||
| 
 | ||||
|  |  | |||
|  | @ -15,11 +15,6 @@ Important info: | |||
| The Merge process can only be run when ftp client is shutdown | ||||
|  - otherwise ftp overwrites the xml on exit. | ||||
| 
 | ||||
| Restarting the autoimport will empty the notes"queue" so avoid restarting | ||||
|  autoimport until the previous notes "queue" has been merged.  You will | ||||
|  lose all the queued notes, but these will be regenerated the next time | ||||
|  the villian is at your table, so it isn't the end of the world. | ||||
| 
 | ||||
| Existing ftp notes _SHOULD_ be preserved, but this isn't guaranteed,  | ||||
|  you have been warned! | ||||
|   | ||||
|  | @ -27,7 +22,8 @@ Existing colour codings should be preserved, | |||
|  this process does not change or set colourcodings. | ||||
| 
 | ||||
| Copies of the live ftp notes file should be preserved everytime | ||||
|   RushNotesAux (i.e. the HUD is started) | ||||
|   RushNotesAux (i.e. the HUD is started).  If you play at different | ||||
|   rush tables, the backup will be created several times. | ||||
| 
 | ||||
| The AW is hard-coded with just the table names of Micro Rush Poker,  | ||||
|   and should ignore all other hands. | ||||
|  | @ -35,7 +31,7 @@ The AW is hard-coded with just the table names of Micro Rush Poker, | |||
| What might not work? | ||||
| -------------------- | ||||
| 
 | ||||
| This isn't tested with Windows, and probably won't work, feedback welcome. | ||||
| This should work with windows sourcecode version, but will not work with the exe download. | ||||
| Hasn't been tested for co-existance with other sites, feedback welcome. | ||||
| Whenever FTP change their notes file format, this will all break rather spectacularly, | ||||
|     you have been warned! | ||||
|  | @ -77,7 +73,7 @@ execute the following: | |||
| ./pyfpdb/RushNotesMerge.py "/home/foo/.wine/drive_c/Program Files/Full Tilt Poker/myname.xml" | ||||
| 
 | ||||
| A revised notes file (blah.merge) should automagically appear in the full tilt root directory. | ||||
| If you are happy with it, replace the existing (myname.xml file) | ||||
| If you are happy with it, replace the existing (myname.xml file) and delete the .queue file. | ||||
| 
 | ||||
| 
 | ||||
| Since the updates aren't real time, it would be ok to play the rush | ||||
|  | @ -176,7 +172,7 @@ Process overview | |||
| ---------------- | ||||
| 
 | ||||
| 1/ The HUD process is started.   | ||||
| 1.1/ when the first hand is received, h fresh holding file is created, and  | ||||
| 1.1/ when the first hand is received, a queue file is created if not already there, and  | ||||
| a copy of the current live xml note file is created as a security backup. | ||||
| 2/ For every hand played, the auxillary window is called | ||||
| 3/ Based upon the players in the hand, fpdb will be interrogated | ||||
|  | @ -191,4 +187,4 @@ existing notes, but this cannot be guaranteed. | |||
| they replace the existing note file. | ||||
| 9/ Note that this process never updates the live notes file in situ, but | ||||
| there is a risk that something goes wrong, and that existing notes could be destroyed. | ||||
| 
 | ||||
| 10/ the queue file can be deleted to reduce re-processing next time. | ||||
|  |  | |||
|  | @ -1511,10 +1511,10 @@ class Sql: | |||
|                     sum(hc.HDs)                         AS n, | ||||
|                     sum(hc.street0VPI)                  AS vpip, | ||||
|                     sum(hc.street0Aggr)                 AS pfr, | ||||
|                     sum(hc.street0_3BChance)            AS 3B_opp_0, | ||||
|                     sum(hc.street0_3BDone)              AS 3B_0, | ||||
|                     sum(hc.street0_4BChance)            AS 4B_opp_0, | ||||
|                     sum(hc.street0_4BDone)              AS 4B_0, | ||||
|                     sum(hc.street0_3BChance)            AS TB_opp_0, | ||||
|                     sum(hc.street0_3BDone)              AS TB_0, | ||||
|                     sum(hc.street0_4BChance)            AS FB_opp_0, | ||||
|                     sum(hc.street0_4BDone)              AS FB_0, | ||||
|                     sum(hc.street0_FoldTo3BChance)      AS F3B_opp_0, | ||||
|                     sum(hc.street0_FoldTo3BDone)        AS F3B_0, | ||||
|                     sum(hc.street0_FoldTo4BChance)      AS F4B_opp_0, | ||||
|  | @ -1628,10 +1628,10 @@ class Sql: | |||
|                        sum(hc.HDs)                         AS n, | ||||
|                        sum(hc.street0VPI)                  AS vpip, | ||||
|                        sum(hc.street0Aggr)                 AS pfr, | ||||
|                        sum(hc.street0_3BChance)            AS 3B_opp_0, | ||||
|                        sum(hc.street0_3BDone)              AS 3B_0, | ||||
|                        sum(hc.street0_4BChance)            AS 4B_opp_0, | ||||
|                        sum(hc.street0_4BDone)              AS 4B_0, | ||||
|                        sum(hc.street0_3BChance)            AS TB_opp_0, | ||||
|                        sum(hc.street0_3BDone)              AS TB_0, | ||||
|                        sum(hc.street0_4BChance)            AS FB_opp_0, | ||||
|                        sum(hc.street0_4BDone)              AS FB_0, | ||||
|                        sum(hc.street0_FoldTo3BChance)      AS F3B_opp_0, | ||||
|                        sum(hc.street0_FoldTo3BDone)        AS F3B_0, | ||||
|                        sum(hc.street0_FoldTo4BChance)      AS F4B_opp_0, | ||||
|  | @ -1762,10 +1762,10 @@ class Sql: | |||
|                            1                                                        AS n, | ||||
|                            cast(hp2.street0VPI as <signed>integer)                  AS vpip, | ||||
|                            cast(hp2.street0Aggr as <signed>integer)                 AS pfr, | ||||
|                            cast(hp2.street0_3BChance as <signed>integer)            AS 3B_opp_0, | ||||
|                            cast(hp2.street0_3BDone as <signed>integer)              AS 3B_0, | ||||
|                            cast(hp2.street0_4BChance as <signed>integer)            AS 4B_opp_0, | ||||
|                            cast(hp2.street0_4BDone as <signed>integer)              AS 4B_0, | ||||
|                            cast(hp2.street0_3BChance as <signed>integer)            AS TB_opp_0, | ||||
|                            cast(hp2.street0_3BDone as <signed>integer)              AS TB_0, | ||||
|                            cast(hp2.street0_4BChance as <signed>integer)            AS FB_opp_0, | ||||
|                            cast(hp2.street0_4BDone as <signed>integer)              AS FB_0, | ||||
|                            cast(hp2.street0_FoldTo3BChance as <signed>integer)      AS F3B_opp_0, | ||||
|                            cast(hp2.street0_FoldTo3BDone as <signed>integer)        AS F3B_0, | ||||
|                            cast(hp2.street0_FoldTo4BChance as <signed>integer)      AS F4B_opp_0, | ||||
|  | @ -1872,14 +1872,14 @@ class Sql: | |||
|                            1                                                        AS n, | ||||
|                            cast(hp2.street0VPI as <signed>integer)                  AS vpip, | ||||
|                            cast(hp2.street0Aggr as <signed>integer)                 AS pfr, | ||||
|                            cast(hp2.street0_3BChance as <signed>integer)            AS 3B_opp_0, | ||||
|                            cast(hp2.street0_3BDone as <signed>integer)              AS 3B_0, | ||||
|                            cast(hp2.street0_4BChance as <signed>integer)            AS 4B_opp_0, | ||||
|                            cast(hp2.street0_4BDone as <signed>integer)              AS 4B_0, | ||||
|                            cast(hp2.street0_FoldTo3BChance as <signed>integer)      AS 3TB_opp_0, | ||||
|                            cast(hp2.street0_FoldTo3BDone as <signed>integer)        AS 3TB_0, | ||||
|                            cast(hp2.street0_FoldTo4BChance as <signed>integer)      AS 4TB_opp_0, | ||||
|                            cast(hp2.street0_FoldTo4BDone as <signed>integer)        AS 4TB_0, | ||||
|                            cast(hp2.street0_3BChance as <signed>integer)            AS TB_opp_0, | ||||
|                            cast(hp2.street0_3BDone as <signed>integer)              AS TB_0, | ||||
|                            cast(hp2.street0_4BChance as <signed>integer)            AS FB_opp_0, | ||||
|                            cast(hp2.street0_4BDone as <signed>integer)              AS FB_0, | ||||
|                            cast(hp2.street0_FoldTo3BChance as <signed>integer)      AS TTB_opp_0, | ||||
|                            cast(hp2.street0_FoldTo3BDone as <signed>integer)        AS TTB_0, | ||||
|                            cast(hp2.street0_FoldTo4BChance as <signed>integer)      AS FTB_opp_0, | ||||
|                            cast(hp2.street0_FoldTo4BDone as <signed>integer)        AS FTB_0, | ||||
|                            cast(hp2.street1Seen as <signed>integer)                 AS saw_f, | ||||
|                            cast(hp2.street1Seen as <signed>integer)                 AS saw_1, | ||||
|                            cast(hp2.street2Seen as <signed>integer)                 AS saw_2, | ||||
|  | @ -1983,14 +1983,14 @@ class Sql: | |||
|                            1                                                        AS n, | ||||
|                            cast(hp2.street0VPI as <signed>integer)                  AS vpip, | ||||
|                            cast(hp2.street0Aggr as <signed>integer)                 AS pfr, | ||||
|                            cast(hp2.street0_3BChance as <signed>integer)            AS 3B_opp_0, | ||||
|                            cast(hp2.street0_3BDone as <signed>integer)              AS 3B_0, | ||||
|                            cast(hp2.street0_4BChance as <signed>integer)            AS 4B_opp_0, | ||||
|                            cast(hp2.street0_4BDone as <signed>integer)              AS 4B_0, | ||||
|                            cast(hp2.street0_FoldTo3BChance as <signed>integer)      AS F3B_opp_0, | ||||
|                            cast(hp2.street0_FoldTo3BDone as <signed>integer)        AS F3B_0, | ||||
|                            cast(hp2.street0_FoldTo4BChance as <signed>integer)      AS F4B_opp_0, | ||||
|                            cast(hp2.street0_FoldTo4BDone as <signed>integer)        AS F4B_0, | ||||
|                            cast(hp2.street0_3BChance as <signed>integer)            AS TB_opp_0, | ||||
|                            cast(hp2.street0_3BDone as <signed>integer)              AS TB_0, | ||||
|                            cast(hp2.street0_4BChance as <signed>integer)            AS FB_opp_0, | ||||
|                            cast(hp2.street0_4BDone as <signed>integer)              AS FB_0, | ||||
|                            cast(hp2.street0_FoldTo3BChance as <signed>integer)      AS TB_opp_0, | ||||
|                            cast(hp2.street0_FoldTo3BDone as <signed>integer)        AS TB_0, | ||||
|                            cast(hp2.street0_FoldTo4BChance as <signed>integer)      AS FB_opp_0, | ||||
|                            cast(hp2.street0_FoldTo4BDone as <signed>integer)        AS FB_0, | ||||
|                            cast(hp2.street1Seen as <signed>integer)                 AS saw_f, | ||||
|                            cast(hp2.street1Seen as <signed>integer)                 AS saw_1, | ||||
|                            cast(hp2.street2Seen as <signed>integer)                 AS saw_2, | ||||
|  | @ -2294,7 +2294,7 @@ class Sql: | |||
|                              end                                                                    AS pofafq | ||||
|                             ,case when sum(cast(hp.street1Calls as <signed>integer))+ sum(cast(hp.street2Calls as <signed>integer))+ sum(cast(hp.street3Calls as <signed>integer))+ sum(cast(hp.street4Calls as <signed>integer)) = 0 then -999 | ||||
|                                  else (sum(cast(hp.street1Aggr as <signed>integer)) + sum(cast(hp.street2Aggr as <signed>integer)) + sum(cast(hp.street3Aggr as <signed>integer)) + sum(cast(hp.street4Aggr as <signed>integer))) | ||||
|                                      /(sum(cast(hp.street1Calls as <signed>integer))+ sum(cast(hp.street2Calls as <signed>integer))+ sum(cast(hp.street3Calls as <signed>integer))+ sum(cast(hp.street4Calls as <signed>integer))) | ||||
|                                      /(0.0+sum(cast(hp.street1Calls as <signed>integer))+ sum(cast(hp.street2Calls as <signed>integer))+ sum(cast(hp.street3Calls as <signed>integer))+ sum(cast(hp.street4Calls as <signed>integer))) | ||||
|                              end                                                                    AS aggfac | ||||
|                             ,100.0*(sum(cast(hp.street1Aggr as <signed>integer)) + sum(cast(hp.street2Aggr as <signed>integer)) + sum(cast(hp.street3Aggr as <signed>integer)) + sum(cast(hp.street4Aggr as <signed>integer)))  | ||||
|                                        / ((sum(cast(hp.foldToOtherRaisedStreet1 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet2 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet3 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet4 as <signed>integer))) + | ||||
|  | @ -2415,7 +2415,7 @@ class Sql: | |||
|                              end                                                                    AS pofafq | ||||
|                             ,case when sum(cast(hp.street1Calls as <signed>integer))+ sum(cast(hp.street2Calls as <signed>integer))+ sum(cast(hp.street3Calls as <signed>integer))+ sum(cast(hp.street4Calls as <signed>integer)) = 0 then -999 | ||||
|                                  else (sum(cast(hp.street1Aggr as <signed>integer)) + sum(cast(hp.street2Aggr as <signed>integer)) + sum(cast(hp.street3Aggr as <signed>integer)) + sum(cast(hp.street4Aggr as <signed>integer))) | ||||
|                                      /(sum(cast(hp.street1Calls as <signed>integer))+ sum(cast(hp.street2Calls as <signed>integer))+ sum(cast(hp.street3Calls as <signed>integer))+ sum(cast(hp.street4Calls as <signed>integer))) | ||||
|                                      /(0.0+sum(cast(hp.street1Calls as <signed>integer))+ sum(cast(hp.street2Calls as <signed>integer))+ sum(cast(hp.street3Calls as <signed>integer))+ sum(cast(hp.street4Calls as <signed>integer))) | ||||
|                              end                                                                    AS aggfac | ||||
|                             ,100.0*(sum(cast(hp.street1Aggr as <signed>integer)) + sum(cast(hp.street2Aggr as <signed>integer)) + sum(cast(hp.street3Aggr as <signed>integer)) + sum(cast(hp.street4Aggr as <signed>integer)))  | ||||
|                                        / ((sum(cast(hp.foldToOtherRaisedStreet1 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet2 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet3 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet4 as <signed>integer))) + | ||||
|  | @ -2537,7 +2537,7 @@ class Sql: | |||
|                              end                                                                    AS pofafq | ||||
|                             ,case when sum(cast(hp.street1Calls as <signed>integer))+ sum(cast(hp.street2Calls as <signed>integer))+ sum(cast(hp.street3Calls as <signed>integer))+ sum(cast(hp.street4Calls as <signed>integer)) = 0 then -999 | ||||
|                                  else (sum(cast(hp.street1Aggr as <signed>integer)) + sum(cast(hp.street2Aggr as <signed>integer)) + sum(cast(hp.street3Aggr as <signed>integer)) + sum(cast(hp.street4Aggr as <signed>integer))) | ||||
|                                      /(sum(cast(hp.street1Calls as <signed>integer))+ sum(cast(hp.street2Calls as <signed>integer))+ sum(cast(hp.street3Calls as <signed>integer))+ sum(cast(hp.street4Calls as <signed>integer))) | ||||
|                                      /(0.0+sum(cast(hp.street1Calls as <signed>integer))+ sum(cast(hp.street2Calls as <signed>integer))+ sum(cast(hp.street3Calls as <signed>integer))+ sum(cast(hp.street4Calls as <signed>integer))) | ||||
|                              end                                                                    AS aggfac | ||||
|                             ,100.0*(sum(cast(hp.street1Aggr as <signed>integer)) + sum(cast(hp.street2Aggr as <signed>integer)) + sum(cast(hp.street3Aggr as <signed>integer)) + sum(cast(hp.street4Aggr as <signed>integer)))  | ||||
|                                        / ((sum(cast(hp.foldToOtherRaisedStreet1 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet2 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet3 as <signed>integer))+ sum(cast(hp.foldToOtherRaisedStreet4 as <signed>integer))) + | ||||
|  |  | |||
|  | @ -442,12 +442,12 @@ def three_B(stat_dict, player): | |||
|     """    Three bet preflop/3rd.""" | ||||
|     stat = 0.0 | ||||
|     try: | ||||
|         stat = float(stat_dict[player]['3b_0'])/float(stat_dict[player]['3b_opp_0']) | ||||
|         stat = float(stat_dict[player]['3b_0'])/float(stat_dict[player]['Tb_opp_0']) | ||||
|         return (stat, | ||||
|                 '%3.1f'         % (100.0*stat), | ||||
|                 '3B=%3.1f%%'    % (100.0*stat), | ||||
|                 '3B_pf=%3.1f%%' % (100.0*stat), | ||||
|                 '(%d/%d)'       % (stat_dict[player]['3b_0'], stat_dict[player]['3b_opp_0']), | ||||
|                 '(%d/%d)'       % (stat_dict[player]['3b_0'], stat_dict[player]['Tb_opp_0']), | ||||
|                 _('% 4 Bet preflop/3rd')) | ||||
|     except: | ||||
|         return (stat, | ||||
|  | @ -461,12 +461,12 @@ def four_B(stat_dict, player): | |||
|     """    Four bet preflop/4rd.""" | ||||
|     stat = 0.0 | ||||
|     try: | ||||
|         stat = float(stat_dict[player]['4b_0'])/float(stat_dict[player]['4b_opp_0']) | ||||
|         stat = float(stat_dict[player]['4b_0'])/float(stat_dict[player]['Fb_opp_0']) | ||||
|         return (stat, | ||||
|                 '%3.1f'         % (100.0*stat), | ||||
|                 '4B=%3.1f%%'    % (100.0*stat), | ||||
|                 '4B_pf=%3.1f%%' % (100.0*stat), | ||||
|                 '(%d/%d)'       % (stat_dict[player]['4b_0'], stat_dict[player]['4b_opp_0']), | ||||
|                 '(%d/%d)'       % (stat_dict[player]['Fb_0'], stat_dict[player]['Fb_opp_0']), | ||||
|                 _('% 4 Bet preflop/4rd')) | ||||
|     except: | ||||
|         return (stat, | ||||
|  |  | |||
|  | @ -15,10 +15,13 @@ import L10n | |||
| _ = L10n.get_translation() | ||||
| 
 | ||||
| import sys, random | ||||
| import re | ||||
| import pokereval | ||||
| 
 | ||||
| SUITS = ['h', 'd', 's', 'c'] | ||||
| 
 | ||||
| CONNECTORS = ['32', '43', '54', '65', '76', '87', '98', 'T9', 'JT', 'QJ', 'KQ', 'AK'] | ||||
| 
 | ||||
| ANY = 0 | ||||
| SUITED = 1 | ||||
| OFFSUIT = 2 | ||||
|  | @ -65,14 +68,7 @@ class Stove: | |||
|         hands_in_range = string.strip().split(',') | ||||
|         for h in hands_in_range: | ||||
|             _h = h.strip() | ||||
|             if len(_h) > 3: | ||||
|                 cc = _h.split() | ||||
|                 r1 = cc[0] | ||||
|                 r2 = cc[1] | ||||
|                 vp = Cards(r1, r2) | ||||
|                 h_range.add(vp) | ||||
|             else: | ||||
|                 h_range.expand(expand_hands(_h, self.hand, self.board)) | ||||
|             h_range.expand(expand_hands(_h, self.hand, self.board)) | ||||
| 
 | ||||
|         self.h_range = h_range | ||||
| 
 | ||||
|  | @ -83,7 +79,7 @@ class Cards: | |||
|         self.c2 = c2 | ||||
| 
 | ||||
|     def get(self): | ||||
|         return [c1, c2] | ||||
|         return [self.c1, self.c2] | ||||
| 
 | ||||
| class Board: | ||||
|     def __init__(self, b1=None, b2=None, b3=None, b4=None, b5=None): | ||||
|  | @ -127,7 +123,7 @@ class Range: | |||
|     def get(self): | ||||
|         return sorted(self.__hands) | ||||
| 
 | ||||
|          | ||||
| 
 | ||||
| 
 | ||||
| class EV: | ||||
|     def __init__(self, plays, win, tie, lose): | ||||
|  | @ -175,6 +171,35 @@ def expand_hands(abbrev, hand, board): | |||
|     known_cards.update(set([hand.c2, hand.c2])) | ||||
|     known_cards.update(set([board.b1, board.b2, board.b3, board.b4, board.b5])) | ||||
| 
 | ||||
|     re.search('[2-9TJQKA]{2}(s|o)',abbrev) | ||||
| 
 | ||||
|     if re.search('^[2-9TJQKA]{2}(s|o)$',abbrev): #AKs or AKo | ||||
|         return standard_expand(abbrev, hand, known_cards) | ||||
|     elif re.search('^[2-9TJQKA]{2}(s|o)\+$',abbrev): #76s+ or 76o+ | ||||
|         return iterative_expand(abbrev, hand, known_cards) | ||||
|     #elif: AhXh | ||||
|     #elif: Ah6h+A | ||||
| 
 | ||||
| def iterative_expand(abbrev, hand, known_cards): | ||||
|     r1 = abbrev[0] | ||||
|     r2 = abbrev[1] | ||||
| 
 | ||||
|     h_range = [] | ||||
|     considered = set() | ||||
| 
 | ||||
|     idx = CONNECTORS.index('%s%s' % (r1, r2)) | ||||
| 
 | ||||
|     ltr = abbrev[2] | ||||
| 
 | ||||
|     h_range = [] | ||||
|     for h in CONNECTORS[idx:]: | ||||
|         abr = "%s%s" % (h, ltr) | ||||
|         h_range += standard_expand(abr, hand, known_cards) | ||||
| 
 | ||||
|     return h_range | ||||
| 
 | ||||
| 
 | ||||
| def standard_expand(abbrev, hand, known_cards): | ||||
|     # Card ranks may be different | ||||
|     r1 = abbrev[0] | ||||
|     r2 = abbrev[1] | ||||
|  | @ -228,7 +253,7 @@ def odds_for_hand(hand1, hand2, board, iterations): | |||
|         board = board, | ||||
|         iterations = iterations | ||||
|         ) | ||||
|      | ||||
| 
 | ||||
|     plays = int(res['info'][0]) | ||||
|     eval = res['eval'][0] | ||||
| 
 | ||||
|  |  | |||
|  | @ -107,6 +107,7 @@ class Winamax(HandHistoryConverter): | |||
|     re_TailSplitHands = re.compile(r'\n\s*\n') | ||||
|     re_Button       = re.compile(r'Seat\s#(?P<BUTTON>\d+)\sis\sthe\sbutton') | ||||
|     re_Board        = re.compile(r"\[(?P<CARDS>.+)\]") | ||||
|     re_Total        = re.compile(r"Total pot (?P<TOTAL>[\.\d]+).*(No rake|Rake (?P<RAKE>[\.\d]+))" % substitutions) | ||||
| 
 | ||||
|     # 2010/09/21 03:10:51 UTC | ||||
|     re_DateTime = re.compile(""" | ||||
|  | @ -219,13 +220,15 @@ class Winamax(HandHistoryConverter): | |||
|                 # TODO: Manually adjust time against OFFSET | ||||
|                 hand.startTime = datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S") # also timezone at end, e.g. " ET" | ||||
|                 hand.startTime = HandHistoryConverter.changeTimezone(hand.startTime, "CET", "UTC") | ||||
| #            if key == 'HID1': | ||||
| #                # Need to remove non-alphanumerics for MySQL | ||||
|             if key == 'HID1': | ||||
|                 # Need to remove non-alphanumerics for MySQL | ||||
| #                hand.handid = "1%.9d%s%s"%(int(info['HID2']),info['HID1'],info['HID3']) | ||||
| #                if len (hand.handid) > 19: | ||||
| #                    hand.handid = "%s" % info['HID1'] | ||||
|             if key == 'HID3': | ||||
|                 hand.handid = int(info['HID3'])   # correct hand no (REB) | ||||
|                 hand.handid = "%s%s%s"%(int(info['HID2']),info['HID1'],info['HID3']) | ||||
|                 if len (hand.handid) > 19: | ||||
|                     hand.handid = "%s%s" % (int(info['HID2']), int(info['HID3'])) | ||||
|                      | ||||
| #            if key == 'HID3': | ||||
| #                hand.handid = int(info['HID3'])   # correct hand no (REB) | ||||
|             if key == 'TOURNO': | ||||
|                 hand.tourNo = info[key] | ||||
|             if key == 'TABLE': | ||||
|  | @ -434,15 +437,29 @@ class Winamax(HandHistoryConverter): | |||
| 
 | ||||
|         collectees = [] | ||||
| 
 | ||||
|         tp = self.re_Total.search(hand.handText) | ||||
|         rake = tp.group('RAKE') | ||||
|         if rake == None: | ||||
|             rake = 0 | ||||
|         for m in self.re_CollectPot.finditer(hand.handText): | ||||
|             collectees.append([m.group('PNAME'), m.group('POT')]) | ||||
| 
 | ||||
|         for plyr, p in collectees: | ||||
|             if plyr in returned.keys() and Decimal(p) - returned[plyr] == 0: | ||||
|                 p = Decimal(p) - returned[plyr] | ||||
|             if p > 0: | ||||
|                 print "DEBUG: addCollectPot(%s,%s)" %(plyr, p) | ||||
|                 hand.addCollectPot(player=plyr,pot=p) | ||||
|         if len(collectees) == 1: | ||||
|             #print "DEBUG: Total pot: %s" % tp.groupdict() | ||||
|             #print "DEBUG: According to pot: %s" % total | ||||
|             #print "DEBUG: Rake: %s" % rake | ||||
|             plyr, p = collectees[0] | ||||
|             # p may be wrong, use calculated total - rake | ||||
|             p = total - Decimal(rake) | ||||
|             #print "DEBUG: len1: addCollectPot(%s,%s)" %(plyr, p) | ||||
|             hand.addCollectPot(player=plyr,pot=p) | ||||
|         else: | ||||
|             for plyr, p in collectees: | ||||
|                 if plyr in returned.keys() and Decimal(p) - returned[plyr] == 0: | ||||
|                     p = Decimal(p) - returned[plyr] | ||||
|                 if p > 0: | ||||
|                     #print "DEBUG: addCollectPot(%s,%s)" %(plyr, p) | ||||
|                     hand.addCollectPot(player=plyr,pot=p) | ||||
| 
 | ||||
|     def readShownCards(self,hand): | ||||
|         for m in self.re_ShownCards.finditer(hand.handText): | ||||
|  |  | |||
										
											Binary file not shown.
										
									
								
							|  | @ -49,7 +49,7 @@ | |||
|                        'street0_4BDone': False, | ||||
|                        'street0_FoldTo3BChance': False, | ||||
|                        'street0_FoldTo3BDone': False, | ||||
|                        'street0_FoldTo4BChance': False, | ||||
|                        'street0_FoldTo4BChance': True, | ||||
|                        'street0_FoldTo4BDone': False, | ||||
|                        'street1Aggr': False, | ||||
|                        'street1Bets': 0, | ||||
|  | @ -537,7 +537,7 @@ | |||
|                    'street0_3BDone': False, | ||||
|                    'street0_4BChance': True, | ||||
|                    'street0_4BDone': True, | ||||
|                    'street0_FoldTo3BChance': False, | ||||
|                    'street0_FoldTo3BChance': True, | ||||
|                    'street0_FoldTo3BDone': False, | ||||
|                    'street0_FoldTo4BChance': False, | ||||
|                    'street0_FoldTo4BDone': False, | ||||
|  |  | |||
|  | @ -0,0 +1,16 @@ | |||
| Full Tilt Poker Tournament Summary $2 + $0.25 Sit & Go (214900008) Hold'em No Limit | ||||
| Buy-In: $2 + $0.25 | ||||
| Buy-In Chips: 1500 | ||||
| 6 Entries | ||||
| Total Prize Pool: $12 | ||||
| Tournament started: 2011/01/27 07:21:00 ET | ||||
| Tournament finished: 2011/01/27 08:38:00 ET | ||||
| 
 | ||||
| 1: Hero, $7.80 | ||||
| 2: Player2, $4.20 | ||||
| 3: Player3 | ||||
| 4: Player4 | ||||
| 5: Player5 | ||||
| 6: Player6 | ||||
| Hero finished in 1st place | ||||
| 
 | ||||
|  | @ -0,0 +1,18 @@ | |||
| Full Tilt Poker Tournament Summary $2 + $0.25 Sit & Go (214976900) Hold'em No Limit | ||||
| Buy-In: $2 + $0.25 | ||||
| Buy-In Chips: 1500 | ||||
| 9 Entries | ||||
| Total Prize Pool: $18 | ||||
| Tournament started: 2011/01/27 14:35:00 ET | ||||
| Tournament finished: 2011/01/27 15:25:00 ET | ||||
| 
 | ||||
| 1: Player1, $9 | ||||
| 2: Player2, $5.40 | ||||
| 3: Hero, $3.60 | ||||
| 4: Player4 | ||||
| 5: Player5 | ||||
| 6: Player6 | ||||
| 7: Player7 | ||||
| 8: Player8 | ||||
| 9: Player9 | ||||
| Hero finished in 3rd place | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user