Пример #1
0
def main(argv=None):
    """main can also be called in the python interpreter, by supplying the command line as the argument."""
    if argv is None:
        argv = sys.argv[1:]

    def destroy(*args):  # call back for terminating the main eventloop
        gtk.main_quit()

    parser = OptionParser()
    (options, argv) = parser.parse_args(args=argv)

    config = Configuration.Config()
    db = None

    db = Database.Database()
    db.do_connect(config)

    qdict = SQL.SQL(db.get_backend_name())

    i = Filters(db, config, qdict)
    main_window = gtk.Window()
    main_window.connect('destroy', destroy)
    main_window.add(i.get_vbox())
    main_window.show()
    gtk.main()
Пример #2
0
def main(argv=None):
    """main can also be called in the python interpreter, by supplying the command line as the argument."""
    if argv is None:
        argv = sys.argv[1:]

    def destroy(*args):  # call back for terminating the main eventloop
        gtk.main_quit()

    Configuration.set_logfile("fpdb-log.txt")
    import Options

    (options, argv) = Options.fpdb_options()

    if options.usage == True:
        #Print usage examples and exit
        sys.exit(0)

    if options.sitename:
        options.sitename = Options.site_alias(options.sitename)
        if options.sitename == False:
            usage()

    config = Configuration.Config(file = "HUD_config.test.xml")
    db = Database.Database(config)
    sql = SQL.Sql(db_server = 'sqlite')

    main_window = gtk.Window()
    main_window.connect('destroy', destroy)

    replayer = GuiReplayer(config, sql, main_window, options=options, debug=True)

    main_window.add(replayer.get_vbox())
    main_window.set_default_size(800,800)
    main_window.show()
    gtk.main()
Пример #3
0
def main(argv=None):
    if argv is None:
        argv = sys.argv[1:]

    Configuration.set_logfile("fpdb-log.txt")
    config = Configuration.Config(file="HUD_config.test.xml")
    in_path = os.path.abspath('regression-test-files')
    IdSite = IdentifySite(config)
    start = time()
    IdSite.scan(in_path)
    print 'duration', time() - start

    print "\n----------- SITE LIST -----------"
    for sid, site in IdSite.sitelist.iteritems():
        print "%2d: Name: %s HHC: %s Summary: %s" % (
            sid, site.name, site.filter_name, site.summary)
    print "----------- END SITE LIST -----------"

    print "\n----------- ID REGRESSION FILES -----------"
    count = 0
    for f, ffile in IdSite.filelist.iteritems():
        tmp = ""
        tmp += ": Type: %s " % ffile.ftype
        count += 1
        if ffile.ftype == "hh":
            tmp += "Conv: %s" % ffile.site.hhc_fname
        elif ffile.ftype == "summary":
            tmp += "Conv: %s" % ffile.site.summary
        print f, tmp
    print count, 'files identified'
    print "----------- END ID REGRESSION FILES -----------"

    print "----------- RETRIEVE FOR SINGLE SITE -----------"
    IdSite.getFilesForSite("PokerStars", "hh")
    print "----------- END RETRIEVE FOR SINGLE SITE -----------"
Пример #4
0
def main(argv=None):
    if argv is None:
        argv = sys.argv[1:]

    (options, argv) = Options.fpdb_options()

    if options.usage == True:
        #Print usage examples and exit
        print _("USAGE:")
        sys.exit(0)

    if options.hhc == "PokerStarsToFpdb":
        print _("Need to define a converter")
        exit(0)

    # These options should really come from the OptionsParser
    config = Configuration.Config()
    db = Database.Database(config)
    sql = SQL.Sql(db_server='sqlite')
    settings = {}
    settings.update(config.get_db_parameters())
    settings.update(config.get_import_parameters())
    settings.update(config.get_default_paths())
    db.recreate_tables()

    runFake(db, config, options)
def main():
    config = Configuration.Config()
    db = Database.Database(config)

    tourney_ids = db.getSiteTourneyNos("Winamax")
    tids = []

    for tid in tourney_ids:
        blah, = tid  # Unpack tuple
        tids.append(str(blah))
    #    winamax_get_winning(tid,"blah")
    results_dir = config.get_import_parameters().get("ResultsDirectory")
    results_dir = os.path.expanduser(results_dir)
    site_dir = os.path.join(results_dir, "Winamax")
    print "DEBUG: site_dir: %s" % site_dir
    filelist = [
        file for file in os.listdir(site_dir) if not file in [".", ".."]
    ]
    print "DEBUG: filelist : %s" % filelist
    print "DEBUG: tids     : %s" % tids

    for f in filelist:
        try:
            tids.remove(f)
        except ValueError:
            print "Warning: '%s' is not a known tourney_id" % f

    if len(tids) == 0:
        print "No tourney results files to fetch"
    else:
        for tid in tids:
            filename = os.path.join(site_dir, tid)
            data = fetch_winamax_results_page(tid)
            print u"DEBUG: write_file(%s)" % (filename)
            write_file(filename, data)
Пример #6
0
def main(argv=None):
    """main can also be called in the python interpreter, by supplying the command line as the argument."""
    if argv is None:
        argv = sys.argv[1:]

    def destroy(*args):  # call back for terminating the main eventloop
        gtk.main_quit()

    Configuration.set_logfile("fpdb-log.txt")
    (options, argv) = Options.fpdb_options()

    if options.sitename:
        options.sitename = Options.site_alias(options.sitename)

    if options.usage == True:
        #Print usage examples and exit
        print _("USAGE:")
        sys.exit(0)

    Configuration.set_logfile("GuiBulkImport-log.txt")
    if options.config:
        config = Configuration.Config(options.config)
    else:
        config = Configuration.Config()

    settings = {}
    if os.name == 'nt': settings['os'] = 'windows'
    else: settings['os'] = 'linuxmac'

    settings.update(config.get_db_parameters())
    settings.update(config.get_import_parameters())
    settings.update(config.get_default_paths())

    #Do something useful
    importer = Importer.Importer(False, settings, config, None)
    importer.addBulkImportImportFileOrDir(os.path.expanduser(options.filename))
    importer.setCallHud(False)
    if options.archive:
        importer.setStarsArchive(True)
        importer.setFTPArchive(True)
    if options.testData:
        importer.setPrintTestData(True)
    (stored, dups, partial, errs, ttime) = importer.runImport()
    importer.clearFileList()
    print(_('Bulk import done: Stored: %d, Duplicates: %d, Partial: %d, Errors: %d, Time: %s seconds, Stored/second: %.0f')\
                     % (stored, dups, partial, errs, ttime, (stored+0.0) / ttime))
Пример #7
0
def main(argv=None):
    if argv is None:
        argv = sys.argv[1:]

    Configuration.set_logfile("fpdb-log.txt")
    if not options.config:
        options.config = Configuration.Config(file="HUD_config.test.xml")

    if options.filename:
        SplitHH = SplitHandHistory(options.config, options.filename,
                                   options.outpath, options.hands, options.hhc,
                                   options.archive)
Пример #8
0
    def __init__(self, sitename = "All"):

        self.Config=Configuration.Config()
        #
        # objects returned
        #
        self.sitestatusdict = {}
        self.sitename = sitename
        self.heroname = ""
        self.hhpath = ""
        self.tspath = ""
        self.detected = ""
        #
        #since each site has to be hand-coded in this module, there
        #is little advantage in querying the sites table at the moment.
        #plus we can run from the command line as no dependencies
        #
        self.supportedSites = [ "Full Tilt Poker",
                                "PartyPoker",
                                "Merge",
                                "PokerStars"]#,
                                #"Everleaf",
                                #"Win2day",
                                #"OnGame",
                                #"UltimateBet",
                                #"Betfair",
                                #"Absolute",
                                #"PacificPoker",
                                #"Partouche",
                                #"PKR",
                                #"iPoker",
                                #"Winamax",
                                #"Everest" ]

        self.supportedPlatforms = ["Linux", "XP", "Win7"]

        if sitename == "All":
            for siteiter in self.supportedSites:
                self.sitestatusdict[siteiter]=self.detect(siteiter)
        else:
            self.sitestatusdict[sitename]=self.detect(sitename)
            self.heroname = self.sitestatusdict[sitename]['heroname']
            self.hhpath = self.sitestatusdict[sitename]['hhpath']
            self.tspath = self.sitestatusdict[sitename]['tspath']
            self.detected = self.sitestatusdict[sitename]['detected']

        return
Пример #9
0
def main(argv=None):
    if argv is None:
        argv = sys.argv[1:]

        config = Configuration.Config(file="HUD_config.test.xml")
    in_path = 'regression-test-files/'
    IdSite = IdentifySite(config, in_path)

    print "\n----------- SITE LIST -----------"
    for site, info in IdSite.sitelist.iteritems():
        print site, info
    print "----------- END SITE LIST -----------"

    print "\n----------- ID REGRESSION FILES -----------"
    for file, site in IdSite.filelist.iteritems():
        print file, site
    print "----------- END ID REGRESSION FILES -----------"
Пример #10
0
def main(argv=None):
    """main can also be called in the python interpreter, by supplying the command line as the argument."""
    import SQL
    if argv is None:
        argv = sys.argv[1:]

    (options, argv) = Options.fpdb_options()

    if options.usage == True:
        #Print usage examples and exit
        usage()
        sys.exit(0)

    if options.hhc == "PokerStarsToFpdb":
        print _("Need to define a converter")
        usage()
        exit(0)

    config = Configuration.Config("HUD_config.test.xml")
    sql = SQL.Sql(db_server='sqlite')

    if options.filename == None:
        print _("Need a filename to import")
        usage()
        exit(0)

    importer = SummaryImporter(config, sql, None, None)

    importer.addImportFileOrDir(options.filename, site=options.hhc)
    if options.testData:
        importer.setPrintTestData(True)
    starttime = time()
    (stored, errs) = importer.runImport()

    ttime = time() - starttime
    if ttime == 0:
        ttime = 1
    print _('Tourney import done: Stored: %d, Errors: %d in %s seconds - %.0f/sec')\
                     % (stored, errs, ttime, (stored+0.0) / ttime)
    importer.clearFileList()
Пример #11
0
    def __init__(self, db_name = 'fpdb'):
        self.db_name = db_name
        self.config = Configuration.Config(file=options.config, dbname=options.dbname)
        self.tourney_list = []

#    a thread to read stdin
        gobject.threads_init()                       # this is required
        thread.start_new_thread(self.read_stdin, ()) # starts the thread

#    a main window
        self.main_window = gtk.Window()
        self.main_window.connect("destroy", self.destroy)
        self.vb = gtk.VBox()
        self.label = gtk.Label(_('Closing this window will stop the Tournament Tracker'))
        self.vb.add(self.label)
        self.addbutton = gtk.Button(label=_("Add Tournament"))
        self.addbutton.connect("clicked", self.addClicked, "add tournament")
        self.vb.add(self.addbutton)

        self.main_window.add(self.vb)
        self.main_window.set_title(_("FPDB Tournament Tracker"))
        self.main_window.show_all()
Пример #12
0
def main(argv=None):
    if argv is None:
        argv = sys.argv[1:]

    config = Configuration.Config(file = "HUD_config.test.xml")
    db = Database.Database(config)
    sql = SQL.Sql(db_server = 'sqlite')
    settings = {}
    settings.update(config.get_db_parameters())
    settings.update(config.get_import_parameters())
    settings.update(config.get_default_paths())
    db.recreate_tables()
    importer = fpdb_import.Importer(False, settings, config)
    importer.setDropIndexes("don't drop")
    importer.setFailOnError(True)
    importer.setThreads(-1)
    importer.setCallHud(False)
    importer.setFakeCacheHHC(True)

    PokerStarsErrors = FpdbError('PokerStars')
    FTPErrors        = FpdbError('Full Tilt Poker')
    PartyPokerErrors = FpdbError('Party Poker')
    BetfairErrors    = FpdbError('Betfair')
    
    walk_testfiles("regression-test-files/cash/Stars/", compare, importer, PokerStarsErrors, "PokerStars")
    walk_testfiles("regression-test-files/cash/FTP/", compare, importer, FTPErrors, "Full Tilt Poker")
    #walk_testfiles("regression-test-files/cash/PartyPoker/", compare, importer, PartyPokerErrors, "PartyPoker")
    walk_testfiles("regression-test-files/cash/Betfair/", compare, importer, BetfairErrors, "Betfair")

    totalerrors = PokerStarsErrors.errorcount + FTPErrors.errorcount + PartyPokerErrors.errorcount + BetfairErrors.errorcount

    print "---------------------"
    print "Total Errors: %d" % totalerrors
    print "---------------------"
    PokerStarsErrors.print_histogram()
    FTPErrors.print_histogram()
    PartyPokerErrors.print_histogram()
    BetfairErrors.print_histogram()
Пример #13
0
def sss():
    "Debug function. Returns (config, sql, db)"

    import Configuration, SQL, Database, os

    class Dummy(object):
        pass

    self = Dummy()
    self.config = Configuration.Config()
    self.settings = {}
    if (os.sep == "/"):
        self.settings['os'] = "linuxmac"
    else:
        self.settings['os'] = "windows"

    self.settings.update(self.config.get_db_parameters())
    self.settings.update(self.config.get_import_parameters())
    self.settings.update(self.config.get_default_paths())

    self.sql = SQL.Sql(db_server=self.settings['db-server'])
    self.db = Database.Database(self.config, sql=self.sql)

    return self.config, self.sql, self.db
Пример #14
0
def init_translation():
    #
    # set the system language
    # this function normally called once only per instance
    # Calling this function again will have no effect because
    # translations cannot be changed on-the-fly by this function
    #
    import Configuration
    conf = Configuration.Config()

    if conf.general['ui_language'] in ("system", ""):
        import locale
        try:
            (lang, charset) = locale.getdefaultlocale()
        except:
            lang = None
        if lang == None or lang[:2] == "en":
            return pass_through
        else:
            return set_translation(lang)
    elif conf.general['ui_language'] == "en":
        return pass_through
    else:
        return set_translation(conf.general['ui_language'])
Пример #15
0
#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/>.
#In the "official" distribution you can find the license in agpl-3.0.txt.

import PokerStarsToFpdb
from Hand import *
import py

import Configuration
import Database
import SQL
import fpdb_import

config = Configuration.Config(file="HUD_config.test.xml")
db = Database.Database(config)
sql = SQL.Sql(db_server='sqlite')

settings = {}
settings.update(config.get_db_parameters())
settings.update(config.get_import_parameters())
settings.update(config.get_default_paths())

#regression-test-files/stars/badugi/ring-fl-badugi.txt
#   s0rrow: input: $30.00 end: $22.65 total: ($7.35)
#regression-test-files/stars/plo/PLO-6max.txt
#   s0rrow: input: $18.35 end: $0 total: ($18.35)
#   Notes: last hand #25975302416 s0rrow aifp against 2 players

gametype = {
Пример #16
0
import L10n
_ = L10n.get_translation()

import os
import re
import codecs
import Options
import HandHistoryConverter
import Configuration
import sys

#   command line is:
#  ./Anonymise.py -f <valid path to HH file> -k <name of input filter>

(options, argv) = Options.fpdb_options()
config = Configuration.Config()

filter = options.hhc

filter_name = filter.replace("ToFpdb", "")

mod = __import__(filter)
obj = getattr(mod, filter_name, None)

hhc = obj(config, autostart=False)

if os.path.exists(options.filename):
    in_fh = codecs.open(options.filename, 'r', "utf8")
    filecontents = in_fh.read()
    in_fh.close()
else:
Пример #17
0
_ = L10n.get_translation()

import os
import re
import codecs
import Options
import HandHistoryConverter
import Configuration
import sys

#   command line is:
#  ./Anonymise.py -f <valid path to HH file> -k <name of input filter>

(options, argv) = Options.fpdb_options()
if options.config:
    config = Configuration.Config(options.config)
else:
    config = Configuration.Config()

filter = options.hhc

filter_name = filter.replace("ToFpdb", "")

mod = __import__(filter)
obj = getattr(mod, filter_name, None)

hhc = obj(config, autostart=False)

for kodec in ("utf8", "cp1252", "utf-16"):
    if os.path.exists(options.filename):
        in_fh = codecs.open(options.filename, 'r', kodec)
Пример #18
0
def starthands(stat_dict, player, handid):

    #summary of known starting hands+position
    # data volumes could get crazy here,so info is limited to hands
    # in the current HH file only

    # this info is NOT read from the cache, so does not obey aggregation
    # parameters for other stats

    #display shows 3 categories
    # PFcall - limp or coldcall preflop
    # PFaggr - raise preflop
    # PFdefBB - defended in BB

    # hand is shown, followed by position indicator
    # (b=SB/BB. l=Button/cutoff m=previous 3 seats to that, e=remainder)

    # due to screen space required for this stat, it should only
    # be used in the popup section i.e.
    # <pu_stat pu_stat_name="starthands"> </pu_stat>

    stat_descriptions["starthands"] = _(
        "starting hands at this table") + " (starting hands)"
    PFlimp = " PFlimp:"
    PFaggr = " PFaggr:"
    PFcar = " PFCaRa:"
    PFdefend = " PFdefBB:"
    count_pfl = count_pfa = count_pfc = count_pfd = 2

    if handid == -1:
        return ((''), (''), (''), (''), (''), (''))

    c = Configuration.Config()
    db_connection = Database.Database(c)
    sc = db_connection.get_cursor()

    sc.execute(
        ("SELECT distinct startCards, street0Aggr, street0CalledRaiseDone, " +
         "case when HandsPlayers.position = 'B' then 'b' " +
         "when HandsPlayers.position = 'S' then 'b' " +
         "when HandsPlayers.position = '0' then 'l' " +
         "when HandsPlayers.position = '1' then 'l' " +
         "when HandsPlayers.position = '2' then 'm' " +
         "when HandsPlayers.position = '3' then 'm' " +
         "when HandsPlayers.position = '4' then 'm' " +
         "when HandsPlayers.position = '5' then 'e' " +
         "when HandsPlayers.position = '6' then 'e' " +
         "when HandsPlayers.position = '7' then 'e' " +
         "when HandsPlayers.position = '8' then 'e' " +
         "when HandsPlayers.position = '9' then 'e' " + "else 'X' end " +
         "FROM Hands, HandsPlayers, Gametypes " +
         "WHERE HandsPlayers.handId = Hands.id " +
         " AND Gametypes.id = Hands.gametypeid " + " AND Gametypes.type = " +
         "   (SELECT Gametypes.type FROM Gametypes, Hands   " +
         "  WHERE Hands.gametypeid = Gametypes.id and Hands.id = %d) " +
         " AND Gametypes.Limittype =  " +
         "   (SELECT Gametypes.limitType FROM Gametypes, Hands  " +
         " WHERE Hands.gametypeid = Gametypes.id and Hands.id = %d) " +
         "AND Gametypes.category = 'holdem' " +
         "AND fileId = (SELECT fileId FROM Hands " + " WHERE Hands.id = %d) " +
         "AND HandsPlayers.playerId = %d " + "AND street0VPI " +
         "AND startCards > 0 " + "ORDER BY startCards DESC " + ";") %
        (int(handid), int(handid), int(handid), int(player)))

    for (qstartcards, qstreet0Aggr, qstreet0CalledRaiseDone,
         qposition) in sc.fetchall():
        humancards = Card.decodeStartHandValue("holdem", qstartcards)

        if qposition == "B" and qstreet0Aggr == False:
            PFdefend = PFdefend + "/" + humancards
            count_pfd += 1
            if (count_pfd / 8.0 == int(count_pfd / 8.0)):
                PFdefend = PFdefend + "\n"
        elif qstreet0Aggr == True:
            PFaggr = PFaggr + "/" + humancards + "." + qposition
            count_pfa += 1
            if (count_pfa / 8.0 == int(count_pfa / 8.0)):
                PFaggr = PFaggr + "\n"
        elif qstreet0CalledRaiseDone:
            PFcar = PFcar + "/" + humancards + "." + qposition
            count_pfc += 1
            if (count_pfc / 8.0 == int(count_pfc / 8.0)):
                PFcar = PFcar + "\n"
        else:
            PFlimp = PFlimp + "/" + humancards + "." + qposition
            count_pfl += 1
            if (count_pfl / 8.0 == int(count_pfl / 8.0)):
                PFlimp = PFlimp + "\n"
    sc.close()

    returnstring = PFlimp + "\n" + PFaggr + "\n" + PFcar + "\n" + PFdefend  #+ "\n" + str(handid)

    return ((returnstring), (returnstring), (returnstring), (returnstring),
            (returnstring), (''))
Пример #19
0
def main(argv=None):
    """main can also be called in the python interpreter, by supplying the command line as the argument."""
    if argv is None:
        argv = sys.argv[1:]

    def destroy(*args):  # call back for terminating the main eventloop
        gtk.main_quit()

    parser = OptionParser()
    parser.add_option("-f",
                      "--file",
                      dest="filename",
                      metavar="FILE",
                      default=None,
                      help=_("Input file"))
    parser.add_option(
        "-c",
        "--convert",
        dest="filtername",
        default=None,
        metavar="FILTER",
        help=_("Site") +
        " (Absolute, Merge, Everleaf, Full Tilt Poker, PokerStars, ...)"
    )  #TODO: dynamically generate list
    parser.add_option(
        "-x",
        "--failOnError",
        action="store_true",
        default=False,
        help=
        _("If this option is used it quits with an extended error message if it encounters any error"
          ))
    parser.add_option("-u",
                      "--usage",
                      action="store_true",
                      dest="usage",
                      default=False,
                      help=_("Print some useful one liners"))
    parser.add_option(
        "-s",
        "--starsarchive",
        action="store_true",
        dest="starsArchive",
        default=False,
        help=
        _("Do the required conversion for %s archive format (ie. as provided by support)"
          ) % "PokerStars")
    parser.add_option(
        "-F",
        "--ftparchive",
        action="store_true",
        dest="ftpArchive",
        default=False,
        help=
        _("Do the required conversion for %s archive format (ie. as provided by support)"
          ) % "Full Tilt Poker")
    parser.add_option(
        "-t",
        "--testdata",
        action="store_true",
        dest="testData",
        default=False,
        help=_("Generate and print test data for regression testing"))
    parser.add_option("-C",
                      "--configFile",
                      dest="config",
                      default=None,
                      help=_("Specifies a configuration file."))
    (options, argv) = parser.parse_args(args=argv)

    if options.usage == True:
        #Print usage examples and exit
        print _("USAGE:")
        print('PokerStars ' + _('converter') +
              ': ./GuiBulkImport.py -c PokerStars -f filename')
        print('Full Tilt  ' + _('converter') +
              ': ./GuiBulkImport.py -c "Full Tilt Poker" -f filename')
        print('Everleaf   ' + _('converter') +
              ': ./GuiBulkImport.py -c Everleaf -f filename')
        print('Absolute   ' + _('converter') +
              ': ./GuiBulkImport.py -c Absolute -f filename')
        print('PartyPoker ' + _('converter') +
              ': ./GuiBulkImport.py -c PartyPoker -f filename')
        sys.exit(0)

    Configuration.set_logfile("GuiBulkImport-log.txt")
    if options.config:
        config = Configuration.Config(options.config)
    else:
        config = Configuration.Config()

    settings = {}
    if os.name == 'nt': settings['os'] = 'windows'
    else: settings['os'] = 'linuxmac'

    settings.update(config.get_db_parameters())
    settings.update(config.get_import_parameters())
    settings.update(config.get_default_paths())

    if not options.filename:
        i = GuiBulkImport(settings, config, None)
        main_window = gtk.Window()
        main_window.connect('destroy', destroy)
        main_window.add(i.vbox)
        main_window.show()
        gtk.main()
    else:
        if not options.filtername:
            print _(
                "You have to select a site with the -c parameter. E.g.:"
            ), "Everleaf   converter: ./GuiBulkImport.py -c Everleaf -f filename"
        #Do something useful
        importer = fpdb_import.Importer(False, settings, config, None)
        # importer.setDropIndexes("auto")
        importer.setDropIndexes(_("don't drop"))
        importer.setFailOnError(options.failOnError)
        importer.setThreads(-1)
        importer.addBulkImportImportFileOrDir(os.path.expanduser(
            options.filename),
                                              site=options.filtername)
        importer.setCallHud(False)
        if options.starsArchive:
            importer.setStarsArchive(True)
        if options.ftpArchive:
            importer.setFTPArchive(True)
        if options.testData:
            importer.setPrintTestData(True)
        (stored, dups, partial, errs, ttime) = importer.runImport()
        importer.clearFileList()
        print(_('Bulk import done: Stored: %d, Duplicates: %d, Partial: %d, Errors: %d, Time: %s seconds, Stored/second: %.0f')\
                     % (stored, dups, partial, errs, ttime, (stored+0.0) / ttime))
Пример #20
0
def main(argv=None):
    if argv is None:
        argv = sys.argv[1:]

    Configuration.set_logfile("fpdb-log.txt")
    (options, argv) = Options.fpdb_options()

    test_all_sites = True

    if options.usage == True:
        usage()

    single_file_test = False

    if options.sitename:
        options.sitename = Options.site_alias(options.sitename)
        if options.sitename == False:
            usage()
        if options.filename:
            print "Testing single hand: '%s'" % options.filename
            single_file_test = True
        else:
            print "Only regression testing '%s' files" % (options.sitename)
        test_all_sites = False

    config = Configuration.Config(file = "HUD_config.test.xml")
    db = Database.Database(config)
    settings = {}
    settings.update(config.get_db_parameters())
    settings.update(config.get_import_parameters())
    settings.update(config.get_default_paths())
    db.recreate_tables()
    importer = Importer.Importer(False, settings, config, None)
    importer.setDropIndexes("don't drop")
    importer.setThreads(-1)
    importer.setCallHud(False)
    importer.setFakeCacheHHC(True)

    AbsoluteErrors    = FpdbError('Absolute Poker')
    BetfairErrors     = FpdbError('Betfair')
    BetOnlineErrors   = FpdbError('BetOnline')
    BossErrors        = FpdbError('Boss')
    BovadaErrors      = FpdbError('Bovada')
    CakeErrors        = FpdbError('Cake')
    EnetErrors        = FpdbError('Enet')
    EntractionErrors  = FpdbError('Entraction')
    EverleafErrors    = FpdbError('Everleaf Poker')
    EverestErrors     = FpdbError('Everest Poker')
    FTPErrors         = FpdbError('Full Tilt Poker')
    iPokerErrors      = FpdbError('iPoker')
    MergeErrors      = FpdbError('Merge')
    MicrogamingErrors = FpdbError('Microgaming')
    OnGameErrors      = FpdbError('OnGame')
    PacificPokerErrors= FpdbError('PacificPoker')
    PartyPokerErrors  = FpdbError('Party Poker')
    PokerStarsErrors  = FpdbError('PokerStars')
    PKRErrors         = FpdbError('PKR')
    PTErrors          = FpdbError('PokerTracker')
    WinamaxErrors     = FpdbError('Winamax')

    ErrorsList = [
                    AbsoluteErrors, BetfairErrors, BetOnlineErrors, BossErrors, CakeErrors, EntractionErrors,
                    EverleafErrors, EverestErrors, FTPErrors, iPokerErrors, MergeErrors, MicrogamingErrors,
                    OnGameErrors, PacificPokerErrors, PartyPokerErrors, PokerStarsErrors, PKRErrors,
                    PTErrors, WinamaxErrors, BovadaErrors, EnetErrors,
                ]

    sites = {
                'Absolute' : False,
                'Betfair' : False,
                'BetOnline': False,
                'Boss' : False,
                'Bovada' : False,
                'Cake' : False,
                'Enet' : False,
                'Entraction' : False,
                'Everleaf' : False,
                'Everest' : False,
                'Full Tilt Poker' : False,
                'iPoker' : False,
                'Merge' : False,
                'Microgaming': False,
                'OnGame' : False,
                'Pkr' : False,
                'PacificPoker' : False,
                'PartyPoker' : False,
                'PokerStars' : False,
                'PokerTracker' : False,
                'Winamax' : False,
            }

    if test_all_sites == True:
        for s in sites:
            sites[s] = True
    else:
        sites[options.sitename] = True

    if sites['PacificPoker'] == True and not single_file_test:
        walk_testfiles("regression-test-files/cash/PacificPoker/", compare, importer, PacificPokerErrors, "PacificPoker")
        walk_testfiles("regression-test-files/tour/PacificPoker/", compare, importer, PacificPokerErrors, "PacificPoker")
        walk_testfiles("regression-test-files/summaries/PacificPoker/", compare, importer, PacificPokerErrors, "PacificPoker")
    elif sites['PacificPoker'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, PacificPokerErrors, "PacificPoker")

    if sites['PokerStars'] == True and not single_file_test:
        walk_testfiles("regression-test-files/cash/Stars/", compare, importer, PokerStarsErrors, "PokerStars")
        walk_testfiles("regression-test-files/tour/Stars/", compare, importer, PokerStarsErrors, "PokerStars")
        walk_testfiles("regression-test-files/summaries/Stars/", compare, importer, PokerStarsErrors, "PokerStars")
    elif sites['PokerStars'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, PokerStarsErrors, "PokerStars")

    if sites['Full Tilt Poker'] == True and not single_file_test:
        walk_testfiles("regression-test-files/cash/FTP/", compare, importer, FTPErrors, "Full Tilt Poker")
        walk_testfiles("regression-test-files/tour/FTP/", compare, importer, FTPErrors, "Full Tilt Poker")
        walk_testfiles("regression-test-files/summaries/FTP/", compare, importer, FTPErrors, "Full Tilt Poker")
    elif sites['Full Tilt Poker'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, FTPErrors, "Full Tilt Poker")
    if sites['PartyPoker'] == True and not single_file_test:
        walk_testfiles("regression-test-files/cash/PartyPoker/", compare, importer, PartyPokerErrors, "PartyPoker")
        walk_testfiles("regression-test-files/tour/PartyPoker/", compare, importer, PartyPokerErrors, "PartyPoker")
    elif sites['PartyPoker'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, PartyPokerErrors, "PartyPoker")
    if sites['Betfair'] == True and not single_file_test:
        walk_testfiles("regression-test-files/cash/Betfair/", compare, importer, BetfairErrors, "Betfair")
    elif sites['Betfair'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, BetfairErrors, "Betfair")
    if sites['OnGame'] == True and not single_file_test:
        walk_testfiles("regression-test-files/cash/OnGame/", compare, importer, OnGameErrors, "OnGame")
        walk_testfiles("regression-test-files/tour/OnGame/", compare, importer, OnGameErrors, "OnGame")
    elif sites['OnGame'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, OnGameErrors, "OnGame")
    if sites['Absolute'] == True and not single_file_test:
        walk_testfiles("regression-test-files/cash/Absolute/", compare, importer, AbsoluteErrors, "Absolute")
        walk_testfiles("regression-test-files/tour/Absolute/", compare, importer, AbsoluteErrors, "Absolute")
    elif sites['Absolute'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, AbsoluteErrors, "Absolute")
    if sites['Everleaf'] == True and not single_file_test:
        walk_testfiles("regression-test-files/cash/Everleaf/", compare, importer, EverleafErrors, "Everleaf")
        walk_testfiles("regression-test-files/tour/Everleaf/", compare, importer, EverleafErrors, "Everleaf")
    elif sites['Everleaf'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, EverleafErrors, "Everleaf")
    if sites['Everest'] == True and not single_file_test:
        walk_testfiles("regression-test-files/cash/Everest/", compare, importer, EverestErrors, "Everest")
        walk_testfiles("regression-test-files/tour/Everest/", compare, importer, EverestErrors, "Everest")
    elif sites['Everest'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, EverestErrors, "Everest")
    if sites['Merge'] == True and not single_file_test:
        walk_testfiles("regression-test-files/cash/Merge/", compare, importer, MergeErrors, "Merge")
        walk_testfiles("regression-test-files/tour/Merge/", compare, importer, MergeErrors, "Merge")
    elif sites['Merge'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, MergeErrors, "Merge")
    if sites['Pkr'] == True and not single_file_test:
        walk_testfiles("regression-test-files/cash/PKR/", compare, importer, PKRErrors, "PKR")
        walk_testfiles("regression-test-files/tour/PKR/", compare, importer, PKRErrors, "PKR")
    elif sites['Pkr'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, PKRErrors, "PKR")
    if sites['iPoker'] == True and not single_file_test:
        walk_testfiles("regression-test-files/cash/iPoker/", compare, importer, iPokerErrors, "iPoker")
        walk_testfiles("regression-test-files/tour/iPoker/", compare, importer, iPokerErrors, "iPoker")
    elif sites['iPoker'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, iPokerErrors, "iPoker")
    if sites['Boss'] == True and not single_file_test:
        walk_testfiles("regression-test-files/cash/Boss/", compare, importer, BossErrors, "Boss")
        walk_testfiles("regression-test-files/tour/Boss/", compare, importer, BossErrors, "Boss")
    elif sites['Boss'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, BossErrors, "Boss")
    if sites['Entraction'] == True and not single_file_test:
        walk_testfiles("regression-test-files/cash/Entraction/", compare, importer, EntractionErrors, "Entraction")
        walk_testfiles("regression-test-files/tour/Entraction/", compare, importer, EntractionErrors, "Entraction")
    elif sites['Entraction'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, EntractionErrors, "Entraction")
    if sites['BetOnline'] == True and not single_file_test:
        walk_testfiles("regression-test-files/cash/BetOnline/", compare, importer, BetOnlineErrors, "BetOnline")
        walk_testfiles("regression-test-files/tour/BetOnline/", compare, importer, BetOnlineErrors, "BetOnline")
    elif sites['BetOnline'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, BetOnlineErrors, "BetOnline")
    if sites['Microgaming'] == True and not single_file_test:
        walk_testfiles("regression-test-files/cash/Microgaming/", compare, importer, MicrogamingErrors, "Microgaming")
        walk_testfiles("regression-test-files/tour/Microgaming/", compare, importer, MicrogamingErrors, "Microgaming")
    elif sites['Microgaming'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, MicrogamingErrors, "Microgaming")
    if sites['Cake'] == True and not single_file_test:
        walk_testfiles("regression-test-files/cash/Cake/", compare, importer, CakeErrors, "Cake")
        walk_testfiles("regression-test-files/tour/Cake/", compare, importer, CakeErrors, "Cake")
    elif sites['Cake'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, CakeErrors, "Cake")
    if sites['PokerTracker'] == True and not single_file_test:
        walk_testfiles("regression-test-files/cash/PokerTracker/", compare, importer, PTErrors, "PokerTracker")
        walk_testfiles("regression-test-files/tour/PokerTracker/", compare, importer, PTErrors, "PokerTracker")
    elif sites['PokerTracker'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, PTErrors, "PokerTracker")
    if sites['Winamax'] == True and not single_file_test:
        walk_testfiles("regression-test-files/cash/Winamax/", compare, importer, WinamaxErrors, "Winamax")
        walk_testfiles("regression-test-files/tour/Winamax/", compare, importer, WinamaxErrors, "Winamax")
    elif sites['Winamax'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, WinamaxErrors, "Winamax")
    if sites['Bovada'] == True and not single_file_test:
        walk_testfiles("regression-test-files/cash/Bovada/", compare, importer, BovadaErrors, "Bovada")
        walk_testfiles("regression-test-files/tour/Bovada/", compare, importer, BovadaErrors, "Bovada")
    elif sites['Bovada'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, BovadaErrors, "Bovada")
    if sites['Enet'] == True and not single_file_test:
        walk_testfiles("regression-test-files/cash/Enet/", compare, importer, EnetErrors, "Enet")
    elif sites['Enet'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, EnetErrors, "Enet")



    totalerrors = 0

    for i, site in enumerate(ErrorsList):
        totalerrors += ErrorsList[i].errorcount

    for i, site in enumerate(ErrorsList):
        ErrorsList[i].print_histogram()

    # Merge the dicts of stats from the various error objects
    statdict = {}
    for i, site in enumerate(ErrorsList):
        tmp = ErrorsList[i].statcount
        for stat in tmp:
            if stat in statdict:
                statdict[stat] += tmp[stat]
            else:
                statdict[stat] = tmp[stat]

    print "\n"
    print "---------------------"
    print "Errors by stat:"
    print "---------------------"
    #for stat in statdict:
    #    print "(%3d) : %s" %(statdict[stat], stat)

    sortedstats = sorted([(value,key) for (key,value) in statdict.items()])
    for num, stat in sortedstats:
        print "(%3d) : %s" %(num, stat)

    print "---------------------"
    print "Total Errors: %d" % totalerrors
    print "---------------------"

    print "-------- Parse Error List --------"
    for i, site in enumerate(ErrorsList):
        ErrorsList[i].print_parse_list()
                pass  # there's no "PLAYER - Mucks" at AP that I can see


def validCard(card):
    card = card.strip()
    if card == '10s': card = 'Ts'
    if card == '10h': card = 'Th'
    if card == '10d': card = 'Td'
    if card == '10c': card = 'Tc'
    return card


if __name__ == "__main__":
    import Configuration
    import Database
    config = Configuration.Config(None)
    # line below this is required
    # because config.site_ids (site_name to site_id map) is required
    # and one is stored and db.
    db = Database.Database(config)

    parser = OptionParser()
    parser.add_option("-i",
                      "--input",
                      dest="ipath",
                      help=_("parse input hand history"),
                      default="-")
    parser.add_option("-o",
                      "--output",
                      dest="opath",
                      help=_("output translation to"),
def main(argv=None):
    if argv is None:
        argv = sys.argv[1:]

    config = Configuration.Config(file="HUD_config.test.xml")
    db = Database.Database(config)
    sql = SQL.Sql(db_server='sqlite')
    db.recreate_tables()

    importer = SummaryImporter(config, sql, None)

    PokerStarsErrors = FpdbError('PokerStars')
    FTPErrors = FpdbError('Full Tilt Poker')
    #PartyPokerErrors  = FpdbError('Party Poker')
    #BetfairErrors     = FpdbError('Betfair')
    #OnGameErrors      = FpdbError('OnGame')
    #AbsoluteErrors    = FpdbError('Absolute Poker')
    #UltimateBetErrors = FpdbError('Ultimate Bet')
    #EverleafErrors    = FpdbError('Everleaf Poker')
    #CarbonErrors      = FpdbError('Carbon')
    #PKRErrors         = FpdbError('PKR')
    #iPokerErrors      = FpdbError('iPoker')
    WinamaxErrors = FpdbError('Winamax')

    ErrorsList = [
        PokerStarsErrors,
        FTPErrors,
        WinamaxErrors,
        #PartyPokerErrors,
        #BetfairErrors, OnGameErrors, AbsoluteErrors,
        #EverleafErrors, CarbonErrors, PKRErrors,
        #iPokerErrors, UltimateBetErrors,
    ]

    sites = {
        'PokerStars': True,
        'Full Tilt Poker': True,
        #'PartyPoker' : True,
        #'Betfair' : True,
        #'OnGame' : True,
        #'Absolute' : True,
        #'UltimateBet' : True,
        #'Everleaf' : True,
        #'Carbon' : True,
        #'PKR' : False,
        #'iPoker' : True,
        'Winamax': True,
    }

    if sites['PokerStars'] == True:
        walk_testfiles("regression-test-files/summaries/Stars/", compare,
                       importer, PokerStarsErrors, "PokerStars")
    if sites['Full Tilt Poker'] == True:
        walk_testfiles("regression-test-files/summaries/FTP/", compare,
                       importer, FTPErrors, "Full Tilt Poker")
    #    walk_testfiles("regression-test-files/tour/FTP/", compare, importer, FTPErrors, "Full Tilt Poker")
    #if sites['PartyPoker'] == True:
    #    walk_testfiles("regression-test-files/cash/PartyPoker/", compare, importer, PartyPokerErrors, "PartyPoker")
    #    walk_testfiles("regression-test-files/tour/PartyPoker/", compare, importer, PartyPokerErrors, "PartyPoker")
    #if sites['Betfair'] == True:
    #    walk_testfiles("regression-test-files/cash/Betfair/", compare, importer, BetfairErrors, "Betfair")
    #if sites['OnGame'] == True:
    #    walk_testfiles("regression-test-files/cash/OnGame/", compare, importer, OnGameErrors, "OnGame")
    #if sites['Absolute'] == True:
    #    walk_testfiles("regression-test-files/cash/Absolute/", compare, importer, AbsoluteErrors, "Absolute")
    #if sites['UltimateBet'] == True:
    #    walk_testfiles("regression-test-files/cash/UltimateBet/", compare, importer, UltimateBetErrors, "Absolute")
    #if sites['Everleaf'] == True:
    #    walk_testfiles("regression-test-files/cash/Everleaf/", compare, importer, EverleafErrors, "Everleaf")
    #if sites['Carbon'] == True:
    #    walk_testfiles("regression-test-files/cash/Carbon/", compare, importer, CarbonErrors, "Carbon")
    #if sites['PKR'] == True:
    #    walk_testfiles("regression-test-files/cash/PKR/", compare, importer, PKRErrors, "PKR")
    #if sites['iPoker'] == True:
    #    walk_testfiles("regression-test-files/cash/iPoker/", compare, importer, iPokerErrors, "iPoker")
    if sites['Winamax'] == True:
        walk_testfiles("regression-test-files/summaries/Winamax/", compare,
                       importer, WinamaxErrors, "Winamax")

    totalerrors = 0

    for i, site in enumerate(ErrorsList):
        totalerrors += ErrorsList[i].errorcount

    print "---------------------"
    print "Total Errors: %d" % totalerrors
    print "---------------------"
    for i, site in enumerate(ErrorsList):
        ErrorsList[i].print_histogram()

    # Merge the dicts of stats from the various error objects
    statdict = {}
    for i, site in enumerate(ErrorsList):
        tmp = ErrorsList[i].statcount
        for stat in tmp:
            if stat in statdict:
                statdict[stat] += tmp[stat]
            else:
                statdict[stat] = tmp[stat]

    print "\n"
    print "---------------------"
    print "Errors by stat:"
    print "---------------------"
    #for stat in statdict:
    #    print "(%3d) : %s" %(statdict[stat], stat)

    sortedstats = sorted([(value, key) for (key, value) in statdict.items()])
    for num, stat in sortedstats:
        print "(%3d) : %s" % (num, stat)
Пример #23
0
def main(argv=None):
    """main can also be called in the python interpreter, by supplying the command line as the argument."""
    if argv is None:
        argv = sys.argv[1:]

    def destroy(*args):  # call back for terminating the main eventloop
        gtk.main_quit()

    parser = OptionParser()
    parser.add_option("-f",
                      "--file",
                      dest="filename",
                      metavar="FILE",
                      default=None,
                      help=_("Input file in quiet mode"))
    parser.add_option(
        "-q",
        "--quiet",
        action="store_false",
        dest="gui",
        default=True,
        help=_("don't start gui; deprecated (just give a filename with -f)."))
    parser.add_option(
        "-c",
        "--convert",
        dest="filtername",
        default="PokerStars",
        metavar="FILTER",
        help=
        _("Conversion filter (*Full Tilt Poker, PokerStars, Everleaf, Absolute)"
          ))
    parser.add_option(
        "-x",
        "--failOnError",
        action="store_true",
        default=False,
        help=_(
            "If this option is passed it quits when it encounters any error"))
    parser.add_option(
        "-m",
        "--minPrint",
        "--status",
        dest="minPrint",
        default="0",
        type="int",
        help=
        _("How often to print a one-line status report (0 (default) means never)"
          ))
    parser.add_option("-u",
                      "--usage",
                      action="store_true",
                      dest="usage",
                      default=False,
                      help=_("Print some useful one liners"))
    parser.add_option(
        "-s",
        "--starsarchive",
        action="store_true",
        dest="starsArchive",
        default=False,
        help=
        _("Do the required conversion for Stars Archive format (ie. as provided by support"
          ))
    parser.add_option(
        "-t",
        "--testdata",
        action="store_true",
        dest="testData",
        default=False,
        help=
        _("Output the pprinted version of the HandsPlayer hash for regresion testing"
          ))
    (options, argv) = parser.parse_args(args=argv)

    if options.usage == True:
        #Print usage examples and exit
        print _("USAGE:")
        print _(
            'PokerStars converter: ./GuiBulkImport.py -c PokerStars -f filename'
        )
        print _(
            'Full Tilt  converter: ./GuiBulkImport.py -c "Full Tilt Poker" -f filename'
        )
        print _(
            "Everleaf   converter: ./GuiBulkImport.py -c Everleaf -f filename")
        print _(
            "Absolute   converter: ./GuiBulkImport.py -c Absolute -f filename")
        print _(
            "PartyPoker converter: ./GuiBulkImport.py -c PartyPoker -f filename"
        )
        sys.exit(0)

    config = Configuration.Config()

    settings = {}
    settings['minPrint'] = options.minPrint
    if os.name == 'nt': settings['os'] = 'windows'
    else: settings['os'] = 'linuxmac'

    settings.update(config.get_db_parameters())
    settings.update(config.get_import_parameters())
    settings.update(config.get_default_paths())

    if not options.gui:
        print _('-q is deprecated. Just use "-f filename" instead')
        # This is because -q on its own causes an error, so -f is necessary and sufficient for cmd line use
    if not options.filename:
        i = GuiBulkImport(settings, config)
        main_window = gtk.Window()
        main_window.connect('destroy', destroy)
        main_window.add(i.vbox)
        main_window.show()
        gtk.main()
    else:
        #Do something useful
        importer = fpdb_import.Importer(False, settings, config)
        # importer.setDropIndexes("auto")
        importer.setDropIndexes(_("don't drop"))
        importer.setFailOnError(options.failOnError)
        importer.setThreads(-1)
        importer.addBulkImportImportFileOrDir(os.path.expanduser(
            options.filename),
                                              site=options.filtername)
        importer.setCallHud(False)
        if options.starsArchive:
            importer.setStarsArchive(True)
        if options.testData:
            importer.setPrintTestData(True)
        (stored, dups, partial, errs, ttime) = importer.runImport()
        importer.clearFileList()
        print _('GuiBulkImport done: Stored: %d \tDuplicates: %d \tPartial: %d \tErrors: %d in %s seconds - %.0f/sec')\
                     % (stored, dups, partial, errs, ttime, (stored+0.0) / ttime)
Пример #24
0

def destroy(*args):  # call back for terminating the main eventloop
    gtk.main_quit()


if __name__ == "__main__":
    sys.stderr.write(_("HUD_main starting\n"))

    try:
        HUD_main.db_name = sys.argv[1]
    except:
        HUD_main.db_name = 'fpdb'
    sys.stderr.write(_("Using db name = %s\n") % (HUD_main.db_name))

    HUD_main.config = Configuration.Config()

    gobject.threads_init()  # this is required
    hud = HUD_main.HUD_main()
    thread.start_new_thread(hud.read_stdin, ())  # starts the thread

    HUD_main.main_window = gtk.Window()
    HUD_main.main_window.connect("destroy", destroy)
    HUD_main.eb = gtk.VBox()
    label = gtk.Label(_('Closing this window will exit from the HUD.'))
    HUD_main.eb.add(label)
    HUD_main.main_window.add(HUD_main.eb)

    HUD_main.main_window.set_title(_("HUD Main Window"))
    HUD_main.main_window.show_all()
Пример #25
0
def main(argv=None):
    if argv is None:
        argv = sys.argv[1:]

    Configuration.set_logfile("fpdb-log.txt")
    (options, argv) = Options.fpdb_options()

    test_all_sites = True

    if options.usage == True:
        usage()

    single_file_test = False

    if options.sitename:
        options.sitename = Options.site_alias(options.sitename)
        if options.sitename == False:
            usage()
        if options.filename:
            print "Testing single hand: '%s'" % options.filename
            single_file_test = True
        else:
            print "Only regression testing '%s' files" % (options.sitename)
        test_all_sites = False

    config = Configuration.Config(file="HUD_config.test.xml")
    db = Database.Database(config)
    sql = SQL.Sql(db_server='sqlite')
    db.recreate_tables()

    importer = SummaryImporter(config, sql, None)

    PokerStarsErrors = FpdbError('PokerStars')
    FTPErrors = FpdbError('Full Tilt Poker')
    #PartyPokerErrors  = FpdbError('Party Poker')
    #BetfairErrors     = FpdbError('Betfair')
    #OnGameErrors      = FpdbError('OnGame')
    #AbsoluteErrors    = FpdbError('Absolute Poker')
    #UltimateBetErrors = FpdbError('Ultimate Bet')
    #EverleafErrors    = FpdbError('Everleaf Poker')
    MergeErrors = FpdbError('Merge')
    #PKRErrors         = FpdbError('PKR')
    iPokerErrors = FpdbError('iPoker')
    #WinamaxErrors     = FpdbError('Winamax')

    ErrorsList = [
        PokerStarsErrors,
        FTPErrors,  #WinamaxErrors,
        MergeErrors,
        iPokerErrors,
        #PartyPokerErrors,
        #BetfairErrors, OnGameErrors, AbsoluteErrors,
        #EverleafErrors, PKRErrors,
        #UltimateBetErrors,
    ]

    sites = {
        'PokerStars': False,
        'Full Tilt Poker': False,
        #'PartyPoker' : True,
        #'Betfair' : True,
        #'OnGame' : True,
        #'Absolute' : True,
        #'UltimateBet' : True,
        #'Everleaf' : True,
        'Merge': False,
        #'PKR' : False,
        'iPoker': False,
        #            'Winamax' : False,
    }

    if test_all_sites == True:
        for s in sites:
            sites[s] = True
    else:
        sites[options.sitename] = True

    if sites['PokerStars'] == True and not single_file_test:
        walk_testfiles("regression-test-files/summaries/Stars/", compare,
                       importer, PokerStarsErrors, "PokerStars")
    elif sites['PokerStars'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, PokerStarsErrors,
                       "PokerStars")
    if sites['Full Tilt Poker'] == True and not single_file_test:
        walk_testfiles("regression-test-files/summaries/FTP/", compare,
                       importer, FTPErrors, "Full Tilt Poker")
    elif sites['Full Tilt Poker'] == True and single_file_test:
        walk_testfiles(options.filename, compare, importer, FTPErrors,
                       "Full Tilt Poker")
    #if sites['PartyPoker'] == True:
    #    walk_testfiles("regression-test-files/cash/PartyPoker/", compare, importer, PartyPokerErrors, "PartyPoker")
    #    walk_testfiles("regression-test-files/tour/PartyPoker/", compare, importer, PartyPokerErrors, "PartyPoker")
    #if sites['Betfair'] == True:
    #    walk_testfiles("regression-test-files/cash/Betfair/", compare, importer, BetfairErrors, "Betfair")
    #if sites['OnGame'] == True:
    #    walk_testfiles("regression-test-files/cash/OnGame/", compare, importer, OnGameErrors, "OnGame")
    #if sites['Absolute'] == True:
    #    walk_testfiles("regression-test-files/cash/Absolute/", compare, importer, AbsoluteErrors, "Absolute")
    #if sites['UltimateBet'] == True:
    #    walk_testfiles("regression-test-files/cash/UltimateBet/", compare, importer, UltimateBetErrors, "Absolute")
    #if sites['Everleaf'] == True:
    #    walk_testfiles("regression-test-files/cash/Everleaf/", compare, importer, EverleafErrors, "Everleaf")
    if sites['Merge'] == True:
        walk_testfiles("regression-test-files/cash/Merge/", compare, importer,
                       MergeErrors, "Merge")
    #if sites['PKR'] == True:
    #    walk_testfiles("regression-test-files/cash/PKR/", compare, importer, PKRErrors, "PKR")
    if sites['iPoker'] == True:
        walk_testfiles("regression-test-files/tour/iPoker/", compare, importer,
                       iPokerErrors, "iPoker")
    #if sites['Winamax'] == True:
    #    walk_testfiles("regression-test-files/summaries/Winamax/", compare, importer, WinamaxErrors, "Winamax")

    totalerrors = 0

    for i, site in enumerate(ErrorsList):
        totalerrors += ErrorsList[i].errorcount

    print "---------------------"
    print "Total Errors: %d" % totalerrors
    print "---------------------"
    for i, site in enumerate(ErrorsList):
        ErrorsList[i].print_histogram()

    # Merge the dicts of stats from the various error objects
    statdict = {}
    for i, site in enumerate(ErrorsList):
        tmp = ErrorsList[i].statcount
        for stat in tmp:
            if stat in statdict:
                statdict[stat] += tmp[stat]
            else:
                statdict[stat] = tmp[stat]

    print "\n"
    print "---------------------"
    print "Errors by stat:"
    print "---------------------"
    #for stat in statdict:
    #    print "(%3d) : %s" %(statdict[stat], stat)

    sortedstats = sorted([(value, key) for (key, value) in statdict.items()])
    for num, stat in sortedstats:
        print "(%3d) : %s" % (num, stat)