From f4baaa42a73c7cec06e7324b0992ff0755958590 Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 1 Oct 2010 11:31:52 +0800 Subject: [PATCH] HHC: Modify allHandsAsList() to remove trailing entry Some HH formats leave dangling text after the split ie. (split) EOL Remove this dangler if less than 50 characters and warn in the log --- pyfpdb/HandHistoryConverter.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index 522092f8..6f0d4890 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -262,9 +262,16 @@ which it expects to find at self.re_TailSplitHands -- see for e.g. Everleaf.py. self.obs = m.sub('', self.obs) if self.obs is None or self.obs == "": - log.info(_("Read no hands.")) + log.error(_("Read no hands.")) return [] - return re.split(self.re_SplitHands, self.obs) + handlist = re.split(self.re_SplitHands, self.obs) + # Some HH formats leave dangling text after the split + # ie. (split) EOL + # Remove this dangler if less than 50 characters and warn in the log + if len(handlist[-1]) <= 50: + handlist.pop() + log.warn(_("Removing text < 50 characters")) + return handlist def processHand(self, handText): gametype = self.determineGameType(handText)