From d888b7d463ee19c4d94a4a8c7ca4d0cbfa68f2e9 Mon Sep 17 00:00:00 2001 From: grindi Date: Sun, 8 Nov 2009 23:09:14 +0300 Subject: [PATCH] Party hhc: cleand, added getTableTitleRe --- pyfpdb/PartyPokerToFpdb.py | 103 +++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 55 deletions(-) diff --git a/pyfpdb/PartyPokerToFpdb.py b/pyfpdb/PartyPokerToFpdb.py index 4ed0c965..ba597881 100755 --- a/pyfpdb/PartyPokerToFpdb.py +++ b/pyfpdb/PartyPokerToFpdb.py @@ -26,29 +26,21 @@ from HandHistoryConverter import * # PartyPoker HH Format -class PartyPokerParseError(FpdbParseError): - "Usage: raise PartyPokerParseError([, hh=][, hid=])" +class FpdbParseError(FpdbParseError): + "Usage: raise FpdbParseError([, hh=][, hid=])" def __init__(self, msg='', hh=None, hid=None): - if hh is not None: - msg += "\n\nHand history attached below:\n" + self.wrapHh(hh) - return super(PartyPokerParseError, self).__init__(msg, hid=hid) + return super(FpdbParseError, self).__init__(msg, hid=hid) def wrapHh(self, hh): return ("%(DELIMETER)s\n%(HH)s\n%(DELIMETER)s") % \ {'DELIMETER': '#'*50, 'HH': hh} class PartyPoker(HandHistoryConverter): - -############################################################ -# Class Variables - sitename = "PartyPoker" codepage = "cp1252" - siteId = 9 # TODO: automate; it's a class variable so shouldn't hit DB too often - filetype = "text" # "text" or "xml". I propose we subclass HHC to HHC_Text and HHC_XML. - - + siteId = 9 + filetype = "text" sym = {'USD': "\$", } # Static regexes @@ -86,15 +78,15 @@ class PartyPoker(HandHistoryConverter): re_HandInfo = re.compile(""" ^Table\s+ - (?P[a-zA-Z0-9 ]+)\s+ - (?: \#|\(|)(?P\d+)\)?\s+ - (?:[^ ]+\s+\#(?P\d+).+)? # table number for mtt - \((?PReal|Play)\s+Money\)\s+ # FIXME: check if play money is correct - Seat\s+(?P