From ee5d2feba291852b81a6d7f5a1b75ce3ec9ab6a6 Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 10 Feb 2011 18:45:12 +0800 Subject: [PATCH] Party: Fix tournament buyin parsing --- pyfpdb/PartyPokerToFpdb.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/pyfpdb/PartyPokerToFpdb.py b/pyfpdb/PartyPokerToFpdb.py index 2c07e138..65b6f0aa 100755 --- a/pyfpdb/PartyPokerToFpdb.py +++ b/pyfpdb/PartyPokerToFpdb.py @@ -330,13 +330,19 @@ class PartyPoker(HandHistoryConverter): # FIXME: there is no such property in Hand class self.isSNG = True if key == 'BUYIN': - # FIXME: it's dirty hack T_T - # code below assumes that tournament rake is equal to zero - if info[key] == None: - hand.buyin = '$0+$0' - else: - cur = info[key][0] if info[key][0] not in '0123456789' else '' - hand.buyin = info[key] + '+%s0' % cur + if hand.tourNo != None: + hand.buyin = 0 + hand.fee = 0 + hand.buyinCurrency = "FREE" + hand.isKO = False + if info[key].find("$")!=-1: + hand.buyinCurrency="USD" + elif info[key].find(u"€")!=-1: + hand.buyinCurrency="EUR" + else: + raise FpdbParseError(_("Failed to detect currency. HID: %s: '%s'" % (hand.handid, info[key]))) + info[key] = info[key].strip(u'$€') + hand.buyin = int(100*Decimal(info[key])) if key == 'LEVEL': hand.level = info[key] if key == 'PLAY' and info['PLAY'] != 'Real':