diff --git a/pyfpdb/BetfairToFpdb.py b/pyfpdb/BetfairToFpdb.py index 1ccec5d0..59344991 100755 --- a/pyfpdb/BetfairToFpdb.py +++ b/pyfpdb/BetfairToFpdb.py @@ -26,6 +26,11 @@ from HandHistoryConverter import * class Betfair(HandHistoryConverter): + sitename = 'Betfair' + filetype = "text" + codepage = "cp1252" + siteId = 7 # Needs to match id entry in Sites database + # Static regexes re_GameInfo = re.compile("^(?PNL|PL|) (?P\$|)?(?P[.0-9]+)/\$?(?P[.0-9]+) (?P(Texas Hold\'em|Omaha Hi|Razz))", re.MULTILINE) re_SplitHands = re.compile(r'\n\n+') @@ -34,19 +39,6 @@ class Betfair(HandHistoryConverter): re_PlayerInfo = re.compile("Seat (?P[0-9]+): (?P.*)\s\(\s(\$(?P[.0-9]+)) \)") re_Board = re.compile(ur"\[ (?P.+) \]") - def __init__(self, in_path = '-', out_path = '-', follow = False, autostart=True, index=0): - """\ -in_path (default '-' = sys.stdin) -out_path (default '-' = sys.stdout) -follow : whether to tail -f the input""" - HandHistoryConverter.__init__(self, in_path, out_path, sitename="Betfair", follow=follow, index) # Call super class init. - logging.info("Initialising Betfair converter class") - self.filetype = "text" - self.codepage = "cp1252" - self.siteId = 7 # Needs to match id entry in Sites database - if autostart: - self.start() - def compilePlayerRegexs(self, hand): players = set([player[1] for player in hand.players]) diff --git a/pyfpdb/EverleafToFpdb.py b/pyfpdb/EverleafToFpdb.py index 9c63bcf0..2835b6ff 100755 --- a/pyfpdb/EverleafToFpdb.py +++ b/pyfpdb/EverleafToFpdb.py @@ -26,6 +26,11 @@ from HandHistoryConverter import * class Everleaf(HandHistoryConverter): + sitename = 'Everleaf' + filetype = "text" + codepage = "cp1252" + siteId = 3 # Needs to match id entry in Sites database + # Static regexes re_SplitHands = re.compile(r"\n\n\n+") re_TailSplitHands = re.compile(r"(\n\n\n+)") @@ -37,24 +42,6 @@ class Everleaf(HandHistoryConverter): re_Board = re.compile(ur"\[ (?P.+) \]") - def __init__(self, in_path = '-', out_path = '-', follow = False, autostart=True, debugging=False, index=0): - """\ -in_path (default '-' = sys.stdin) -out_path (default '-' = sys.stdout) -follow : whether to tail -f the input -autostart: whether to run the thread (or you can call start() yourself) -debugging: if False, pass on partially supported game types. If true, have a go and error...""" - #print "DEBUG: XXXXXXXXXXXXXXX" - HandHistoryConverter.__init__(self, in_path, out_path, sitename="Everleaf", follow=follow, index=index) - logging.info("Initialising Everleaf converter class") - self.filetype = "text" - self.codepage = "cp1252" - self.siteId = 3 # Needs to match id entry in Sites database - self.debugging = debugging - if autostart: - self.start() - # otherwise you need to call start yourself. - def compilePlayerRegexs(self, hand): players = set([player[1] for player in hand.players]) if not players <= self.compiledPlayers: # x <= y means 'x is subset of y' diff --git a/pyfpdb/Exceptions.py b/pyfpdb/Exceptions.py index fa76f3cd..8259a484 100644 --- a/pyfpdb/Exceptions.py +++ b/pyfpdb/Exceptions.py @@ -1 +1,4 @@ -class FpdbParseError(Exception): pass +class FpdbParseError(Exception): + def __init__(self,hid=None): + self.hid = hid + diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index a68c1cbd..19a666f1 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -27,6 +27,11 @@ from HandHistoryConverter import * class Fulltilt(HandHistoryConverter): + sitename = "Fulltilt" + filetype = "text" + codepage = "cp1252" + siteId = 1 # Needs to match id entry in Sites database + # Static regexes re_GameInfo = re.compile('''(?:(?P.+)\s\((?P\d+)\),\s)? .+ @@ -39,7 +44,7 @@ class Fulltilt(HandHistoryConverter): ''', re.VERBOSE) re_SplitHands = re.compile(r"\n\n+") re_TailSplitHands = re.compile(r"(\n\n+)") - re_HandInfo = re.compile('''.*\#(?P[0-9]+):\s + re_HandInfo = re.compile(r'''.*\#(?P[0-9]+):\s (?:(?P.+)\s\((?P\d+)\),\s)? Table\s (?PPlay\sChip\s|PC)? @@ -47,8 +52,9 @@ class Fulltilt(HandHistoryConverter): (\((?P.+)\)\s)?-\s \$?(?P[.0-9]+)/\$?(?P[.0-9]+)\s(Ante\s\$?(?P[.0-9]+)\s)?-\s (?P[a-zA-Z\/\'\s]+)\s-\s - (?P.*) - ''', re.VERBOSE) + (?P.*?)\n + (?:.*?\n(?PHand\s\#(?P=HID)\shas\sbeen\scanceled))? + ''', re.VERBOSE|re.DOTALL) re_Button = re.compile('^The button is in seat #(?P