2010-07-08 20:01:03 +02:00
#!/usr/bin/env python
2009-03-10 00:03:17 +01:00
# -*- coding: utf-8 -*-
#
2011-03-10 06:16:31 +01:00
# Copyright 2008-2011, Carl Gherardi
2008-12-16 15:45:58 +01:00
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
########################################################################
2010-09-22 18:10:32 +02:00
import L10n
_ = L10n . get_translation ( )
2010-08-29 21:10:57 +02:00
2009-03-04 17:46:01 +01:00
import logging
2008-12-16 15:45:58 +01:00
from HandHistoryConverter import *
2010-07-08 19:46:25 +02:00
#import TourneySummary
2008-12-16 15:45:58 +01:00
2009-03-13 21:00:12 +01:00
# Fulltilt HH Format converter
2008-12-16 15:45:58 +01:00
2009-03-13 21:00:12 +01:00
class Fulltilt ( HandHistoryConverter ) :
2009-02-25 15:35:28 +01:00
2009-08-09 16:19:43 +02:00
sitename = " Fulltilt "
filetype = " text "
2010-06-03 22:17:30 +02:00
codepage = [ " utf-16 " , " cp1252 " , " utf-8 " ]
2009-08-09 16:19:43 +02:00
siteId = 1 # Needs to match id entry in Sites database
2010-08-05 10:43:24 +02:00
substitutions = {
2010-08-18 07:12:11 +02:00
' LEGAL_ISO ' : " USD|EUR|GBP|CAD|FPP " , # legal ISO currency codes
' LS ' : u " \ $| \u20AC | \xe2 \x82 \xac | " , # legal currency symbols - Euro(cp1252, utf-8)
2010-12-20 06:18:05 +01:00
' TAB ' : u " - \u2013 ' \ s \ da-zA-Z " , # legal characters for tablename
' NUM ' : u " ., \ d " , # legal characters in number format
2010-08-05 10:43:24 +02:00
}
2011-01-17 07:11:43 +01:00
Lim_Blinds = { ' 0.04 ' : ( ' 0.01 ' , ' 0.02 ' ) , ' 0.10 ' : ( ' 0.02 ' , ' 0.05 ' ) , ' 0.20 ' : ( ' 0.05 ' , ' 0.10 ' ) ,
' 0.40 ' : ( ' 0.10 ' , ' 0.20 ' ) , ' 0.50 ' : ( ' 0.10 ' , ' 0.25 ' ) ,
' 1.00 ' : ( ' 0.25 ' , ' 0.50 ' ) , ' 1 ' : ( ' 0.25 ' , ' 0.50 ' ) ,
' 2.00 ' : ( ' 0.50 ' , ' 1.00 ' ) , ' 2 ' : ( ' 0.50 ' , ' 1.00 ' ) ,
' 4.00 ' : ( ' 1.00 ' , ' 2.00 ' ) , ' 4 ' : ( ' 1.00 ' , ' 2.00 ' ) ,
' 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 ' ) ,
2011-02-07 16:16:45 +01:00
' 16.00 ' : ( ' 4.00 ' , ' 8.00 ' ) , ' 16 ' : ( ' 4.00 ' , ' 8.00 ' ) ,
2011-01-17 07:11:43 +01: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 ' ) ,
' 60.00 ' : ( ' 15.00 ' , ' 30.00 ' ) , ' 60 ' : ( ' 15.00 ' , ' 30.00 ' ) ,
' 80.00 ' : ( ' 20.00 ' , ' 40.00 ' ) , ' 80 ' : ( ' 20.00 ' , ' 40.00 ' ) ,
' 100.00 ' : ( ' 25.00 ' , ' 50.00 ' ) , ' 100 ' : ( ' 25.00 ' , ' 50.00 ' ) ,
' 200.00 ' : ( ' 50.00 ' , ' 100.00 ' ) , ' 200 ' : ( ' 50.00 ' , ' 100.00 ' ) ,
' 300.00 ' : ( ' 75.00 ' , ' 150.00 ' ) , ' 300 ' : ( ' 75.00 ' , ' 150.00 ' ) ,
' 400.00 ' : ( ' 100.00 ' , ' 200.00 ' ) , ' 400 ' : ( ' 100.00 ' , ' 200.00 ' ) ,
' 500.00 ' : ( ' 125.00 ' , ' 250.00 ' ) , ' 500 ' : ( ' 125.00 ' , ' 250.00 ' ) ,
' 800.00 ' : ( ' 200.00 ' , ' 400.00 ' ) , ' 800 ' : ( ' 200.00 ' , ' 400.00 ' ) ,
2011-01-30 23:14:57 +01:00
' 1000.00 ' : ( ' 250.00 ' , ' 500.00 ' ) , ' 1000 ' : ( ' 250.00 ' , ' 500.00 ' )
2011-01-17 07:11:43 +01:00
}
2009-02-25 15:35:28 +01:00
# Static regexes
2010-08-18 07:12:11 +02:00
re_GameInfo = re . compile ( u ''' .* \ #(?P<HID>[0-9]+): \ s
2009-08-15 19:30:31 +02:00
( ? : ( ? P < TOURNAMENT > . + ) \s \( ( ? P < TOURNO > \d + ) \) , \s ) ?
2009-07-19 03:33:00 +02:00
. +
2010-08-05 10:43:24 +02:00
- \s ( ? P < CURRENCY > [ % ( LS ) s ] | ) ?
2010-12-20 06:18:05 +01:00
( ? P < SB > [ % ( NUM ) s ] + ) /
[ % ( LS ) s ] ? ( ? P < BB > [ % ( NUM ) s ] + ) \s
( Ante \s \$ ? ( ? P < ANTE > [ % ( NUM ) s ] + ) \s ) ? - \s
[ % ( LS ) s ] ? ( ? P < CAP > [ % ( NUM ) s ] + \sCap \s ) ?
2009-07-17 23:07:53 +02:00
( ? P < LIMIT > ( No \sLimit | Pot \sLimit | Limit ) ) ? \s
2011-03-02 09:01:55 +01:00
( ? P < GAME > ( Hold \' em|Omaha \ sHi|Omaha \ sH/L|Omaha|7 \ sCard \ sStud|Stud \ sH/L|Razz|Stud \ sHi|2-7 \ sTriple \ sDraw|5 \ sCard \ sDraw|Badugi))
2010-08-05 10:43:24 +02:00
''' % s ubstitutions, re.VERBOSE)
2010-09-17 05:47:23 +02:00
re_SplitHands = re . compile ( r " \ n \ n \ n+ " )
2009-03-31 08:44:19 +02:00
re_TailSplitHands = re . compile ( r " ( \ n \ n+) " )
2011-01-24 07:00:25 +01:00
re_HandInfo = re . compile ( u ''' .* \ #(?P<HID>[0-9]+): \ s
2009-07-19 03:33:00 +02:00
( ? : ( ? P < TOURNAMENT > . + ) \s \( ( ? P < TOURNO > \d + ) \) , \s ) ?
2011-01-24 07:00:25 +01:00
( ( Table | Match ) \s ) ?
2009-07-22 16:24:29 +02:00
( ? P < PLAY > Play \sChip \s | PC ) ?
2011-01-24 07:13:03 +01:00
( ( ? P < TABLE > [ % ( TAB ) s ] + ) ( \s | , ) )
( ? P < ENTRYID > \sEntry \s \#\d+\s)?
2009-07-17 23:07:53 +02:00
( \( ( ? P < TABLEATTRIBUTES > . + ) \) \s ) ? - \s
2010-12-20 06:18:05 +01:00
[ % ( LS ) s ] ? ( ? P < SB > [ % ( NUM ) s ] + ) / [ % ( LS ) s ] ? ( ? P < BB > [ % ( NUM ) s ] + ) \s ( Ante \s [ % ( LS ) s ] ? ( ? P < ANTE > [ .0 - 9 ] + ) \s ) ? - \s
2010-08-05 10:43:24 +02:00
[ % ( LS ) s ] ? ( ? P < CAP > [ .0 - 9 ] + \sCap \s ) ?
2010-11-07 07:27:03 +01:00
( ? P < GAMETYPE > [ - \da - zA - Z \/ \' \ s]+) \ s- \ s
2010-12-10 17:01:00 +01:00
( ? P < DATETIME > . * $ )
2011-02-07 16:22:17 +01:00
( ? P < PARTIAL > \( partial \) ) ? \s
2009-08-09 16:19:43 +02:00
( ? : . * ? \n ( ? P < CANCELLED > Hand \s \#(?P=HID)\shas\sbeen\scanceled))?
2010-12-10 17:01:00 +01:00
''' % s ubstitutions, re.MULTILINE|re.VERBOSE)
2009-08-26 01:13:34 +02:00
re_TourneyExtraInfo = re . compile ( ''' (((?P<TOURNEY_NAME>[^$]+)?
2010-08-05 10:43:24 +02:00
( ? P < CURRENCY > [ % ( LS ) s ] ) ? ( ? P < BUYIN > [ .0 - 9 ] + ) ? \s * \+ \s * [ % ( LS ) s ] ? ( ? P < FEE > [ .0 - 9 ] + ) ?
2009-08-26 01:13:34 +02:00
( \s ( ? P < SPECIAL > ( KO | Heads \sUp | Matrix \s \dx | Rebuy | Madness ) ) ) ?
( \s ( ? P < SHOOTOUT > Shootout ) ) ?
( \s ( ? P < SNG > Sit \s & \sGo ) ) ?
( \s \( ( ? P < TURBO > Turbo ) \) ) ? ) | ( ? P < UNREADABLE_INFO > . + ) )
2010-08-05 10:43:24 +02:00
''' % s ubstitutions, re.VERBOSE)
2009-02-26 17:26:50 +01:00
re_Button = re . compile ( ' ^The button is in seat #(?P<BUTTON> \ d+) ' , re . MULTILINE )
2011-01-12 10:41:03 +01:00
re_PlayerInfo = re . compile ( ' Seat (?P<SEAT>[0-9]+): (?P<PNAME>. { 2,15}) \ ([ %(LS)s ]?(?P<CASH>[ %(NUM)s ]+) \ )(?P<SITOUT>, is sitting out)?$ ' % substitutions , re . MULTILINE )
2011-01-31 15:59:11 +01:00
re_SummarySitout = re . compile ( ' Seat (?P<SEAT>[0-9]+): (?P<PNAME>. { 2,15}?) ( \ (button \ ) )?is sitting out?$ ' % substitutions , re . MULTILINE )
2009-02-25 15:35:28 +01:00
re_Board = re . compile ( r " \ [(?P<CARDS>.+) \ ] " )
2009-07-22 19:51:48 +02:00
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
#static regex for tourney purpose
re_TourneyInfo = re . compile ( ''' Tournament \ sSummary \ s
( ? P < TOURNAMENT_NAME > [ ^ $ ( ] + ) ? \s *
2010-08-05 10:43:24 +02:00
( ( ? P < CURRENCY > [ % ( LS ) s ] | ) ? ( ? P < BUYIN > [ .0 - 9 ] + ) \s * \+ \s * [ % ( LS ) s ] ? ( ? P < FEE > [ .0 - 9 ] + ) \s ) ?
2009-08-26 01:13:34 +02:00
( ( ? P < SPECIAL > ( KO | Heads \sUp | Matrix \s \dx | Rebuy | Madness ) ) \s ) ?
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
( ( ? P < SHOOTOUT > Shootout ) \s ) ?
( ( ? P < SNG > Sit \s & \sGo ) \s ) ?
( \( ( ? P < TURBO1 > Turbo ) \) \s ) ?
\( ( ? P < TOURNO > \d + ) \) \s
( ( ? P < MATCHNO > Match \s \d ) \s ) ?
2011-03-02 09:01:55 +01:00
( ? P < GAME > ( Hold \' em|Omaha \ sHi|Omaha \ sH/L|Omaha|7 \ sCard \ sStud|Stud \ sH/L|Razz|Stud \ sHi)) \ s
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
( \( ( ? P < TURBO2 > Turbo ) \) \s ) ?
( ? P < LIMIT > ( No \sLimit | Pot \sLimit | Limit ) ) ?
2010-08-05 10:43:24 +02:00
''' % s ubstitutions, re.VERBOSE)
re_TourneyBuyInFee = re . compile ( " Buy-In: (?P<BUYIN_CURRENCY>[ %(LS)s ]|)?(?P<BUYIN>[.0-9]+) \ + [ %(LS)s ]?(?P<FEE>[.0-9]+) " % substitutions )
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
re_TourneyBuyInChips = re . compile ( " Buy-In Chips: (?P<BUYINCHIPS> \ d+) " )
re_TourneyEntries = re . compile ( " (?P<ENTRIES> \ d+) Entries " )
2010-08-05 10:43:24 +02:00
re_TourneyPrizePool = re . compile ( " Total Prize Pool: (?P<PRIZEPOOL_CURRENCY>[ %(LS)s ]|)?(?P<PRIZEPOOL>[.,0-9]+) " % substitutions )
re_TourneyRebuyCost = re . compile ( " Rebuy: (?P<REBUY_CURRENCY>[ %(LS)s ]|)?(?P<REBUY_COST>[.,0-9]+) " % substitutions )
re_TourneyAddOnCost = re . compile ( " Add-On: (?P<ADDON_CURRENCY>[ %(LS)s ]|)?(?P<ADDON_COST>[.,0-9]+) " % substitutions )
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
re_TourneyRebuyCount = re . compile ( " performed (?P<REBUY_COUNT> \ d+) Rebuy " )
re_TourneyAddOnCount = re . compile ( " performed (?P<ADDON_COUNT> \ d+) Add-On " )
re_TourneyRebuysTotal = re . compile ( " Total Rebuys: (?P<REBUY_TOTAL> \ d+) " )
re_TourneyAddOnsTotal = re . compile ( " Total Add-Ons: (?P<ADDONS_TOTAL> \ d+) " )
re_TourneyRebuyChips = re . compile ( " Rebuy Chips: (?P<REBUY_CHIPS> \ d+) " )
re_TourneyAddOnChips = re . compile ( " Add-On Chips: (?P<ADDON_CHIPS> \ d+) " )
2010-08-05 10:43:24 +02:00
re_TourneyKOBounty = re . compile ( " Knockout Bounty: (?P<KO_BOUNTY_CURRENCY>[ %(LS)s ]|)?(?P<KO_BOUNTY_AMOUNT>[.,0-9]+) " % substitutions )
2010-06-25 11:02:01 +02:00
re_TourneyKoCount = re . compile ( " received (?P<COUNT_KO> \ d+) Knockout Bounty Award(s)? " )
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
re_TourneyTimeInfo = re . compile ( " Tournament started: (?P<STARTTIME>.*) \n Tournament ((?P<IN_PROGRESS>is still in progress)?|(finished:(?P<ENDTIME>.*))?)$ " )
2010-08-05 10:43:24 +02:00
re_TourneysPlayersSummary = re . compile ( " ^(?P<RANK>(Still Playing| \ d+))( - |: )(?P<PNAME>[^ \n ,]+)(, )?(?P<WINNING_CURRENCY>[ %(LS)s ]|)?(?P<WINNING>[. \ d]+)? " % substitutions , re . MULTILINE )
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
re_TourneyHeroFinishingP = re . compile ( " (?P<HERO_NAME>.*) finished in (?P<HERO_FINISHING_POS> \ d+)(st|nd|rd|th) place " )
#TODO: See if we need to deal with play money tourney summaries -- Not right now (they shouldn't pass the re_TourneyInfo)
##Full Tilt Poker Tournament Summary 250 Play Money Sit & Go (102909471) Hold'em No Limit
##Buy-In: 250 Play Chips + 0 Play Chips
##Buy-In Chips: 1500
##6 Entries
##Total Prize Pool: 1,500 Play Chips
2009-07-22 19:51:48 +02:00
# These regexes are for FTP only
2009-07-22 16:24:29 +02:00
re_Mixed = re . compile ( r ' \ s \ - \ s(?P<MIXED>HA|HORSE|HOSE) \ s \ - \ s ' , re . VERBOSE )
2009-07-22 19:51:48 +02:00
re_Max = re . compile ( " (?P<MAX> \ d+)( max)? " , re . MULTILINE )
2009-04-04 16:12:45 +02:00
# NB: if we ever match "Full Tilt Poker" we should also match "FullTiltPoker", which PT Stud erroneously exports.
2011-02-07 16:22:17 +01:00
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 )
2009-02-25 15:35:28 +01:00
2009-08-18 21:17:00 +02:00
2009-07-22 16:24:29 +02:00
mixes = { ' HORSE ' : ' horse ' , ' 7-Game ' : ' 7game ' , ' HOSE ' : ' hose ' , ' HA ' : ' ha ' }
2009-08-16 20:01:36 +02:00
2009-03-10 00:03:17 +01:00
def compilePlayerRegexs ( self , hand ) :
players = set ( [ player [ 1 ] for player in hand . players ] )
2009-03-07 10:06:52 +01:00
if not players < = self . compiledPlayers : # x <= y means 'x is subset of y'
# we need to recompile the player regexs.
self . compiledPlayers = players
player_re = " (?P<PNAME> " + " | " . join ( map ( re . escape , players ) ) + " ) "
2010-08-05 10:43:24 +02:00
self . substitutions [ ' PLAYERS ' ] = player_re
2009-03-07 10:06:52 +01:00
logging . debug ( " player_re: " + player_re )
2010-12-20 06:18:05 +01:00
self . re_PostSB = re . compile ( r " ^ %(PLAYERS)s posts the small blind of [ %(LS)s ]?(?P<SB>[ %(NUM)s ]+) " % self . substitutions , re . MULTILINE )
self . re_PostDead = re . compile ( r " ^ %(PLAYERS)s posts a dead small blind of [ %(LS)s ]?(?P<SB>[ %(NUM)s ]+) " % self . substitutions , re . MULTILINE )
self . re_PostBB = re . compile ( r " ^ %(PLAYERS)s posts (the big blind of )?[ %(LS)s ]?(?P<BB>[ %(NUM)s ]+) " % self . substitutions , re . MULTILINE )
self . re_Antes = re . compile ( r " ^ %(PLAYERS)s antes [ %(LS)s ]?(?P<ANTE>[ %(NUM)s ]+) " % self . substitutions , re . MULTILINE )
self . re_BringIn = re . compile ( r " ^ %(PLAYERS)s brings in for [ %(LS)s ]?(?P<BRINGIN>[ %(NUM)s ]+) " % self . substitutions , re . MULTILINE )
self . re_PostBoth = re . compile ( r " ^ %(PLAYERS)s posts small \ & big blinds \ [[ %(LS)s ]? (?P<SBBB>[ %(NUM)s ]+) " % self . substitutions , re . MULTILINE )
2009-03-02 22:48:30 +01:00
self . re_HeroCards = re . compile ( r " ^Dealt to %s (?: \ [(?P<OLDCARDS>.+?) \ ])?( \ [(?P<NEWCARDS>.+?) \ ]) " % player_re , re . MULTILINE )
2010-12-20 06:18:05 +01:00
self . re_Action = re . compile ( r " ^ %(PLAYERS)s (?P<ATYPE> bets| checks| raises to| completes it to| calls| folds)( [ %(LS)s ]?(?P<BET>[ %(NUM)s ]+))? " % self . substitutions , re . MULTILINE )
2009-03-07 10:06:52 +01:00
self . re_ShowdownAction = re . compile ( r " ^ %s shows \ [(?P<CARDS>.*) \ ] " % player_re , re . MULTILINE )
2011-01-14 07:14:14 +01:00
self . re_CollectPot = re . compile ( r " ^Seat (?P<SEAT>[0-9]+): %(PLAYERS)s ( \ (button \ ) | \ (small blind \ ) | \ (big blind \ ) )?(collected|showed \ [.* \ ] and won) \ ([ %(LS)s ]?(?P<POT>[ %(NUM)s ]+) \ )(, mucked| with.*)? " % self . substitutions , re . MULTILINE )
2009-03-07 10:06:52 +01:00
self . re_SitsOut = re . compile ( r " ^ %s sits out " % player_re , re . MULTILINE )
2010-01-31 19:37:59 +01:00
self . re_ShownCards = re . compile ( r " ^Seat (?P<SEAT>[0-9]+): %s ( \ (button \ ) | \ (small blind \ ) | \ (big blind \ ) )?(?P<ACT>showed|mucked) \ [(?P<CARDS>.*) \ ].* " % player_re , re . MULTILINE )
2009-02-22 04:42:16 +01:00
2008-12-16 15:45:58 +01:00
def readSupportedGames ( self ) :
2009-02-22 10:07:11 +01:00
return [ [ " ring " , " hold " , " nl " ] ,
2009-02-23 11:24:21 +01:00
[ " ring " , " hold " , " pl " ] ,
2009-03-12 18:21:31 +01:00
[ " ring " , " hold " , " fl " ] ,
2009-10-01 04:49:59 +02:00
[ " ring " , " hold " , " cn " ] ,
2009-07-19 03:33:00 +02:00
2009-03-12 18:18:34 +01:00
[ " ring " , " stud " , " fl " ] ,
2009-07-19 03:33:00 +02:00
2010-11-07 07:27:03 +01:00
[ " ring " , " draw " , " fl " ] ,
2010-11-07 09:48:04 +01:00
[ " ring " , " draw " , " pl " ] ,
[ " ring " , " draw " , " nl " ] ,
2010-11-07 07:27:03 +01:00
2009-07-19 03:33:00 +02:00
[ " tour " , " hold " , " nl " ] ,
[ " tour " , " hold " , " pl " ] ,
[ " tour " , " hold " , " fl " ] ,
[ " tour " , " stud " , " fl " ] ,
2009-02-22 10:07:11 +01:00
]
2008-12-16 15:45:58 +01:00
2009-03-04 16:10:08 +01:00
def determineGameType ( self , handText ) :
2011-01-30 23:14:57 +01:00
# Full Tilt Poker Game #10777181585: Table Deerfly (deep 6) - $0.01/$0.02 - Pot Limit Omaha Hi - 2:24:44 ET - 2009/02/22
# Full Tilt Poker Game #10773265574: Table Butte (6 max) - $0.01/$0.02 - Pot Limit Hold'em - 21:33:46 ET - 2009/02/21
# Full Tilt Poker Game #9403951181: Table CR - tay - $0.05/$0.10 - No Limit Hold'em - 9:40:20 ET - 2008/12/09
# Full Tilt Poker Game #10809877615: Table Danville - $0.50/$1 Ante $0.10 - Limit Razz - 21:47:27 ET - 2009/02/23
# Full Tilt Poker.fr Game #23057874034: Table Douai– Lens (6 max) - €0.01/€0.02 - No Limit Hold'em - 21:59:17 CET - 2010/08/13
2009-03-10 00:03:17 +01:00
info = { ' type ' : ' ring ' }
2009-03-04 16:10:08 +01:00
m = self . re_GameInfo . search ( handText )
2010-08-18 07:12:11 +02:00
if not m :
2010-09-17 05:47:23 +02:00
tmp = handText [ 0 : 100 ]
2011-03-10 04:29:16 +01:00
log . error ( _ ( " Unable to recognise gametype from: ' %s ' " ) % tmp )
2011-02-24 15:48:53 +01:00
log . error ( _ ( " determineGameType: Raising FpdbParseError for file ' %s ' " ) % self . in_path )
2010-09-17 05:47:23 +02:00
raise FpdbParseError ( _ ( " Unable to recognise gametype from: ' %s ' " ) % tmp )
2009-03-10 00:03:17 +01:00
mg = m . groupdict ( )
2010-08-18 07:12:11 +02:00
2009-03-10 00:03:17 +01:00
# translations from captured groups to our info strings
limits = { ' No Limit ' : ' nl ' , ' Pot Limit ' : ' pl ' , ' Limit ' : ' fl ' }
games = { # base, category
" Hold ' em " : ( ' hold ' , ' holdem ' ) ,
' Omaha Hi ' : ( ' hold ' , ' omahahi ' ) ,
2011-03-02 09:01:55 +01:00
' Omaha ' : ( ' hold ' , ' omahahi ' ) ,
2009-07-17 23:07:53 +02:00
' Omaha H/L ' : ( ' hold ' , ' omahahilo ' ) ,
2009-03-10 00:03:17 +01:00
' Razz ' : ( ' stud ' , ' razz ' ) ,
2009-07-22 14:54:30 +02:00
' Stud Hi ' : ( ' stud ' , ' studhi ' ) ,
2010-11-07 07:27:03 +01:00
' Stud H/L ' : ( ' stud ' , ' studhilo ' ) ,
' 2-7 Triple Draw ' : ( ' draw ' , ' 27_3draw ' ) ,
2010-11-07 08:16:02 +01:00
' 5 Card Draw ' : ( ' draw ' , ' fivedraw ' ) ,
2010-11-07 09:52:23 +01:00
' Badugi ' : ( ' draw ' , ' badugi ' ) ,
2009-03-10 00:03:17 +01:00
}
2010-08-10 01:32:53 +02:00
currencies = { u ' € ' : ' EUR ' , ' $ ' : ' USD ' , ' ' : ' T$ ' }
2011-01-17 07:11:43 +01:00
if ' SB ' in mg :
info [ ' sb ' ] = self . clearMoneyString ( mg [ ' SB ' ] )
if ' BB ' in mg :
info [ ' bb ' ] = self . clearMoneyString ( mg [ ' BB ' ] )
if mg [ ' TOURNO ' ] is None : info [ ' type ' ] = " ring "
else : info [ ' type ' ] = " tour "
2009-10-01 04:49:59 +02:00
if mg [ ' CAP ' ] :
info [ ' limitType ' ] = ' cn '
else :
info [ ' limitType ' ] = limits [ mg [ ' LIMIT ' ] ]
2011-01-17 07:11:43 +01:00
if info [ ' limitType ' ] == ' fl ' and info [ ' bb ' ] is not None and info [ ' type ' ] == ' ring ' :
try :
2011-01-30 23:14:57 +01:00
info [ ' sb ' ] = self . Lim_Blinds [ mg [ ' BB ' ] ] [ 0 ]
info [ ' bb ' ] = self . Lim_Blinds [ mg [ ' BB ' ] ] [ 1 ]
2011-01-17 07:11:43 +01:00
except KeyError :
2011-03-10 04:36:20 +01:00
log . error ( _ ( " Lim_Blinds has no lookup for ' %s ' " ) % mg [ ' BB ' ] )
2011-01-17 07:11:43 +01:00
log . error ( _ ( " determineGameType: Raising FpdbParseError " ) )
2011-03-10 04:36:20 +01:00
raise FpdbParseError ( _ ( " Lim_Blinds has no lookup for ' %s ' " ) % mg [ ' BB ' ] )
2011-01-17 07:11:43 +01:00
2009-11-03 20:30:52 +01:00
if mg [ ' GAME ' ] is not None :
2009-03-10 00:03:17 +01:00
( info [ ' base ' ] , info [ ' category ' ] ) = games [ mg [ ' GAME ' ] ]
2009-11-03 20:30:52 +01:00
if mg [ ' CURRENCY ' ] is not None :
2009-03-10 00:03:17 +01:00
info [ ' currency ' ] = currencies [ mg [ ' CURRENCY ' ] ]
# NB: SB, BB must be interpreted as blinds or bets depending on limit type.
return info
2008-12-16 15:45:58 +01:00
def readHandInfo ( self , hand ) :
2009-08-09 16:19:43 +02:00
m = self . re_HandInfo . search ( hand . handText )
2009-11-03 20:30:52 +01:00
if m is None :
2010-11-07 07:27:03 +01:00
tmp = hand . handText [ 0 : 100 ]
2011-03-10 04:36:20 +01:00
log . error ( _ ( " Unable to recognise handinfo from: ' %s ' " ) % tmp )
2011-03-12 21:47:14 +01:00
log . error ( " readHandInfo: " + _ ( " Raising FpdbParseError " ) )
2011-03-10 04:36:20 +01:00
raise FpdbParseError ( _ ( " Unable to recognise handinfo from: ' %s ' " ) )
2011-01-24 07:00:25 +01:00
#print "DEBUG: m.groupdict: %s" % m.groupdict()
2008-12-16 15:45:58 +01:00
hand . handid = m . group ( ' HID ' )
hand . tablename = m . group ( ' TABLE ' )
2010-07-29 13:59:45 +02:00
2010-12-10 17:01:00 +01:00
if m . group ( ' DATETIME ' ) :
# This section of code should match either a single date (which is ET) or
# the last date in the header, which is also recorded in ET.
timezone = " ET "
m1 = self . re_DateTime . finditer ( m . group ( ' DATETIME ' ) )
datetimestr = " 2000/01/01 00:00:00 "
for a in m1 :
if a . group ( ' TZ2 ' ) == None :
datetimestr = " %s / %s / %s %s : %s : %s " % ( a . group ( ' Y ' ) , a . group ( ' M ' ) , a . group ( ' D ' ) , a . group ( ' H ' ) , a . group ( ' MIN ' ) , a . group ( ' S ' ) )
timezone = a . group ( ' TZ ' )
hand . startTime = datetime . datetime . strptime ( datetimestr , " % Y/ % m/ %d % H: % M: % S " )
else : # Short-lived date format
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 " )
2011-02-07 16:22:17 +01:00
if a . group ( ' PARTIAL ' ) :
raise FpdbParseError ( hid = m . group ( ' HID ' ) )
2010-12-10 17:01:00 +01:00
hand . startTime = HandHistoryConverter . changeTimezone ( hand . startTime , timezone , " UTC " )
2009-08-23 21:02:00 +02:00
if m . group ( " CANCELLED " ) or m . group ( " PARTIAL " ) :
2011-02-07 16:22:17 +01:00
# It would appear this can't be triggered as DATETIME is a bit greedy
2009-08-09 16:19:43 +02:00
raise FpdbParseError ( hid = m . group ( ' HID ' ) )
2009-03-21 17:31:36 +01:00
if m . group ( ' TABLEATTRIBUTES ' ) :
2009-07-22 19:51:48 +02:00
m2 = self . re_Max . search ( m . group ( ' TABLEATTRIBUTES ' ) )
if m2 : hand . maxseats = int ( m2 . group ( ' MAX ' ) )
2009-07-19 03:33:00 +02:00
hand . tourNo = m . group ( ' TOURNO ' )
2009-11-03 20:30:52 +01:00
if m . group ( ' PLAY ' ) is not None :
2009-07-22 14:54:30 +02:00
hand . gametype [ ' currency ' ] = ' play '
2009-07-31 02:56:39 +02:00
2009-08-26 01:13:34 +02:00
# Done: if there's a way to figure these out, we should.. otherwise we have to stuff it with unknowns
if m . group ( ' TOURNAMENT ' ) is not None :
n = self . re_TourneyExtraInfo . search ( m . group ( ' TOURNAMENT ' ) )
if n . group ( ' UNREADABLE_INFO ' ) is not None :
hand . tourneyComment = n . group ( ' UNREADABLE_INFO ' )
else :
hand . tourneyComment = n . group ( ' TOURNEY_NAME ' ) # can be None
if ( n . group ( ' CURRENCY ' ) is not None and n . group ( ' BUYIN ' ) is not None and n . group ( ' FEE ' ) is not None ) :
2010-07-06 18:07:26 +02:00
if n . group ( ' CURRENCY ' ) == " $ " :
hand . buyinCurrency = " USD "
elif n . group ( ' CURRENCY ' ) == u " € " :
hand . buyinCurrency = " EUR "
else :
hand . buyinCurrency = " NA "
2010-07-07 04:01:40 +02:00
hand . buyin = int ( 100 * Decimal ( n . group ( ' BUYIN ' ) ) )
hand . fee = int ( 100 * Decimal ( n . group ( ' FEE ' ) ) )
2009-08-26 01:13:34 +02:00
if n . group ( ' TURBO ' ) is not None :
hand . speed = " Turbo "
if n . group ( ' SPECIAL ' ) is not None :
special = n . group ( ' SPECIAL ' )
if special == " Rebuy " :
hand . isRebuy = True
if special == " KO " :
hand . isKO = True
2010-08-22 06:46:29 +02:00
if special == " Head ' s Up " or special == " Heads Up " :
2010-08-26 18:09:18 +02:00
hand . maxseats = 2
2009-08-26 01:13:34 +02:00
if re . search ( " Matrix " , special ) :
hand . isMatrix = True
if special == " Shootout " :
hand . isShootout = True
2010-10-12 00:20:37 +02:00
if hand . buyin is None :
hand . buyin = 0
hand . fee = 0
hand . buyinCurrency = " NA "
2009-08-16 20:01:36 +02:00
2009-11-03 20:30:52 +01:00
if hand . level is None :
2009-07-31 02:56:39 +02:00
hand . level = " 0 "
2009-07-19 03:33:00 +02:00
2008-12-16 15:45:58 +01:00
def readPlayerStacks ( self , hand ) :
2010-01-28 16:38:52 +01:00
# Split hand text for FTP, as the regex matches the player names incorrectly
# in the summary section
2011-02-02 09:40:03 +01:00
pre , post = hand . handText . split ( ' *** SUMMARY *** ' )
2011-01-12 10:41:03 +01:00
m = self . re_PlayerInfo . finditer ( pre )
plist = { }
2009-08-18 21:17:00 +02:00
2011-01-12 10:41:03 +01:00
# Get list of players in header.
2008-12-16 15:45:58 +01:00
for a in m :
2011-01-12 10:41:03 +01:00
plist [ a . group ( ' PNAME ' ) ] = [ int ( a . group ( ' SEAT ' ) ) , a . group ( ' CASH ' ) ]
if hand . gametype [ ' type ' ] == " ring " :
# Remove any listed as sitting out in the summary as start of hand info unreliable
n = self . re_SummarySitout . finditer ( post )
for b in n :
del plist [ b . group ( ' PNAME ' ) ]
2011-02-07 16:15:42 +01:00
#print "DEBUG: Deleting '%s' from player dict" %(b.group('PNAME'))
2011-01-12 10:41:03 +01:00
# Add remaining players
for a in plist :
seat , stack = plist [ a ]
hand . addPlayer ( seat , a , stack )
2008-12-16 15:45:58 +01:00
2011-03-02 09:01:55 +01:00
if plist == { } :
#No players! The hand is either missing stacks or everyone is sitting out
raise FpdbParseError ( _ ( " FTP: readPlayerStacks: No players detected (hand # %s ) " ) % hand . handid )
2010-11-07 07:27:03 +01:00
2008-12-16 15:45:58 +01:00
def markStreets ( self , hand ) :
2009-03-10 17:17:54 +01:00
if hand . gametype [ ' base ' ] == ' hold ' :
2009-02-24 17:17:25 +01:00
m = re . search ( r " \ * \ * \ * HOLE CARDS \ * \ * \ *(?P<PREFLOP>.+(?= \ * \ * \ * FLOP \ * \ * \ *)|.+) "
2008-12-16 18:26:58 +01:00
r " ( \ * \ * \ * FLOP \ * \ * \ *(?P<FLOP> \ [ \ S \ S \ S \ S \ S \ S \ ].+(?= \ * \ * \ * TURN \ * \ * \ *)|.+))? "
r " ( \ * \ * \ * TURN \ * \ * \ * \ [ \ S \ S \ S \ S \ S \ S] (?P<TURN> \ [ \ S \ S \ ].+(?= \ * \ * \ * RIVER \ * \ * \ *)|.+))? "
2009-03-04 16:10:08 +01:00
r " ( \ * \ * \ * RIVER \ * \ * \ * \ [ \ S \ S \ S \ S \ S \ S \ S \ S] (?P<RIVER> \ [ \ S \ S \ ].+))? " , hand . handText , re . DOTALL )
2010-11-07 07:27:03 +01:00
elif hand . gametype [ ' base ' ] == " stud " :
2009-02-24 18:05:51 +01:00
m = re . search ( r " (?P<ANTES>.+(?= \ * \ * \ * 3RD STREET \ * \ * \ *)|.+) "
r " ( \ * \ * \ * 3RD STREET \ * \ * \ *(?P<THIRD>.+(?= \ * \ * \ * 4TH STREET \ * \ * \ *)|.+))? "
r " ( \ * \ * \ * 4TH STREET \ * \ * \ *(?P<FOURTH>.+(?= \ * \ * \ * 5TH STREET \ * \ * \ *)|.+))? "
r " ( \ * \ * \ * 5TH STREET \ * \ * \ *(?P<FIFTH>.+(?= \ * \ * \ * 6TH STREET \ * \ * \ *)|.+))? "
r " ( \ * \ * \ * 6TH STREET \ * \ * \ *(?P<SIXTH>.+(?= \ * \ * \ * 7TH STREET \ * \ * \ *)|.+))? "
2009-03-04 16:10:08 +01:00
r " ( \ * \ * \ * 7TH STREET \ * \ * \ *(?P<SEVENTH>.+))? " , hand . handText , re . DOTALL )
2010-11-07 07:27:03 +01:00
elif hand . gametype [ ' base ' ] in ( " draw " ) :
m = re . search ( r " (?P<PREDEAL>.+(?= \ * \ * \ * HOLE CARDS \ * \ * \ *)|.+) "
2011-02-16 09:14:32 +01:00
r " ( \ * \ * \ * HOLE CARDS \ * \ * \ *(?P<DEAL>.+(?=( \ * \ * \ * FIRST DRAW \ * \ * \ *| \ * \ * \ * DRAW \ * \ * \ *))|.+))? "
r " (( \ * \ * \ * FIRST DRAW \ * \ * \ *| \ * \ * \ * DRAW \ * \ * \ *)(?P<DRAWONE>.+(?= \ * \ * \ * SECOND DRAW \ * \ * \ *)|.+))? "
2010-11-07 07:27:03 +01:00
r " ( \ * \ * \ * SECOND DRAW \ * \ * \ *(?P<DRAWTWO>.+(?= \ * \ * \ * THIRD DRAW \ * \ * \ *)|.+))? "
r " ( \ * \ * \ * THIRD DRAW \ * \ * \ *(?P<DRAWTHREE>.+))? " , hand . handText , re . DOTALL )
2008-12-16 15:45:58 +01:00
hand . addStreets ( m )
2008-12-16 18:26:58 +01:00
def readCommunityCards ( self , hand , street ) : # street has been matched by markStreets, so exists in this hand
if street in ( ' FLOP ' , ' TURN ' , ' RIVER ' ) : # a list of streets which get dealt community cards (i.e. all but PREFLOP)
2008-12-16 22:08:10 +01:00
#print "DEBUG readCommunityCards:", street, hand.streets.group(street)
2009-03-10 17:17:54 +01:00
m = self . re_Board . search ( hand . streets [ street ] )
2008-12-16 18:26:58 +01:00
hand . setCommunityCards ( street , m . group ( ' CARDS ' ) . split ( ' ' ) )
2008-12-16 15:45:58 +01:00
def readBlinds ( self , hand ) :
try :
2009-09-16 08:40:43 +02:00
m = self . re_PostSB . search ( hand . handText )
2010-12-20 07:25:58 +01:00
hand . addBlind ( m . group ( ' PNAME ' ) , ' small blind ' , self . clearMoneyString ( m . group ( ' SB ' ) ) )
2009-09-16 08:40:43 +02:00
except : # no small blind
2008-12-16 15:45:58 +01:00
hand . addBlind ( None , None , None )
2010-02-18 16:39:51 +01:00
for a in self . re_PostDead . finditer ( hand . handText ) :
2010-12-20 07:25:58 +01:00
hand . addBlind ( a . group ( ' PNAME ' ) , ' secondsb ' , self . clearMoneyString ( a . group ( ' SB ' ) ) )
2009-03-04 16:10:08 +01:00
for a in self . re_PostBB . finditer ( hand . handText ) :
2010-12-20 07:25:58 +01:00
hand . addBlind ( a . group ( ' PNAME ' ) , ' big blind ' , self . clearMoneyString ( a . group ( ' BB ' ) ) )
2009-03-04 16:10:08 +01:00
for a in self . re_PostBoth . finditer ( hand . handText ) :
2010-12-20 07:25:58 +01:00
hand . addBlind ( a . group ( ' PNAME ' ) , ' small & big blinds ' , self . clearMoneyString ( a . group ( ' SBBB ' ) ) )
2008-12-16 15:45:58 +01:00
2009-02-24 17:17:25 +01:00
def readAntes ( self , hand ) :
2010-08-29 21:10:57 +02:00
logging . debug ( _ ( " reading antes " ) )
2009-03-04 16:10:08 +01:00
m = self . re_Antes . finditer ( hand . handText )
2009-02-25 16:45:46 +01:00
for player in m :
2009-03-04 17:46:01 +01:00
logging . debug ( " hand.addAnte( %s , %s ) " % ( player . group ( ' PNAME ' ) , player . group ( ' ANTE ' ) ) )
2009-07-22 14:54:30 +02:00
# if player.group() !=
2009-02-25 16:45:46 +01:00
hand . addAnte ( player . group ( ' PNAME ' ) , player . group ( ' ANTE ' ) )
2009-02-24 17:17:25 +01:00
def readBringIn ( self , hand ) :
2009-03-04 16:10:08 +01:00
m = self . re_BringIn . search ( hand . handText , re . DOTALL )
2009-03-10 18:25:49 +01:00
if m :
2010-08-29 21:10:57 +02:00
logging . debug ( _ ( " Player bringing in: %s for %s " ) % ( m . group ( ' PNAME ' ) , m . group ( ' BRINGIN ' ) ) )
2009-03-10 18:25:49 +01:00
hand . addBringIn ( m . group ( ' PNAME ' ) , m . group ( ' BRINGIN ' ) )
else :
2010-08-29 21:10:57 +02:00
logging . warning ( _ ( " No bringin found, handid = %s " ) % hand . handid )
2009-02-24 17:17:25 +01:00
def readButton ( self , hand ) :
2011-01-12 04:47:42 +01:00
try :
hand . buttonpos = int ( self . re_Button . search ( hand . handText ) . group ( ' BUTTON ' ) )
except AttributeError , e :
# FTP has no indication that a hand is cancelled.
raise FpdbParseError ( _ ( " FTP: readButton: Failed to detect button (hand # %s cancelled?) " ) % hand . handid )
2009-02-24 17:17:25 +01:00
2008-12-16 15:45:58 +01:00
def readHeroCards ( self , hand ) :
2009-07-17 23:07:53 +02:00
# streets PREFLOP, PREDRAW, and THIRD are special cases beacause
# we need to grab hero's cards
for street in ( ' PREFLOP ' , ' DEAL ' ) :
if street in hand . streets . keys ( ) :
m = self . re_HeroCards . finditer ( hand . streets [ street ] )
for found in m :
# if m == None:
# hand.involved = False
# else:
hand . hero = found . group ( ' PNAME ' )
newcards = found . group ( ' NEWCARDS ' ) . split ( ' ' )
hand . addHoleCards ( street , hand . hero , closed = newcards , shown = False , mucked = False , dealt = True )
for street , text in hand . streets . iteritems ( ) :
if not text or street in ( ' PREFLOP ' , ' DEAL ' ) : continue # already done these
m = self . re_HeroCards . finditer ( hand . streets [ street ] )
for found in m :
player = found . group ( ' PNAME ' )
2009-11-03 20:30:52 +01:00
if found . group ( ' NEWCARDS ' ) is None :
2009-07-17 23:07:53 +02:00
newcards = [ ]
else :
newcards = found . group ( ' NEWCARDS ' ) . split ( ' ' )
2009-11-03 20:30:52 +01:00
if found . group ( ' OLDCARDS ' ) is None :
2009-07-17 23:07:53 +02:00
oldcards = [ ]
else :
oldcards = found . group ( ' OLDCARDS ' ) . split ( ' ' )
2009-07-22 20:06:05 +02:00
if street == ' THIRD ' and len ( oldcards ) == 2 : # hero in stud game
2009-07-17 23:07:53 +02:00
hand . hero = player
hand . dealt . add ( player ) # need this for stud??
2009-07-22 20:06:05 +02:00
hand . addHoleCards ( street , player , closed = oldcards , open = newcards , shown = False , mucked = False , dealt = False )
2009-07-17 23:07:53 +02:00
else :
hand . addHoleCards ( street , player , open = newcards , closed = oldcards , shown = False , mucked = False , dealt = False )
2009-02-25 11:32:12 +01:00
2008-12-16 15:45:58 +01:00
def readAction ( self , hand , street ) :
2009-03-07 15:35:52 +01:00
m = self . re_Action . finditer ( hand . streets [ street ] )
2008-12-16 15:45:58 +01:00
for action in m :
if action . group ( ' ATYPE ' ) == ' raises to ' :
hand . addRaiseTo ( street , action . group ( ' PNAME ' ) , action . group ( ' BET ' ) )
2009-03-12 02:49:16 +01:00
elif action . group ( ' ATYPE ' ) == ' completes it to ' :
2009-03-11 17:51:58 +01:00
hand . addComplete ( street , action . group ( ' PNAME ' ) , action . group ( ' BET ' ) )
2008-12-16 15:45:58 +01:00
elif action . group ( ' ATYPE ' ) == ' calls ' :
hand . addCall ( street , action . group ( ' PNAME ' ) , action . group ( ' BET ' ) )
elif action . group ( ' ATYPE ' ) == ' bets ' :
hand . addBet ( street , action . group ( ' PNAME ' ) , action . group ( ' BET ' ) )
elif action . group ( ' ATYPE ' ) == ' folds ' :
hand . addFold ( street , action . group ( ' PNAME ' ) )
elif action . group ( ' ATYPE ' ) == ' checks ' :
hand . addCheck ( street , action . group ( ' PNAME ' ) )
else :
2010-08-29 21:10:57 +02:00
print _ ( " FullTilt: DEBUG: unimplemented readAction: ' %s ' ' %s ' " ) % ( action . group ( ' PNAME ' ) , action . group ( ' ATYPE ' ) , )
2008-12-16 18:26:58 +01:00
2008-12-16 15:45:58 +01:00
def readShowdownActions ( self , hand ) :
2009-03-04 16:10:08 +01:00
for shows in self . re_ShowdownAction . finditer ( hand . handText ) :
2008-12-16 15:45:58 +01:00
cards = shows . group ( ' CARDS ' )
2009-03-02 16:10:15 +01:00
cards = cards . split ( ' ' )
2008-12-16 15:45:58 +01:00
hand . addShownCards ( cards , shows . group ( ' PNAME ' ) )
def readCollectPot ( self , hand ) :
2009-03-04 16:10:08 +01:00
for m in self . re_CollectPot . finditer ( hand . handText ) :
2009-08-16 20:01:36 +02:00
hand . addCollectPot ( player = m . group ( ' PNAME ' ) , pot = re . sub ( u ' , ' , u ' ' , m . group ( ' POT ' ) ) )
2008-12-16 18:26:58 +01:00
def readShownCards ( self , hand ) :
2009-03-04 16:10:08 +01:00
for m in self . re_ShownCards . finditer ( hand . handText ) :
2008-12-16 15:45:58 +01:00
if m . group ( ' CARDS ' ) is not None :
2010-01-31 19:37:59 +01:00
if m . group ( ' ACT ' ) :
hand . addShownCards ( cards = m . group ( ' CARDS ' ) . split ( ' ' ) , player = m . group ( ' PNAME ' ) , shown = False , mucked = True )
else :
hand . addShownCards ( cards = m . group ( ' CARDS ' ) . split ( ' ' ) , player = m . group ( ' PNAME ' ) , shown = True , mucked = False )
2008-12-16 15:45:58 +01:00
2009-07-20 16:01:51 +02:00
def guessMaxSeats ( self , hand ) :
""" Return a guess at max_seats when not specified in HH. """
mo = self . maxOccSeat ( hand )
if mo == 10 : return 10 #that was easy
if hand . gametype [ ' base ' ] == ' stud ' :
if mo < = 8 : return 8
else : return mo
if hand . gametype [ ' base ' ] == ' draw ' :
if mo < = 6 : return 6
else : return mo
if mo == 2 : return 2
if mo < = 6 : return 6
return 9
2009-07-22 16:24:29 +02:00
def readOther ( self , hand ) :
m = self . re_Mixed . search ( self . in_path )
2009-11-03 20:30:52 +01:00
if m is None :
hand . mixed = None
2009-07-22 16:24:29 +02:00
else :
hand . mixed = self . mixes [ m . groupdict ( ) [ ' MIXED ' ] ]
2008-12-16 15:45:58 +01:00
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
def readSummaryInfo ( self , summaryInfoList ) :
self . status = True
2010-07-09 01:10:06 +02:00
#m = re.search("Tournament Summary", summaryInfoList[0])
#if m:
# # info list should be 2 lines : Tourney infos & Finsihing postions with winnings
# if (len(summaryInfoList) != 2 ):
# log.info("Too many or too few lines (%d) in file '%s' : '%s'" % (len(summaryInfoList), self.in_path, summaryInfoList) )
# self.status = False
# else:
# self.tourney = TourneySummary.TourneySummary(sitename = self.sitename, gametype = None, summaryText = summaryInfoList, builtFrom = "HHC")
# self.status = self.getPlayersPositionsAndWinnings(self.tourney)
# if self.status == True :
# self.status = self.determineTourneyType(self.tourney)
# #print self.tourney
# else:
# log.info("Parsing NOK : rejected")
#else:
# log.info( "This is not a summary file : '%s'" % (self.in_path) )
# self.status = False
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
return self . status
def determineTourneyType ( self , tourney ) :
info = { ' type ' : ' tour ' }
tourneyText = tourney . summaryText [ 0 ]
#print "Examine : '%s'" %(tourneyText)
m = self . re_TourneyInfo . search ( tourneyText )
if not m :
2010-08-29 21:10:57 +02:00
log . info ( _ ( " determineTourneyType : Parsing NOK " ) )
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
return False
mg = m . groupdict ( )
#print mg
# translations from captured groups to our info strings
limits = { ' No Limit ' : ' nl ' , ' Pot Limit ' : ' pl ' , ' Limit ' : ' fl ' }
games = { # base, category
" Hold ' em " : ( ' hold ' , ' holdem ' ) ,
' Omaha Hi ' : ( ' hold ' , ' omahahi ' ) ,
' Omaha H/L ' : ( ' hold ' , ' omahahilo ' ) ,
' Razz ' : ( ' stud ' , ' razz ' ) ,
' Stud Hi ' : ( ' stud ' , ' studhi ' ) ,
' Stud H/L ' : ( ' stud ' , ' studhilo ' )
}
currencies = { u ' € ' : ' EUR ' , ' $ ' : ' USD ' , ' ' : ' T$ ' }
info [ ' limitType ' ] = limits [ mg [ ' LIMIT ' ] ]
if mg [ ' GAME ' ] is not None :
( info [ ' base ' ] , info [ ' category ' ] ) = games [ mg [ ' GAME ' ] ]
if mg [ ' CURRENCY ' ] is not None :
info [ ' currency ' ] = currencies [ mg [ ' CURRENCY ' ] ]
2009-11-03 20:30:52 +01:00
if mg [ ' TOURNO ' ] is None :
info [ ' type ' ] = " ring "
else :
info [ ' type ' ] = " tour "
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
# NB: SB, BB must be interpreted as blinds or bets depending on limit type.
# Info is now ready to be copied in the tourney object
tourney . gametype = info
# Additional info can be stored in the tourney object
if mg [ ' BUYIN ' ] is not None :
2010-12-20 07:25:58 +01:00
tourney . buyin = 100 * Decimal ( self . clearMoneyString ( mg [ ' BUYIN ' ] ) )
2009-09-01 23:46:46 +02:00
tourney . fee = 0
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
if mg [ ' FEE ' ] is not None :
2010-12-20 07:25:58 +01:00
tourney . fee = 100 * Decimal ( self . clearMoneyString ( mg [ ' FEE ' ] ) )
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
if mg [ ' TOURNAMENT_NAME ' ] is not None :
# Tournament Name can have a trailing space at the end (depending on the tournament description)
tourney . tourneyName = mg [ ' TOURNAMENT_NAME ' ] . rstrip ( )
if mg [ ' SPECIAL ' ] is not None :
special = mg [ ' SPECIAL ' ]
if special == " KO " :
tourney . isKO = True
if special == " Heads Up " :
tourney . maxseats = 2
if re . search ( " Matrix " , special ) :
tourney . isMatrix = True
if special == " Rebuy " :
tourney . isRebuy = True
2009-08-26 01:13:34 +02:00
if special == " Madness " :
tourney . tourneyComment = " Madness "
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
if mg [ ' SHOOTOUT ' ] is not None :
tourney . isShootout = True
if mg [ ' TURBO1 ' ] is not None or mg [ ' TURBO2 ' ] is not None :
tourney . speed = " Turbo "
if mg [ ' TOURNO ' ] is not None :
tourney . tourNo = mg [ ' TOURNO ' ]
else :
2010-08-29 21:10:57 +02:00
log . info ( _ ( " Unable to get a valid Tournament ID -- File rejected " ) )
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
return False
if tourney . isMatrix :
if mg [ ' MATCHNO ' ] is not None :
tourney . matrixMatchId = mg [ ' MATCHNO ' ]
else :
tourney . matrixMatchId = 0
# Get BuyIn/Fee
# Try and deal with the different cases that can occur :
# - No buy-in/fee can be on the first line (freerolls, Satellites sometimes ?, ...) but appears in the rest of the description ==> use this one
# - Buy-In/Fee from the first line differs from the rest of the description :
# * OK in matrix tourneys (global buy-in dispatched between the different matches)
# * NOK otherwise ==> issue a warning and store specific data as if were a Matrix Tourney
# - If no buy-in/fee can be found : assume it's a freeroll
m = self . re_TourneyBuyInFee . search ( tourneyText )
if m is not None :
mg = m . groupdict ( )
if tourney . isMatrix :
if mg [ ' BUYIN ' ] is not None :
2010-12-20 07:25:58 +01:00
tourney . subTourneyBuyin = 100 * Decimal ( self . clearMoneyString ( mg [ ' BUYIN ' ] ) )
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
tourney . subTourneyFee = 0
if mg [ ' FEE ' ] is not None :
2010-12-20 07:25:58 +01:00
tourney . subTourneyFee = 100 * Decimal ( self . clearMoneyString ( mg [ ' FEE ' ] ) )
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
else :
if mg [ ' BUYIN ' ] is not None :
if tourney . buyin is None :
2010-12-20 07:25:58 +01:00
tourney . buyin = 100 * Decimal ( clearMoneyString ( mg [ ' BUYIN ' ] ) )
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
else :
2010-12-20 07:25:58 +01:00
if 100 * Decimal ( clearMoneyString ( mg [ ' BUYIN ' ] ) ) != tourney . buyin :
2010-08-29 21:10:57 +02:00
log . error ( _ ( " Conflict between buyins read in topline ( %s ) and in BuyIn field ( %s ) " ) % ( tourney . buyin , 100 * Decimal ( re . sub ( u ' , ' , u ' ' , " %s " % mg [ ' BUYIN ' ] ) ) ) )
2010-12-20 07:25:58 +01:00
tourney . subTourneyBuyin = 100 * Decimal ( clearMoneyString ( mg [ ' BUYIN ' ] ) )
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
if mg [ ' FEE ' ] is not None :
if tourney . fee is None :
2010-12-20 07:25:58 +01:00
tourney . fee = 100 * Decimal ( clearMoneyString ( mg [ ' FEE ' ] ) )
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
else :
2010-12-20 07:25:58 +01:00
if 100 * Decimal ( clearMoneyString ( mg [ ' FEE ' ] ) ) != tourney . fee :
log . error ( _ ( " Conflict between fees read in topline ( %s ) and in BuyIn field ( %s ) " ) % ( tourney . fee , 100 * Decimal ( clearMoneyString ( mg [ ' FEE ' ] ) ) ) )
tourney . subTourneyFee = 100 * Decimal ( clearMoneyString ( mg [ ' FEE ' ] ) )
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
if tourney . buyin is None :
2010-08-29 21:10:57 +02:00
log . info ( _ ( " Unable to affect a buyin to this tournament : assume it ' s a freeroll " ) )
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
tourney . buyin = 0
tourney . fee = 0
else :
if tourney . fee is None :
#print "Couldn't initialize fee, even though buyin went OK : assume there are no fees"
tourney . fee = 0
#Get single line infos
dictRegex = { " BUYINCHIPS " : self . re_TourneyBuyInChips ,
" ENTRIES " : self . re_TourneyEntries ,
" PRIZEPOOL " : self . re_TourneyPrizePool ,
2010-06-25 11:02:01 +02:00
" REBUY_COST " : self . re_TourneyRebuyCost ,
" ADDON_COST " : self . re_TourneyAddOnCost ,
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
" REBUY_TOTAL " : self . re_TourneyRebuysTotal ,
" ADDONS_TOTAL " : self . re_TourneyAddOnsTotal ,
" REBUY_CHIPS " : self . re_TourneyRebuyChips ,
" ADDON_CHIPS " : self . re_TourneyAddOnChips ,
" STARTTIME " : self . re_TourneyTimeInfo ,
" KO_BOUNTY_AMOUNT " : self . re_TourneyKOBounty ,
}
dictHolders = { " BUYINCHIPS " : " buyInChips " ,
" ENTRIES " : " entries " ,
" PRIZEPOOL " : " prizepool " ,
2010-06-25 11:02:01 +02:00
" REBUY_COST " : " rebuyCost " ,
" ADDON_COST " : " addOnCost " ,
2010-06-21 16:45:15 +02:00
" REBUY_TOTAL " : " totalRebuyCount " ,
" ADDONS_TOTAL " : " totalAddOnCount " ,
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
" REBUY_CHIPS " : " rebuyChips " ,
" ADDON_CHIPS " : " addOnChips " ,
" STARTTIME " : " starttime " ,
2009-09-03 02:11:38 +02:00
" KO_BOUNTY_AMOUNT " : " koBounty "
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
}
mg = { } # After the loop, mg will contain all the matching groups, including the ones that have not been used, like ENDTIME and IN-PROGRESS
for data in dictRegex :
m = dictRegex . get ( data ) . search ( tourneyText )
if m is not None :
mg . update ( m . groupdict ( ) )
setattr ( tourney , dictHolders [ data ] , mg [ data ] )
if mg [ ' IN_PROGRESS ' ] is not None or mg [ ' ENDTIME ' ] is not None :
# Assign endtime to tourney (if None, that's ok, it's because the tourney wans't over over when the summary file was produced)
tourney . endtime = mg [ ' ENDTIME ' ]
2009-09-03 02:11:38 +02:00
# Deal with hero specific information
if tourney . hero is not None :
m = self . re_TourneyRebuyCount . search ( tourneyText )
if m is not None :
mg = m . groupdict ( )
if mg [ ' REBUY_COUNT ' ] is not None :
2010-06-25 11:02:01 +02:00
tourney . rebuyCounts . update ( { tourney . hero : Decimal ( mg [ ' REBUY_COUNT ' ] ) } )
2009-09-03 02:11:38 +02:00
m = self . re_TourneyAddOnCount . search ( tourneyText )
if m is not None :
mg = m . groupdict ( )
if mg [ ' ADDON_COUNT ' ] is not None :
2010-06-25 11:02:01 +02:00
tourney . addOnCounts . update ( { tourney . hero : Decimal ( mg [ ' ADDON_COUNT ' ] ) } )
m = self . re_TourneyKoCount . search ( tourneyText )
2009-09-03 02:11:38 +02:00
if m is not None :
mg = m . groupdict ( )
if mg [ ' COUNT_KO ' ] is not None :
2010-06-25 11:02:01 +02:00
tourney . koCounts . update ( { tourney . hero : Decimal ( mg [ ' COUNT_KO ' ] ) } )
2009-09-03 02:11:38 +02:00
2009-09-01 23:46:46 +02:00
# Deal with money amounts
2010-12-20 07:25:58 +01:00
tourney . koBounty = 100 * Decimal ( clearMoneyString ( tourney . koBounty ) )
tourney . prizepool = 100 * Decimal ( clearMoneyString ( tourney . prizepool ) )
tourney . rebuyCost = 100 * Decimal ( clearMoneyString ( tourney . rebuyCost ) )
tourney . addOnCost = 100 * Decimal ( clearMoneyString ( tourney . addOnCost ) )
2009-09-03 02:11:38 +02:00
# Calculate payin amounts and update winnings -- not possible to take into account nb of rebuys, addons or Knockouts for other players than hero on FTP
for p in tourney . players :
if tourney . isKO :
2010-06-25 11:02:01 +02:00
#tourney.incrementPlayerWinnings(tourney.players[p], Decimal(tourney.koBounty)*Decimal(tourney.koCounts[p]))
tourney . winnings [ p ] + = Decimal ( tourney . koBounty ) * Decimal ( tourney . koCounts [ p ] )
2009-09-03 02:11:38 +02:00
#print "player %s : winnings %d" % (p, tourney.winnings[p])
2009-09-01 23:46:46 +02:00
#print mg
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
return True
2010-06-25 11:02:01 +02:00
#end def determineTourneyType
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
def getPlayersPositionsAndWinnings ( self , tourney ) :
playersText = tourney . summaryText [ 1 ]
#print "Examine : '%s'" %(playersText)
2010-06-21 17:12:20 +02:00
m = self . re_TourneysPlayersSummary . finditer ( playersText )
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
for a in m :
if a . group ( ' PNAME ' ) is not None and a . group ( ' RANK ' ) is not None :
if a . group ( ' RANK ' ) == " Still Playing " :
rank = - 1
else :
rank = Decimal ( a . group ( ' RANK ' ) )
if a . group ( ' WINNING ' ) is not None :
2010-12-20 07:25:58 +01:00
winnings = 100 * Decimal ( clearMoneyString ( a . group ( ' WINNING ' ) ) )
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
else :
winnings = " 0 "
2010-07-04 23:42:57 +02:00
tourney . addPlayer ( rank , a . group ( ' PNAME ' ) , winnings , " USD " , 0 , 0 , 0 ) #TODO: make it store actual winnings currency
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
else :
2010-08-29 21:10:57 +02:00
print ( _ ( " FullTilt: Player finishing stats unreadable : %s " ) % a )
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
2009-09-03 02:11:38 +02:00
# Find Hero
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
n = self . re_TourneyHeroFinishingP . search ( playersText )
if n is not None :
heroName = n . group ( ' HERO_NAME ' )
tourney . hero = heroName
# Is this really useful ?
2010-07-07 06:58:42 +02:00
if heroName not in tourney . ranks :
2010-08-29 21:10:57 +02:00
print ( _ ( " FullTilt: %s not found in tourney.ranks ... " ) % heroName )
2010-07-07 06:58:42 +02:00
elif ( tourney . ranks [ heroName ] != Decimal ( n . group ( ' HERO_FINISHING_POS ' ) ) ) :
2010-08-29 21:10:57 +02:00
print ( _ ( " FullTilt: Bad parsing : finish position incoherent : %s / %s " ) % ( tourney . ranks [ heroName ] , n . group ( ' HERO_FINISHING_POS ' ) ) )
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00
return True
2008-12-16 15:45:58 +01:00
if __name__ == " __main__ " :
2009-03-02 22:48:30 +01:00
parser = OptionParser ( )
2010-08-29 21:10:57 +02:00
parser . add_option ( " -i " , " --input " , dest = " ipath " , help = _ ( " parse input hand history " ) , default = " regression-test-files/fulltilt/razz/FT20090223 Danville - $0.50-$1 Ante $0.10 - Limit Razz.txt " )
parser . add_option ( " -o " , " --output " , dest = " opath " , help = _ ( " output translation to " ) , default = " - " )
parser . add_option ( " -f " , " --follow " , dest = " follow " , help = _ ( " follow (tail -f) the input " ) , action = " store_true " , default = False )
2009-03-02 22:48:30 +01:00
parser . add_option ( " -q " , " --quiet " ,
action = " store_const " , const = logging . CRITICAL , dest = " verbosity " , default = logging . INFO )
parser . add_option ( " -v " , " --verbose " ,
action = " store_const " , const = logging . INFO , dest = " verbosity " )
parser . add_option ( " --vv " ,
action = " store_const " , const = logging . DEBUG , dest = " verbosity " )
( options , args ) = parser . parse_args ( )
2009-03-13 21:00:12 +01:00
e = Fulltilt ( in_path = options . ipath , out_path = options . opath , follow = options . follow )
First attempt to parsing summary files from FTP
modified: FulltiltToFpdb.py
* Modified re_HandInfo regex to take into account Matrix Tournament Hands Histories
* Add Regex for Tourney Summaries files parsing
* New methods : readSummaryInfo, determineTourneyType, getPlayersPositionsAndWinnings
modified: HandHistoryConverter.py
* Add a Tourney object in the attributes to allow storing the summary info retrieved and the ability to hand it over after parsing
* Add a new attribut parsedObjectType (string : "HH" or "Summary")
* In follow = False mode : read the first line to swicth between HH & Summary parsing
* TO DO : Deal with parsing summary files in follow = True mode
* New methods added : isSummary, getParsedObjectType (to be called in fpdb_import), readSummaryInfo : abstract (to be implemented in each specific HHC), getTourney (returns the new attribute)
new file: Tourney.py
* New object
* Lots of attributes regarding the tourney info (buy-in, fee, entries, speed, Rebuy/add-on info, starting chips, KnockOut info, isHeadsUp, isShootout, isMatrix, ...
* List of players with finishing positions (when available) and winnings (when available)
* Methods :
** addPlayer(self, rank, name, winnings)
** incrementPlayerWinnings(self, name, additionnalWinnings): used for KO tourneys when KO occured (for Hero only)
** calculatePayinAmount : unused yet, should be necessary for DB storage
** some Hand methods copied that are still to be done including : assemble and insert
** TO DO : write the insert method for the object to be stored in DB. This will have to deal with the fact that the DB write can occur both before (Bulk Import) or after the HH file info has been stored (tourney might or might not already exist)
modified: fpdb_import.py
* import_file_dict modified :
** after the construction of the hhc, it now calls the new getParsedObjectType method of HHC in order to know what has been parsed by the HHC
** If it's a hand history file (actual expected behaviour) : do as before
** If it's a summary file, gets the tourney object that has been built from the hhc and calls the insert method on it (similar to NEWIMPORT=True for HH)
2009-08-22 00:09:34 +02:00