From d8220e0b2efc4ed0bf68108b5b98fe64fc9668ef Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 10 Feb 2011 17:28:00 +0800 Subject: [PATCH] FTP: Allow odd FTP summary file to parse. Found an example summary file that only contained the player line: finished in XXXXrd place Player should now be added the TP table, hence the stats should actually show up in the grapher --- pyfpdb/FullTiltPokerSummary.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pyfpdb/FullTiltPokerSummary.py b/pyfpdb/FullTiltPokerSummary.py index 79f50f01..2edcd81e 100644 --- a/pyfpdb/FullTiltPokerSummary.py +++ b/pyfpdb/FullTiltPokerSummary.py @@ -80,6 +80,7 @@ class FullTiltPokerSummary(TourneySummary): re_Currency = re.compile(u"""(?P[%(LS)s]|FPP)""" % substitutions) re_Player = re.compile(u"""(?P[\d]+):\s(?P[^,\r\n]{2,15})(,(\s)?[%(LS)s](?P[.\d]+))?""") + re_Finished = re.compile(u"""(?P[^,\r\n]{2,15}) finished in (?P[\d]+)\S\S place""") re_DateTime = re.compile("\[(?P[0-9]{4})\/(?P[0-9]{2})\/(?P[0-9]{2})[\- ]+(?P[0-9]+):(?P[0-9]+):(?P[0-9]+)") @@ -126,6 +127,7 @@ class FullTiltPokerSummary(TourneySummary): elif mg['CURRENCY'] == "FPP": self.currency="PSFP" m = self.re_Player.finditer(self.summaryText) + playercount = 0 for a in m: mg = a.groupdict() #print "DEBUG: a.groupdict(): %s" % mg @@ -136,4 +138,14 @@ class FullTiltPokerSummary(TourneySummary): if 'WINNINGS' in mg and mg['WINNINGS'] != None: winnings = int(100*Decimal(mg['WINNINGS'])) self.addPlayer(rank, name, winnings, self.currency, None, None, None) + playercount += 1 + # Some files dont contain the normals lines, and only contain the line + # finished in XXXXrd place + if playercount == 0: + m = self.re_Finished.finditer(self.summaryText) + for a in m: + winnings = 0 + name = a.group('NAME') + rank = a.group('RANK') + self.addPlayer(rank, name, winnings, self.currency, None, None, None)