2010-07-08 20:01:03 +02:00
|
|
|
#!/usr/bin/python
|
2010-07-04 03:05:16 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
2009-06-15 05:14:53 +02:00
|
|
|
|
2010-07-04 03:05:16 +02:00
|
|
|
#Copyright 2008-2010 Ray E. Barker
|
2009-06-15 05:14:53 +02:00
|
|
|
#This program is free software: you can redistribute it and/or modify
|
|
|
|
#it under the terms of the GNU Affero General Public License as published by
|
|
|
|
#the Free Software Foundation, version 3 of the License.
|
|
|
|
#
|
|
|
|
#This program is distributed in the hope that it will be useful,
|
|
|
|
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
#GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
#You should have received a copy of the GNU Affero General Public License
|
|
|
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2010-07-04 03:05:16 +02:00
|
|
|
#In the "official" distribution you can find the license in agpl-3.0.txt.
|
2009-06-15 05:14:53 +02:00
|
|
|
|
2010-09-23 08:31:16 +02:00
|
|
|
import L10n
|
|
|
|
_ = L10n.get_translation()
|
|
|
|
|
2009-06-15 05:14:53 +02:00
|
|
|
import sys
|
|
|
|
from optparse import OptionParser
|
2010-02-02 00:37:36 +01:00
|
|
|
# http://docs.python.org/library/optparse.html
|
2009-06-15 05:14:53 +02:00
|
|
|
|
|
|
|
def fpdb_options():
|
|
|
|
|
|
|
|
"""Process command line options for fpdb and HUD_main."""
|
|
|
|
parser = OptionParser()
|
2009-11-22 06:00:23 +01:00
|
|
|
parser.add_option("-x", "--errorsToConsole",
|
|
|
|
action="store_true",
|
2010-08-15 05:38:00 +02:00
|
|
|
help=_("If passed error output will go to the console rather than ."))
|
2009-11-22 06:00:23 +01:00
|
|
|
parser.add_option("-d", "--databaseName",
|
2010-02-27 14:56:19 +01:00
|
|
|
dest="dbname",
|
2010-08-15 05:38:00 +02:00
|
|
|
help=_("Overrides the default database name"))
|
2009-11-22 06:00:23 +01:00
|
|
|
parser.add_option("-c", "--configFile",
|
2009-06-15 05:14:53 +02:00
|
|
|
dest="config", default=None,
|
2010-08-15 05:38:00 +02:00
|
|
|
help=_("Specifies a configuration file."))
|
2009-11-22 06:00:23 +01:00
|
|
|
parser.add_option("-r", "--rerunPython",
|
|
|
|
action="store_true",
|
2010-08-15 05:38:00 +02:00
|
|
|
help=_("Indicates program was restarted with a different path (only allowed once)."))
|
2009-12-03 09:46:10 +01:00
|
|
|
parser.add_option("-k", "--konverter",
|
|
|
|
dest="hhc", default="PokerStarsToFpdb",
|
2010-08-15 05:38:00 +02:00
|
|
|
help=_("Module name for Hand History Converter"))
|
2010-12-10 11:20:52 +01:00
|
|
|
parser.add_option("-s", "--sitename",
|
|
|
|
dest="sitename", default=None,
|
|
|
|
help=_("A sitename"))
|
2010-02-02 00:37:36 +01:00
|
|
|
parser.add_option("-l", "--logging",
|
|
|
|
dest = "log_level",
|
|
|
|
choices = ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL', 'EMPTY'),
|
2010-08-15 05:38:00 +02:00
|
|
|
help = _("Error logging level:")+" (DEBUG, INFO, WARNING, ERROR, CRITICAL, EMPTY)",
|
2010-02-02 00:37:36 +01:00
|
|
|
default = 'EMPTY')
|
|
|
|
parser.add_option("-v", "--version", action = "store_true",
|
2010-08-15 05:38:00 +02:00
|
|
|
help = _("Print version information and exit."))
|
2010-09-04 10:30:43 +02:00
|
|
|
parser.add_option("-u", "--usage", action="store_true", dest="usage", default=False,
|
|
|
|
help=_("Print some useful one liners"))
|
2010-10-13 07:48:35 +02:00
|
|
|
# The following options are used for SplitHandHistory.py
|
2010-10-13 08:23:41 +02:00
|
|
|
parser.add_option("-f", "--file", dest="filename", metavar="FILE", default=None,
|
2011-02-13 14:59:36 +01:00
|
|
|
help=_("Input file"))
|
|
|
|
parser.add_option("-D", "--directory", dest="directory", metavar="FILE", default=None,
|
|
|
|
help=_("Input directory"))
|
2010-10-13 07:48:35 +02:00
|
|
|
parser.add_option("-o", "--outpath", dest="outpath", metavar="FILE", default=None,
|
|
|
|
help=_("Input out path in quiet mode"))
|
|
|
|
parser.add_option("-a", "--archive", action="store_true", dest="archive", default=False,
|
|
|
|
help=_("File to be split is a PokerStars or Full Tilt Poker archive file"))
|
|
|
|
parser.add_option("-n", "--numhands", dest="hands", default="100", type="int",
|
|
|
|
help=_("How many hands do you want saved to each file. Default is 100"))
|
2010-11-28 01:16:15 +01:00
|
|
|
parser.add_option("--xloc", dest="xloc", default=None, type="int",
|
|
|
|
help=_("X location to open window"))
|
|
|
|
parser.add_option("--yloc", dest="yloc", default=None, type="int",
|
|
|
|
help=_("Y location to open Window"))
|
2010-11-28 01:32:28 +01:00
|
|
|
parser.add_option("--autoimport", action="store_true", dest="autoimport",
|
|
|
|
help=_("Auto-start Auto-import"))
|
2010-11-28 02:35:34 +01:00
|
|
|
parser.add_option("--minimized", action="store_true", dest="minimized",
|
|
|
|
help=_("Start Minimized"))
|
|
|
|
parser.add_option("--hidden", action="store_true", dest="hidden",
|
|
|
|
help=_("Start Hidden"))
|
2010-09-04 10:30:43 +02:00
|
|
|
|
2010-02-02 00:37:36 +01:00
|
|
|
|
2009-11-22 06:00:23 +01:00
|
|
|
(options, argv) = parser.parse_args()
|
|
|
|
return (options, argv)
|
2009-06-15 05:14:53 +02:00
|
|
|
|
2010-12-15 05:44:12 +01:00
|
|
|
def site_alias(alias):
|
|
|
|
"""Function for converting various site aliases to the FPDB name"""
|
|
|
|
tmp = alias
|
|
|
|
aliases = {
|
|
|
|
"PokerStars" : "PokerStars",
|
|
|
|
"Full Tilt Poker": "Full Tilt Poker",
|
|
|
|
"PartyPoker" : "PartyPoker",
|
|
|
|
"Betfair" : "Betfair",
|
|
|
|
"OnGame" : "OnGame",
|
|
|
|
"Absolute" : "Absolute",
|
|
|
|
"UltimateBet" : "UltimateBet",
|
|
|
|
"Everleaf" : "Everleaf",
|
|
|
|
"Carbon" : "Carbon",
|
|
|
|
"iPoker" : "iPoker",
|
|
|
|
"Winamax" : "Winamax",
|
|
|
|
"Win2day" : "Win2day",
|
2011-02-10 05:20:22 +01:00
|
|
|
"Everest" : "Everest",
|
2010-12-15 05:44:12 +01:00
|
|
|
"Stars" : "PokerStars",
|
|
|
|
"FTP" : "Full Tilt Poker",
|
|
|
|
"Party" : "PartyPoker",
|
|
|
|
"AP" : "Absolute",
|
|
|
|
"UB" : "UltimateBet",
|
|
|
|
}
|
|
|
|
try:
|
|
|
|
tmp = aliases[alias]
|
|
|
|
except KeyError, e:
|
2010-12-15 05:49:52 +01:00
|
|
|
tmp = False
|
2010-12-15 05:44:12 +01:00
|
|
|
print _("Alias '%s' unknown" % alias)
|
|
|
|
|
2010-12-15 05:49:52 +01:00
|
|
|
return tmp
|
2010-12-15 05:44:12 +01:00
|
|
|
|
2009-06-15 05:14:53 +02:00
|
|
|
if __name__== "__main__":
|
2009-11-22 22:40:56 +01:00
|
|
|
(options, argv) = fpdb_options()
|
2009-06-15 05:14:53 +02:00
|
|
|
print "errorsToConsole =", options.errorsToConsole
|
|
|
|
print "database name =", options.dbname
|
|
|
|
print "config file =", options.config
|
|
|
|
|
2010-08-15 05:38:00 +02:00
|
|
|
print _("press enter to end")
|
2009-11-22 06:00:23 +01:00
|
|
|
sys.stdin.readline()
|