Merge branch 'master' of git://git.assembla.com/fpdboz.git
This commit is contained in:
commit
d6176ff753
|
@ -142,10 +142,12 @@ class GuiBulkImport():
|
||||||
"""returns the vbox of this thread"""
|
"""returns the vbox of this thread"""
|
||||||
return self.vbox
|
return self.vbox
|
||||||
|
|
||||||
def __init__(self, settings, config, sql = None):
|
def __init__(self, settings, config, parent, sql = None):
|
||||||
self.settings = settings
|
self.settings = settings
|
||||||
self.config = config
|
self.config = config
|
||||||
self.importer = fpdb_import.Importer(self, self.settings, config, sql)
|
self.parent = parent
|
||||||
|
|
||||||
|
self.importer = fpdb_import.Importer(self, self.settings, config,parent, sql)
|
||||||
|
|
||||||
self.vbox = gtk.VBox(False, 0)
|
self.vbox = gtk.VBox(False, 0)
|
||||||
self.vbox.show()
|
self.vbox.show()
|
||||||
|
@ -385,7 +387,7 @@ def main(argv=None):
|
||||||
print _('-q is deprecated. Just use "-f filename" instead')
|
print _('-q is deprecated. Just use "-f filename" instead')
|
||||||
# This is because -q on its own causes an error, so -f is necessary and sufficient for cmd line use
|
# This is because -q on its own causes an error, so -f is necessary and sufficient for cmd line use
|
||||||
if not options.filename:
|
if not options.filename:
|
||||||
i = GuiBulkImport(settings, config)
|
i = GuiBulkImport(settings, config, None)
|
||||||
main_window = gtk.Window()
|
main_window = gtk.Window()
|
||||||
main_window.connect('destroy', destroy)
|
main_window.connect('destroy', destroy)
|
||||||
main_window.add(i.vbox)
|
main_window.add(i.vbox)
|
||||||
|
@ -393,7 +395,7 @@ def main(argv=None):
|
||||||
gtk.main()
|
gtk.main()
|
||||||
else:
|
else:
|
||||||
#Do something useful
|
#Do something useful
|
||||||
importer = fpdb_import.Importer(False,settings, config)
|
importer = fpdb_import.Importer(False,settings, config, self.parent)
|
||||||
# importer.setDropIndexes("auto")
|
# importer.setDropIndexes("auto")
|
||||||
importer.setDropIndexes(_("don't drop"))
|
importer.setDropIndexes(_("don't drop"))
|
||||||
importer.setFailOnError(options.failOnError)
|
importer.setFailOnError(options.failOnError)
|
||||||
|
|
|
@ -268,7 +268,7 @@ class GuiTourneyGraphViewer (threading.Thread):
|
||||||
if len(winnings) == 0:
|
if len(winnings) == 0:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
green = map(lambda x:float(x[0]), winnings)
|
green = map(lambda x:float(x[1]), winnings)
|
||||||
#blue = map(lambda x: float(x[1]) if x[2] == True else 0.0, winnings)
|
#blue = map(lambda x: float(x[1]) if x[2] == True else 0.0, winnings)
|
||||||
#red = map(lambda x: float(x[1]) if x[2] == False else 0.0, winnings)
|
#red = map(lambda x: float(x[1]) if x[2] == False else 0.0, winnings)
|
||||||
greenline = cumsum(green)
|
greenline = cumsum(green)
|
||||||
|
|
|
@ -20,8 +20,18 @@
|
||||||
#see http://tools.ietf.org/html/rfc2060#section-6.4.4 for IMAP4 search criteria
|
#see http://tools.ietf.org/html/rfc2060#section-6.4.4 for IMAP4 search criteria
|
||||||
|
|
||||||
from imaplib import IMAP4, IMAP4_SSL
|
from imaplib import IMAP4, IMAP4_SSL
|
||||||
|
import sys
|
||||||
|
import codecs
|
||||||
|
import re
|
||||||
|
|
||||||
|
import Configuration
|
||||||
|
import Database
|
||||||
|
from Exceptions import FpdbParseError
|
||||||
|
import SQL
|
||||||
|
import Options
|
||||||
import PokerStarsSummary
|
import PokerStarsSummary
|
||||||
|
|
||||||
|
|
||||||
import locale
|
import locale
|
||||||
lang=locale.getdefaultlocale()[0][0:2]
|
lang=locale.getdefaultlocale()[0][0:2]
|
||||||
if lang=="en":
|
if lang=="en":
|
||||||
|
@ -63,26 +73,34 @@ def run(config, db):
|
||||||
response, searchData = server.search(None, "SUBJECT", "PokerStars Tournament History Request")
|
response, searchData = server.search(None, "SUBJECT", "PokerStars Tournament History Request")
|
||||||
for messageNumber in searchData[0].split(" "):
|
for messageNumber in searchData[0].split(" "):
|
||||||
response, headerData = server.fetch(messageNumber, "(BODY[HEADER.FIELDS (SUBJECT)])")
|
response, headerData = server.fetch(messageNumber, "(BODY[HEADER.FIELDS (SUBJECT)])")
|
||||||
#print "response to fetch subject:",response
|
|
||||||
if response!="OK":
|
if response!="OK":
|
||||||
raise error #TODO: show error message
|
raise error #TODO: show error message
|
||||||
neededMessages.append(("PS", messageNumber))
|
neededMessages.append(("PS", messageNumber))
|
||||||
|
|
||||||
|
print "ImapFetcher: Found %s messages to fetch" %(len(neededMessages))
|
||||||
|
|
||||||
if (len(neededMessages)==0):
|
if (len(neededMessages)==0):
|
||||||
raise error #TODO: show error message
|
raise error #TODO: show error message
|
||||||
for messageData in neededMessages:
|
|
||||||
|
errors = 0
|
||||||
|
for i, messageData in enumerate(neededMessages, start=1):
|
||||||
|
print "Retrieving message %s" % i
|
||||||
response, bodyData = server.fetch(messageData[1], "(UID BODY[TEXT])")
|
response, bodyData = server.fetch(messageData[1], "(UID BODY[TEXT])")
|
||||||
bodyData=bodyData[0][1]
|
bodyData=bodyData[0][1]
|
||||||
if response!="OK":
|
if response!="OK":
|
||||||
raise error #TODO: show error message
|
raise error #TODO: show error message
|
||||||
if messageData[0]=="PS":
|
if messageData[0]=="PS":
|
||||||
summaryTexts=(splitPokerStarsSummaries(bodyData))
|
summaryTexts=(splitPokerStarsSummaries(bodyData))
|
||||||
for summaryText in summaryTexts:
|
print "Found %s summaries in email" %(len(summaryTexts))
|
||||||
|
for j, summaryText in enumerate(summaryTexts, start=1):
|
||||||
|
try:
|
||||||
result=PokerStarsSummary.PokerStarsSummary(db=db, config=config, siteName=u"PokerStars", summaryText=summaryText, builtFrom = "IMAP")
|
result=PokerStarsSummary.PokerStarsSummary(db=db, config=config, siteName=u"PokerStars", summaryText=summaryText, builtFrom = "IMAP")
|
||||||
#print "finished importing a PS summary with result:",result
|
except FpdbParseError, e:
|
||||||
#TODO: count results and output to shell like hand importer does
|
errors += 1
|
||||||
|
print "Finished importing %s/%s PS summaries" %(j, len(summaryTexts))
|
||||||
|
|
||||||
print _("completed running Imap import, closing server connection")
|
print _("Completed running Imap import, closing server connection")
|
||||||
|
print _("Errors: %s" % errors)
|
||||||
#finally:
|
#finally:
|
||||||
# try:
|
# try:
|
||||||
server.close()
|
server.close()
|
||||||
|
@ -90,3 +108,52 @@ def run(config, db):
|
||||||
# pass
|
# pass
|
||||||
server.logout()
|
server.logout()
|
||||||
|
|
||||||
|
def readFile(filename):
|
||||||
|
kodec = "utf8"
|
||||||
|
in_fh = codecs.open(filename, 'r', kodec)
|
||||||
|
whole_file = in_fh.read()
|
||||||
|
in_fh.close()
|
||||||
|
return whole_file
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def runFake(db, config, infile):
|
||||||
|
summaryText = readFile(infile)
|
||||||
|
# This regex should be part of PokerStarsSummary
|
||||||
|
re_SplitGames = re.compile("PokerStars Tournament ")
|
||||||
|
summaryList = re.split(re_SplitGames, summaryText)
|
||||||
|
|
||||||
|
if len(summaryList) <= 1:
|
||||||
|
print "DEBUG: re_SplitGames isn't matching"
|
||||||
|
|
||||||
|
for summary in summaryList[1:]:
|
||||||
|
result = PokerStarsSummary.PokerStarsSummary(db=db, config=config, siteName=u"PokerStars", summaryText=summary, builtFrom = "file")
|
||||||
|
print "DEBUG: Processed: %s: tournNo: %s" % (result.tourneyId, result.tourNo)
|
||||||
|
|
||||||
|
|
||||||
|
def main(argv=None):
|
||||||
|
if argv is None:
|
||||||
|
argv = sys.argv[1:]
|
||||||
|
|
||||||
|
(options, argv) = Options.fpdb_options()
|
||||||
|
|
||||||
|
if options.usage == True:
|
||||||
|
#Print usage examples and exit
|
||||||
|
print _("USAGE:")
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
# These options should really come from the OptionsParser
|
||||||
|
config = Configuration.Config()
|
||||||
|
db = Database.Database(config)
|
||||||
|
sql = SQL.Sql(db_server = 'sqlite')
|
||||||
|
settings = {}
|
||||||
|
settings.update(config.get_db_parameters())
|
||||||
|
settings.update(config.get_import_parameters())
|
||||||
|
settings.update(config.get_default_paths())
|
||||||
|
db.recreate_tables()
|
||||||
|
|
||||||
|
runFake(db, config, options.infile)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.exit(main())
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ class OnGame(HandHistoryConverter):
|
||||||
# 'Razz' : ('stud','razz'),
|
# 'Razz' : ('stud','razz'),
|
||||||
# 'RAZZ' : ('stud','razz'),
|
# 'RAZZ' : ('stud','razz'),
|
||||||
# '7 Card Stud' : ('stud','studhi'),
|
# '7 Card Stud' : ('stud','studhi'),
|
||||||
# '7 Card Stud Hi/Lo' : ('stud','studhilo'),
|
'SEVEN_CARD_STUD_HI_LO' : ('stud','studhilo'),
|
||||||
# 'Badugi' : ('draw','badugi'),
|
# 'Badugi' : ('draw','badugi'),
|
||||||
# 'Triple Draw 2-7 Lowball' : ('draw','27_3draw'),
|
# 'Triple Draw 2-7 Lowball' : ('draw','27_3draw'),
|
||||||
# '5 Card Draw' : ('draw','fivedraw')
|
# '5 Card Draw' : ('draw','fivedraw')
|
||||||
|
@ -117,8 +117,6 @@ class OnGame(HandHistoryConverter):
|
||||||
(?P<Y>[0-9]{4})
|
(?P<Y>[0-9]{4})
|
||||||
""", re.MULTILINE|re.VERBOSE)
|
""", re.MULTILINE|re.VERBOSE)
|
||||||
|
|
||||||
# self.rexx.button_re = re.compile('#SUMMARY\nDealer: (?P<BUTTONPNAME>.*)\n')
|
|
||||||
|
|
||||||
#Seat 1: .Lucchess ($4.17 in chips)
|
#Seat 1: .Lucchess ($4.17 in chips)
|
||||||
#Seat 1: phantomaas ($27.11)
|
#Seat 1: phantomaas ($27.11)
|
||||||
#Seat 5: mleo17 ($9.37)
|
#Seat 5: mleo17 ($9.37)
|
||||||
|
@ -165,6 +163,7 @@ class OnGame(HandHistoryConverter):
|
||||||
return [
|
return [
|
||||||
["ring", "hold", "fl"],
|
["ring", "hold", "fl"],
|
||||||
["ring", "hold", "nl"],
|
["ring", "hold", "nl"],
|
||||||
|
["ring", "stud", "fl"],
|
||||||
]
|
]
|
||||||
|
|
||||||
def determineGameType(self, handText):
|
def determineGameType(self, handText):
|
||||||
|
|
|
@ -60,6 +60,9 @@ def fpdb_options():
|
||||||
default = 'EMPTY')
|
default = 'EMPTY')
|
||||||
parser.add_option("-v", "--version", action = "store_true",
|
parser.add_option("-v", "--version", action = "store_true",
|
||||||
help = _("Print version information and exit."))
|
help = _("Print version information and exit."))
|
||||||
|
parser.add_option("-u", "--usage", action="store_true", dest="usage", default=False,
|
||||||
|
help=_("Print some useful one liners"))
|
||||||
|
|
||||||
|
|
||||||
(options, argv) = parser.parse_args()
|
(options, argv) = parser.parse_args()
|
||||||
return (options, argv)
|
return (options, argv)
|
||||||
|
|
|
@ -37,8 +37,6 @@ else:
|
||||||
except IOError:
|
except IOError:
|
||||||
def _(string): return string
|
def _(string): return string
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PokerStarsSummary(TourneySummary):
|
class PokerStarsSummary(TourneySummary):
|
||||||
limits = { 'No Limit':'nl', 'Pot Limit':'pl', 'Limit':'fl', 'LIMIT':'fl' }
|
limits = { 'No Limit':'nl', 'Pot Limit':'pl', 'Limit':'fl', 'LIMIT':'fl' }
|
||||||
games = { # base, category
|
games = { # base, category
|
||||||
|
@ -54,15 +52,41 @@ class PokerStarsSummary(TourneySummary):
|
||||||
'5 Card Draw' : ('draw','fivedraw')
|
'5 Card Draw' : ('draw','fivedraw')
|
||||||
}
|
}
|
||||||
|
|
||||||
re_TourNo = re.compile("\#[0-9]+,")
|
substitutions = {
|
||||||
|
'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes
|
||||||
|
'LS' : "\$|\xe2\x82\xac|" # legal currency symbols - Euro(cp1252, utf-8)
|
||||||
|
}
|
||||||
|
|
||||||
|
re_SplitGames = re.compile("^PokerStars")
|
||||||
|
|
||||||
|
re_TourNo = re.compile("\#(?P<TOURNO>[0-9]+),")
|
||||||
|
|
||||||
|
re_TourneyInfo = re.compile(u"""
|
||||||
|
\#(?P<TOURNO>[0-9]+),\s
|
||||||
|
(?P<LIMIT>No\sLimit|Limit|LIMIT|Pot\sLimit)\s
|
||||||
|
(?P<GAME>Hold\'em|Razz|RAZZ|7\sCard\sStud|7\sCard\sStud\sHi/Lo|Omaha|Omaha\sHi/Lo|Badugi|Triple\sDraw\s2\-7\sLowball|5\sCard\sDraw)\s+
|
||||||
|
(?P<DESC>[ a-zA-Z]+\s+)?
|
||||||
|
(Buy-In:\s\$(?P<BUYIN>[.0-9]+)(\/\$(?P<FEE>[.0-9]+))?\s+)?
|
||||||
|
(?P<ENTRIES>[0-9]+)\splayers\s+
|
||||||
|
(\$?(?P<ADDED>[.\d]+)\sadded\sto\sthe\sprize\spool\sby\sPokerStars\.com\s+)?
|
||||||
|
(Total\sPrize\sPool:\s\$?(?P<PRIZEPOOL>[.0-9]+)\s+)?
|
||||||
|
(Target\sTournament\s.*)?
|
||||||
|
Tournament\sstarted\s-\s
|
||||||
|
(?P<Y>[0-9]{4})\/(?P<M>[0-9]{2})\/(?P<D>[0-9]{2})[\-\s]+(?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)\s?\(?(?P<TZ>[A-Z]+)\)\s
|
||||||
|
""" % substitutions ,re.VERBOSE|re.MULTILINE|re.DOTALL)
|
||||||
|
|
||||||
|
re_Currency = re.compile(u"""(?P<CURRENCY>[%(LS)s]|FPP)""" % substitutions)
|
||||||
|
|
||||||
|
re_Player = re.compile(u"""(?P<RANK>[0-9]+):\s(?P<NAME>.*)\s\(.*\),(\s)(\$(?P<WINNINGS>[0-9]+\.[0-9]+))?(?P<STILLPLAYING>still\splaying)?((?P<TICKET>Tournament\sTicket)\s\(WSOP\sStep\s(?P<LEVEL>\d)\))?\s+?""")
|
||||||
|
|
||||||
|
re_DateTime = re.compile("\[(?P<Y>[0-9]{4})\/(?P<M>[0-9]{2})\/(?P<D>[0-9]{2})[\- ]+(?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)")
|
||||||
|
|
||||||
re_Entries = re.compile("[0-9]+")
|
re_Entries = re.compile("[0-9]+")
|
||||||
re_Prizepool = re.compile("\$[0-9]+\.[0-9]+")
|
re_Prizepool = re.compile("\$[0-9]+\.[0-9]+")
|
||||||
re_Player = re.compile(u"""(?P<RANK>[0-9]+):\s(?P<NAME>.*)\s\(.*\),(\s)?(\$(?P<WINNINGS>[0-9]+\.[0-9]+))?(?P<STILLPLAYING>still\splaying)?""")
|
|
||||||
re_BuyInFee = re.compile("(?P<BUYIN>[0-9]+\.[0-9]+).*(?P<FEE>[0-9]+\.[0-9]+)")
|
re_BuyInFee = re.compile("(?P<BUYIN>[0-9]+\.[0-9]+).*(?P<FEE>[0-9]+\.[0-9]+)")
|
||||||
re_FPP = re.compile("(?P<FPP>[0-9]+)\sFPP")
|
re_FPP = re.compile("(?P<FPP>[0-9]+)\sFPP")
|
||||||
#note: the dollar and cent in the below line are currency-agnostic
|
#note: the dollar and cent in the below line are currency-agnostic
|
||||||
re_Added = re.compile("(?P<DOLLAR>[0-9]+)\.(?P<CENT>[0-9]+)\s(?P<CURRENCY>[A-Z]+)(\sadded\sto\sthe\sprize\spool\sby\sPokerStars)")
|
re_Added = re.compile("(?P<DOLLAR>[0-9]+)\.(?P<CENT>[0-9]+)\s(?P<CURRENCY>[A-Z]+)(\sadded\sto\sthe\sprize\spool\sby\sPokerStars)")
|
||||||
re_DateTime = re.compile("\[(?P<Y>[0-9]{4})\/(?P<M>[0-9]{2})\/(?P<D>[0-9]{2})[\- ]+(?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)")
|
|
||||||
re_DateTimeET = re.compile("(?P<Y>[0-9]{4})\/(?P<M>[0-9]{2})\/(?P<D>[0-9]{2})[\- ]+(?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)")
|
re_DateTimeET = re.compile("(?P<Y>[0-9]{4})\/(?P<M>[0-9]{2})\/(?P<D>[0-9]{2})[\- ]+(?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)")
|
||||||
re_GameInfo = re.compile(u""".+(?P<LIMIT>No\sLimit|Limit|LIMIT|Pot\sLimit)\s(?P<GAME>Hold\'em|Razz|RAZZ|7\sCard\sStud|7\sCard\sStud\sHi/Lo|Omaha|Omaha\sHi/Lo|Badugi|Triple\sDraw\s2\-7\sLowball|5\sCard\sDraw)""")
|
re_GameInfo = re.compile(u""".+(?P<LIMIT>No\sLimit|Limit|LIMIT|Pot\sLimit)\s(?P<GAME>Hold\'em|Razz|RAZZ|7\sCard\sStud|7\sCard\sStud\sHi/Lo|Omaha|Omaha\sHi/Lo|Badugi|Triple\sDraw\s2\-7\sLowball|5\sCard\sDraw)""")
|
||||||
|
|
||||||
|
@ -167,4 +191,72 @@ class PokerStarsSummary(TourneySummary):
|
||||||
|
|
||||||
self.addPlayer(rank, name, winnings, self.currency, None, None, None)#TODO: currency, ko/addon/rebuy count -> need examples!
|
self.addPlayer(rank, name, winnings, self.currency, None, None, None)#TODO: currency, ko/addon/rebuy count -> need examples!
|
||||||
#end def parseSummary
|
#end def parseSummary
|
||||||
|
|
||||||
|
def parseSummaryFile(self):
|
||||||
|
m = self.re_TourneyInfo.search(self.summaryText)
|
||||||
|
if m == None:
|
||||||
|
tmp = self.summaryText[0:200]
|
||||||
|
log.error(_("parseSummaryFile: Unable to recognise Tourney Info: '%s'") % tmp)
|
||||||
|
log.error(_("parseSummaryFile: Raising FpdbParseError"))
|
||||||
|
raise FpdbParseError(_("Unable to recognise Tourney Info: '%s'") % tmp)
|
||||||
|
|
||||||
|
#print "DEBUG: m.groupdict(): %s" % m.groupdict()
|
||||||
|
|
||||||
|
mg = m.groupdict()
|
||||||
|
if 'TOURNO' in mg: self.tourNo = mg['TOURNO']
|
||||||
|
if 'LIMIT' in mg: self.gametype['limitType'] = self.limits[mg['LIMIT']]
|
||||||
|
if 'GAME' in mg: self.gametype['category'] = self.games[mg['GAME']][1]
|
||||||
|
if mg['BUYIN'] != None:
|
||||||
|
self.buyin = int(100*Decimal(mg['BUYIN']))
|
||||||
|
if mg['FEE'] != None:
|
||||||
|
self.fee = int(100*Decimal(mg['FEE']))
|
||||||
|
if 'PRIZEPOOL' in mg: self.prizepool = mg['PRIZEPOOL']
|
||||||
|
if 'ENTRIES' in mg: self.entries = mg['ENTRIES']
|
||||||
|
|
||||||
|
datetimestr = "%s/%s/%s %s:%s:%s" % (mg['Y'], mg['M'], mg['D'], mg['H'], mg['MIN'], mg['S'])
|
||||||
|
self.startTime = datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S")
|
||||||
|
|
||||||
|
if 'TZ' in mg:
|
||||||
|
self.startTime = HandHistoryConverter.changeTimezone(self.startTime, mg['TZ'], "UTC")
|
||||||
|
|
||||||
|
|
||||||
|
m = self.re_Currency.search(self.summaryText)
|
||||||
|
if m == None:
|
||||||
|
log.error(_("parseSummaryFile: Unable to locate currency"))
|
||||||
|
log.error(_("parseSummaryFile: Raising FpdbParseError"))
|
||||||
|
raise FpdbParseError(_("Unable to locate currency"))
|
||||||
|
#print "DEBUG: m.groupdict(): %s" % m.groupdict()
|
||||||
|
|
||||||
|
mg = m.groupdict()
|
||||||
|
if mg['CURRENCY'] == "$": self.currency = "USD"
|
||||||
|
elif mg['CURRENCY'] == u"€": self.currency="EUR"
|
||||||
|
elif mg['CURRENCY'] == "FPP": self.currency="PSFP"
|
||||||
|
|
||||||
|
m = self.re_Player.finditer(self.summaryText)
|
||||||
|
for a in m:
|
||||||
|
mg = a.groupdict()
|
||||||
|
#print "DEBUG: a.groupdict(): %s" % mg
|
||||||
|
name = mg['NAME']
|
||||||
|
rank = mg['RANK']
|
||||||
|
winnings = 0
|
||||||
|
|
||||||
|
if 'WINNINGS' in mg and mg['WINNINGS'] != None:
|
||||||
|
winnings = int(100*Decimal(mg['WINNINGS']))
|
||||||
|
|
||||||
|
if 'STILLPLAYING' in mg and mg['STILLPLAYING'] != None:
|
||||||
|
#print "stillplaying"
|
||||||
|
rank=None
|
||||||
|
winnings=None
|
||||||
|
|
||||||
|
if 'TICKET' and mg['TICKET'] != None:
|
||||||
|
print "DEBUG: TODO! fix Step ticket values"
|
||||||
|
print "\tWinning = Level %s" % mg['LEVEL']
|
||||||
|
|
||||||
|
#TODO: currency, ko/addon/rebuy count -> need examples!
|
||||||
|
#print "DEBUG: addPlayer(%s, %s, %s, %s, None, None, None)" %(rank, name, winnings, self.currency)
|
||||||
|
#print "DEBUG: self.buyin: %s self.fee %s" %(self.buyin, self.fee)
|
||||||
|
self.addPlayer(rank, name, winnings, self.currency, None, None, None)
|
||||||
|
|
||||||
|
#print self
|
||||||
|
|
||||||
#end class PokerStarsSummary
|
#end class PokerStarsSummary
|
||||||
|
|
|
@ -3050,7 +3050,7 @@ class Sql:
|
||||||
# Tourney Results query
|
# Tourney Results query
|
||||||
####################################
|
####################################
|
||||||
self.query['tourneyResults'] = """
|
self.query['tourneyResults'] = """
|
||||||
SELECT (tp.winnings - tt.buyIn - tt.fee) as profit, tp.koCount, tp.rebuyCount, tp.addOnCount, tt.buyIn, tt.fee
|
SELECT tp.tourneyId, (tp.winnings - tt.buyIn - tt.fee) as profit, tp.koCount, tp.rebuyCount, tp.addOnCount, tt.buyIn, tt.fee, t.siteTourneyNo
|
||||||
FROM TourneysPlayers tp
|
FROM TourneysPlayers tp
|
||||||
INNER JOIN Players pl ON (pl.id = tp.playerId)
|
INNER JOIN Players pl ON (pl.id = tp.playerId)
|
||||||
INNER JOIN Tourneys t ON (t.id = tp.tourneyId)
|
INNER JOIN Tourneys t ON (t.id = tp.tourneyId)
|
||||||
|
|
|
@ -129,7 +129,7 @@ def main(argv=None):
|
||||||
settings.update(config.get_import_parameters())
|
settings.update(config.get_import_parameters())
|
||||||
settings.update(config.get_default_paths())
|
settings.update(config.get_default_paths())
|
||||||
db.recreate_tables()
|
db.recreate_tables()
|
||||||
importer = fpdb_import.Importer(False, settings, config)
|
importer = fpdb_import.Importer(False, settings, config, None)
|
||||||
importer.setDropIndexes("don't drop")
|
importer.setDropIndexes("don't drop")
|
||||||
importer.setFailOnError(True)
|
importer.setFailOnError(True)
|
||||||
importer.setThreads(-1)
|
importer.setThreads(-1)
|
||||||
|
|
|
@ -74,8 +74,8 @@ class TourneySummary(object):
|
||||||
self.endTime = None
|
self.endTime = None
|
||||||
self.tourNo = None
|
self.tourNo = None
|
||||||
self.currency = None
|
self.currency = None
|
||||||
self.buyin = None
|
self.buyin = 0
|
||||||
self.fee = None
|
self.fee = 0
|
||||||
self.hero = None
|
self.hero = None
|
||||||
self.maxseats = 0
|
self.maxseats = 0
|
||||||
self.entries = 0
|
self.entries = 0
|
||||||
|
@ -127,6 +127,9 @@ class TourneySummary(object):
|
||||||
if builtFrom=="IMAP":
|
if builtFrom=="IMAP":
|
||||||
self.parseSummary()
|
self.parseSummary()
|
||||||
self.insertOrUpdate()
|
self.insertOrUpdate()
|
||||||
|
elif builtFrom == "file":
|
||||||
|
self.parseSummaryFile()
|
||||||
|
self.insertOrUpdate()
|
||||||
#end def __init__
|
#end def __init__
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
|
@ -999,7 +999,7 @@ class fpdb:
|
||||||
|
|
||||||
def tab_bulk_import(self, widget, data=None):
|
def tab_bulk_import(self, widget, data=None):
|
||||||
"""opens a tab for bulk importing"""
|
"""opens a tab for bulk importing"""
|
||||||
new_import_thread = GuiBulkImport.GuiBulkImport(self.settings, self.config, self.sql)
|
new_import_thread = GuiBulkImport.GuiBulkImport(self.settings, self.config, self.window, self.sql)
|
||||||
self.threads.append(new_import_thread)
|
self.threads.append(new_import_thread)
|
||||||
bulk_tab=new_import_thread.get_vbox()
|
bulk_tab=new_import_thread.get_vbox()
|
||||||
self.add_and_display_tab(bulk_tab, _("Bulk Import"))
|
self.add_and_display_tab(bulk_tab, _("Bulk Import"))
|
||||||
|
|
|
@ -70,12 +70,13 @@ else:
|
||||||
psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
|
psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
|
||||||
|
|
||||||
class Importer:
|
class Importer:
|
||||||
def __init__(self, caller, settings, config, sql = None):
|
def __init__(self, caller, settings, config, parent, sql = None):
|
||||||
"""Constructor"""
|
"""Constructor"""
|
||||||
self.settings = settings
|
self.settings = settings
|
||||||
self.caller = caller
|
self.caller = caller
|
||||||
self.config = config
|
self.config = config
|
||||||
self.sql = sql
|
self.sql = sql
|
||||||
|
self.parent = parent
|
||||||
|
|
||||||
#log = Configuration.get_logger("logging.conf", "importer", log_dir=self.config.dir_log)
|
#log = Configuration.get_logger("logging.conf", "importer", log_dir=self.config.dir_log)
|
||||||
self.filelist = {}
|
self.filelist = {}
|
||||||
|
@ -301,7 +302,16 @@ class Importer:
|
||||||
totpartial = 0
|
totpartial = 0
|
||||||
toterrors = 0
|
toterrors = 0
|
||||||
tottime = 0
|
tottime = 0
|
||||||
|
progresscount = 0
|
||||||
|
progressgoal = len(self.filelist)
|
||||||
|
|
||||||
|
ProgressDialog = ProgressBar(self.parent)
|
||||||
|
|
||||||
for file in self.filelist:
|
for file in self.filelist:
|
||||||
|
|
||||||
|
progresscount += 1
|
||||||
|
ProgressDialog.progress_update(progresscount,progressgoal)
|
||||||
|
|
||||||
(stored, duplicates, partial, errors, ttime) = self.import_file_dict(db, file
|
(stored, duplicates, partial, errors, ttime) = self.import_file_dict(db, file
|
||||||
,self.filelist[file][0], self.filelist[file][1], q)
|
,self.filelist[file][0], self.filelist[file][1], q)
|
||||||
totstored += stored
|
totstored += stored
|
||||||
|
@ -313,6 +323,8 @@ class Importer:
|
||||||
print _("sending finish message queue length ="), q.qsize()
|
print _("sending finish message queue length ="), q.qsize()
|
||||||
db.send_finish_msg(q)
|
db.send_finish_msg(q)
|
||||||
|
|
||||||
|
del ProgressDialog
|
||||||
|
|
||||||
return (totstored, totdups, totpartial, toterrors)
|
return (totstored, totdups, totpartial, toterrors)
|
||||||
# end def importFiles
|
# end def importFiles
|
||||||
|
|
||||||
|
@ -528,5 +540,43 @@ class Importer:
|
||||||
logfile.write("\n")
|
logfile.write("\n")
|
||||||
logfile.close()
|
logfile.close()
|
||||||
|
|
||||||
|
|
||||||
|
class ProgressBar:
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
self.progress.destroy()
|
||||||
|
|
||||||
|
def progress_update(self, fraction, sum):
|
||||||
|
|
||||||
|
progresspercent = float(fraction) / (float(sum) + 1.0)
|
||||||
|
|
||||||
|
self.pbar.set_fraction(progresspercent)
|
||||||
|
self.pbar.set_text(str(fraction) + " / " + str(sum))
|
||||||
|
|
||||||
|
def __init__(self, parent):
|
||||||
|
|
||||||
|
self.progress = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
||||||
|
|
||||||
|
self.progress.set_resizable(False)
|
||||||
|
self.progress.set_modal(True)
|
||||||
|
self.progress.set_transient_for(parent)
|
||||||
|
self.progress.set_decorated(False)
|
||||||
|
|
||||||
|
vbox = gtk.VBox(False, 5)
|
||||||
|
vbox.set_border_width(10)
|
||||||
|
self.progress.add(vbox)
|
||||||
|
vbox.show()
|
||||||
|
|
||||||
|
align = gtk.Alignment(0.5, 0.5, 0, 0)
|
||||||
|
vbox.pack_start(align, True, True, 2)
|
||||||
|
align.show()
|
||||||
|
|
||||||
|
self.pbar = gtk.ProgressBar()
|
||||||
|
align.add(self.pbar)
|
||||||
|
self.pbar.show()
|
||||||
|
|
||||||
|
self.progress.show()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print _("CLI for fpdb_import is now available as CliFpdb.py")
|
print _("CLI for fpdb_import is now available as CliFpdb.py")
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
***** History for hand R5-78227816-62 *****
|
||||||
|
Start hand: Sat Aug 28 20:33:38 GMT+0300 2010
|
||||||
|
Table: Taegu [78227816] (LIMIT SEVEN_CARD_STUD_HI_LO $0.25/$0.50, ante: $0.05, Real money)
|
||||||
|
User: XMAN1
|
||||||
|
Players in round: 8
|
||||||
|
Seat 1: XMAN1 ($25)
|
||||||
|
Seat 3: boneos56 ($27.78)
|
||||||
|
Seat 5: grumset2007 ($3.48)
|
||||||
|
Seat 6: mylonas77 ($40.73)
|
||||||
|
Seat 7: YMAN1 ($14.70)
|
||||||
|
Seat 8: Lee Clayton ($14.79)
|
||||||
|
Seat 9: guggi_cool ($8.34)
|
||||||
|
Seat 10: HangEv ($29.08)
|
||||||
|
boneos56 posts ante $0.05
|
||||||
|
grumset2007 posts ante $0.05
|
||||||
|
YMAN1 posts ante $0.05
|
||||||
|
Lee Clayton posts ante $0.05
|
||||||
|
guggi_cool posts ante $0.05
|
||||||
|
HangEv posts ante $0.05
|
||||||
|
mylonas77 posts ante $0.05
|
||||||
|
XMAN1 posts ante $0.05
|
||||||
|
---
|
||||||
|
Dealing pocket cards
|
||||||
|
Dealing to XMAN1: [8d, 8s, 4d]
|
||||||
|
Dealing to boneos56: [-, -, Kd]
|
||||||
|
Dealing to grumset2007: [-, -, Ks]
|
||||||
|
Dealing to mylonas77: [-, -, 5c]
|
||||||
|
Dealing to YMAN1: [-, -, As]
|
||||||
|
Dealing to Lee Clayton: [-, -, Js]
|
||||||
|
Dealing to guggi_cool: [-, -, 9s]
|
||||||
|
Dealing to HangEv: [-, -, 6s]
|
||||||
|
XMAN1 small bring in $0.12
|
||||||
|
boneos56 folds
|
||||||
|
grumset2007 folds
|
||||||
|
mylonas77 calls $0.12
|
||||||
|
YMAN1 folds
|
||||||
|
Lee Clayton folds
|
||||||
|
guggi_cool folds
|
||||||
|
HangEv folds
|
||||||
|
---
|
||||||
|
Dealing 4th street
|
||||||
|
Dealing to XMAN1: [3h]
|
||||||
|
Dealing to mylonas77: [2h]
|
||||||
|
mylonas77 bets $0.25
|
||||||
|
XMAN1 calls $0.25
|
||||||
|
---
|
||||||
|
Dealing 5th street
|
||||||
|
Dealing to XMAN1: [8c]
|
||||||
|
Dealing to mylonas77: [Kh]
|
||||||
|
mylonas77 bets $0.50
|
||||||
|
XMAN1 raises $1 to $1.37
|
||||||
|
mylonas77 calls $0.50
|
||||||
|
---
|
||||||
|
Dealing 6th street
|
||||||
|
Dealing to XMAN1: [4c]
|
||||||
|
Dealing to mylonas77: [Qh]
|
||||||
|
XMAN1 bets $0.50
|
||||||
|
mylonas77 calls $0.50
|
||||||
|
---
|
||||||
|
Dealing river
|
||||||
|
Dealing to XMAN1: [5h]
|
||||||
|
XMAN1 bets $0.50
|
||||||
|
mylonas77 calls $0.50
|
||||||
|
---
|
||||||
|
Summary:
|
||||||
|
Main pot: $5.14 won by XMAN1 ($4.89)
|
||||||
|
Rake taken: $0.25
|
||||||
|
Seat 1: XMAN1 ($27.47), net: +$2.47, [8d, 8s, 4d, 3h, 8c, 4c, 5h] (FULL_HOUSE EIGHT, FOUR)
|
||||||
|
Seat 3: boneos56 ($27.73), net: -$0.05
|
||||||
|
Seat 5: grumset2007 ($3.43), net: -$0.05
|
||||||
|
Seat 6: mylonas77 ($38.31), net: -$2.42
|
||||||
|
Seat 7: YMAN1 ($14.65), net: -$0.05
|
||||||
|
Seat 8: Lee Clayton ($14.74), net: -$0.05
|
||||||
|
Seat 9: guggi_cool ($8.29), net: -$0.05
|
||||||
|
Seat 10: HangEv ($29.03), net: -$0.05
|
||||||
|
***** End of hand R5-78227816-62 *****
|
Loading…
Reference in New Issue
Block a user