Replaced -i infile with -f file in Options.py and replaced options.infile with options.filename in SplitHandHistory.py, Anonymise.py, and ImapFetcher.py

This commit is contained in:
Chaz 2010-10-13 02:23:41 -04:00
parent b0cf6d3cb0
commit 0f9709390e
4 changed files with 8 additions and 9 deletions

8
pyfpdb/Anonymise.py Executable file → Normal file
View File

@ -39,17 +39,17 @@ obj = getattr(mod, filter_name, None)
hhc = obj(config, autostart=False) hhc = obj(config, autostart=False)
if os.path.exists(options.infile): if os.path.exists(options.filename):
in_fh = codecs.open(options.infile, 'r', "utf8") in_fh = codecs.open(options.filename, 'r', "utf8")
filecontents = in_fh.read() filecontents = in_fh.read()
in_fh.close() in_fh.close()
else: else:
print _("Could not find file %s") % options.infile print _("Could not find file %s") % options.filename
exit(1) exit(1)
m = hhc.re_PlayerInfo.finditer(filecontents) m = hhc.re_PlayerInfo.finditer(filecontents)
outfile = options.infile+".anon" outfile = options.filename+".anon"
print _("Output being written to"), outfile print _("Output being written to"), outfile
savestdout = sys.stdout savestdout = sys.stdout

2
pyfpdb/ImapFetcher.py Executable file → Normal file
View File

@ -131,7 +131,7 @@ def readFile(filename, options):
return whole_file return whole_file
def runFake(db, config, options): def runFake(db, config, options):
summaryText = readFile(options.infile, options) summaryText = readFile(options.filename, options)
importSummaries(db, config,[summaryText], options=options) importSummaries(db, config,[summaryText], options=options)
def importSummaries(db, config, summaries, options = None): def importSummaries(db, config, summaries, options = None):

View File

@ -38,9 +38,6 @@ def fpdb_options():
parser.add_option("-r", "--rerunPython", parser.add_option("-r", "--rerunPython",
action="store_true", action="store_true",
help=_("Indicates program was restarted with a different path (only allowed once).")) help=_("Indicates program was restarted with a different path (only allowed once)."))
parser.add_option("-i", "--infile",
dest="infile", default="Slartibartfast",
help=_("Input file"))
parser.add_option("-k", "--konverter", parser.add_option("-k", "--konverter",
dest="hhc", default="PokerStarsToFpdb", dest="hhc", default="PokerStarsToFpdb",
help=_("Module name for Hand History Converter")) help=_("Module name for Hand History Converter"))
@ -54,6 +51,8 @@ def fpdb_options():
parser.add_option("-u", "--usage", action="store_true", dest="usage", default=False, parser.add_option("-u", "--usage", action="store_true", dest="usage", default=False,
help=_("Print some useful one liners")) help=_("Print some useful one liners"))
# The following options are used for SplitHandHistory.py # The following options are used for SplitHandHistory.py
parser.add_option("-f", "--file", dest="filename", metavar="FILE", default=None,
help=_("Input file in quiet mode"))
parser.add_option("-o", "--outpath", dest="outpath", metavar="FILE", default=None, parser.add_option("-o", "--outpath", dest="outpath", metavar="FILE", default=None,
help=_("Input out path in quiet mode")) help=_("Input out path in quiet mode"))
parser.add_option("-a", "--archive", action="store_true", dest="archive", default=False, parser.add_option("-a", "--archive", action="store_true", dest="archive", default=False,

View File

@ -200,7 +200,7 @@ def main(argv=None):
options.config = Configuration.Config(file = "HUD_config.test.xml") options.config = Configuration.Config(file = "HUD_config.test.xml")
if options.filename: if options.filename:
SplitHH = SplitHandHistory(options.config, options.infile, options.outpath, options.hands, SplitHH = SplitHandHistory(options.config, options.filename, options.outpath, options.hands,
options.hhc, options.archive) options.hhc, options.archive)
if __name__ == '__main__': if __name__ == '__main__':