From cfbdff5159c8d26bbb21d601fee259502f3ca204 Mon Sep 17 00:00:00 2001 From: Matt Turnbull Date: Sun, 15 Mar 2009 16:50:59 +0000 Subject: [PATCH 1/2] add -x command line option to specify converter usage: ./GuiBulkImport -q -f lala.txt -x EverleafToFpdb --- pyfpdb/GuiBulkImport.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/GuiBulkImport.py b/pyfpdb/GuiBulkImport.py index 6105e443..509c9f61 100755 --- a/pyfpdb/GuiBulkImport.py +++ b/pyfpdb/GuiBulkImport.py @@ -213,7 +213,7 @@ if __name__ == '__main__': parser = OptionParser() parser.add_option("-f", "--file", dest="filename", help="Input file in quiet mode", metavar="FILE") parser.add_option("-q", "--quiet", action="store_false", dest="gui", default=True, help="don't start gui") - + parser.add_option("-x", "--convert", dest="filtername", help="Conversion filter", default="passthrough") (options, sys.argv) = parser.parse_args() config = Configuration.Config() @@ -240,7 +240,7 @@ if __name__ == '__main__': importer = fpdb_import.Importer(False,settings, config) importer.setDropIndexes("auto") importer.setFailOnError(True) - importer.addImportFile(options.filename) + importer.addImportFile(options.filename, filter=options.filtername) importer.setCallHud(False) importer.runImport() importer.clearFileList() From 08dae30f1f41116f0b614710cb50c91a09524030 Mon Sep 17 00:00:00 2001 From: Matt Turnbull Date: Sun, 15 Mar 2009 16:51:50 +0000 Subject: [PATCH 2/2] Ensure both holecards are known (holdem) or all four (omaha) before printing a 'shows hand' line : not ideal, but legacy importer chokes otherwise --- pyfpdb/Hand.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 7f560ebc..45068c17 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -504,7 +504,15 @@ Card ranks will be uppercased if self.shown: print >>fh, _("*** SHOW DOWN ***") for name in self.shown: - print >>fh, _("%s shows [%s] (a hand...)" % (name, " ".join(self.holecards[name]['PREFLOP']))) + # TODO: legacy importer can't handle only one holecard here, make sure there are 2 for holdem, 4 for omaha + # TOOD: If HoldHand subclass supports more than omahahi, omahahilo, holdem, add them here + numOfHoleCardsNeeded = None + if self.gametype['category'] in ('omahahi','omahahilo'): + numOfHoleCardsNeeded = 4 + elif self.gametype['category'] in ('holdem'): + numOfHoleCardsNeeded = 2 + if len(self.holecards[name]['PREFLOP']) == numOfHoleCardsNeeded: + print >>fh, _("%s shows [%s] (a hand...)" % (name, " ".join(self.holecards[name]['PREFLOP']))) # Current PS format has the lines: # Uncalled bet ($111.25) returned to s0rrow