diff --git a/pyfpdb/AbsoluteToFpdb.py b/pyfpdb/AbsoluteToFpdb.py index 3017ba0b..503c1f4e 100644 --- a/pyfpdb/AbsoluteToFpdb.py +++ b/pyfpdb/AbsoluteToFpdb.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2008, Carl Gherardi @@ -60,7 +60,7 @@ debugging: if False, pass on partially supported game types. If true, have a go logging.info("Initialising Absolute converter class") self.filetype = "text" self.codepage = "cp1252" - self.siteId = 5 # Needs to match id entry in Sites database + self.siteId = 8 # Needs to match id entry in Sites database self.debugging = debugging if autostart: self.start() @@ -79,7 +79,7 @@ debugging: if False, pass on partially supported game types. If true, have a go # TODO: Absolute posting when coming in new: %s - Posts $0.02 .. should that be a new Post line? where do we need to add support for that? *confused* self.re_PostBoth = re.compile(ur"^%s - Posts dead (?:\$| €|)(?P[0-9]*[.0-9]+)" % player_re, re.MULTILINE) self.re_Action = re.compile(ur"^%s - (?PBets |Raises |All-In |All-In\(Raise\) |Calls |Folds|Checks)?\$?(?P[0-9]*[.0-9]+)?" % player_re, re.MULTILINE) - print "^%s - (?PBets |Raises |All-In |All-In\(Raise\) |Calls |Folds|Checks)?\$?(?P[0-9]*[.0-9]+)?" % player_re +# print "^%s - (?PBets |Raises |All-In |All-In\(Raise\) |Calls |Folds|Checks)?\$?(?P[0-9]*[.0-9]+)?" % player_re self.re_ShowdownAction = re.compile(ur"^%s - Shows \[(?P.*)\]" % player_re, re.MULTILINE) self.re_CollectPot = re.compile(ur"^Seat [0-9]: %s(?: \(dealer\)| \(big blind\)| \(small blind\)|) (?:won|collected) Total \((?:\$| €|)(?P[0-9]*[.0-9]+)\)" % player_re, re.MULTILINE) #self.re_PostSB = re.compile(ur"^%s: posts small blind \[(?:\$| €|) (?P[.0-9]+)" % player_re, re.MULTILINE) diff --git a/pyfpdb/GuiAutoImport.py b/pyfpdb/GuiAutoImport.py index e86bab67..b1815e95 100755 --- a/pyfpdb/GuiAutoImport.py +++ b/pyfpdb/GuiAutoImport.py @@ -17,6 +17,7 @@ import threading import subprocess +import traceback import pygtk pygtk.require('2.0') diff --git a/pyfpdb/GuiPlayerStats.py b/pyfpdb/GuiPlayerStats.py index bc07f7d0..add46bef 100644 --- a/pyfpdb/GuiPlayerStats.py +++ b/pyfpdb/GuiPlayerStats.py @@ -167,7 +167,9 @@ class GuiPlayerStats (threading.Thread): for site in sites: if sites[site] == True: sitenos.append(siteids[site]) - self.cursor.execute(self.sql.query['getPlayerId'], (heroes[site],)) + # Nasty hack to deal with multiple sites + same player name -Eric + que = self.sql.query['getPlayerId'] + " AND siteId=%d" % siteids[site] + self.cursor.execute(que, (heroes[site],)) result = self.db.cursor.fetchall() if len(result) == 1: playerids.append(result[0][0]) diff --git a/pyfpdb/HUD_main.py b/pyfpdb/HUD_main.py index b240b64c..ac8332f3 100755 --- a/pyfpdb/HUD_main.py +++ b/pyfpdb/HUD_main.py @@ -37,7 +37,7 @@ import traceback if not options.errorsToConsole: print "Note: error output is being diverted to fpdb-error-log.txt and HUD-error.txt. Any major error will be reported there _only_." - errorFile = open('fpdb-error-log.txt', 'w', 0) + errorFile = open('HUD-error.txt', 'w', 0) sys.stderr = errorFile import thread diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py index d91becb8..b0a26b2a 100644 --- a/pyfpdb/fpdb_simple.py +++ b/pyfpdb/fpdb_simple.py @@ -991,19 +991,28 @@ def recogniseTourneyTypeId(cursor, siteId, buyin, fee, knockout, rebuyOrAddon): # return result def recognisePlayerIDs(cursor, names, site_id): - q = "SELECT name,id FROM Players WHERE name=%s" % " OR name=".join(["%s" for n in names]) +# print "\nrecognisePlayerIDs names=",len(names),names + q = "SELECT name,id FROM Players WHERE siteid=%d and (name=%s)" % (site_id, " OR name=".join(["%s" for n in names])) +# print "q=",q cursor.execute(q, names) # get all playerids by the names passed in ids = dict(cursor.fetchall()) # convert to dict +# print "ids(1)=",len(ids),ids if len(ids) != len(names): notfound = [n for n in names if n not in ids] # make list of names not in database +# print "notfound=", notfound if notfound: # insert them into database cursor.executemany("INSERT INTO Players (name, siteId) VALUES (%s, "+str(site_id)+")", [(n,) for n in notfound]) - q2 = "SELECT name,id FROM Players WHERE name=%s" % " OR name=".join(["%s" for n in notfound]) + q2 = "SELECT name,id FROM Players WHERE siteid=%d and (name=%s)" % (site_id, " OR name=".join(["%s" for n in notfound])) cursor.execute(q2, notfound) # get their new ids tmp = cursor.fetchall() +# print "tmp=", tmp for n,id in tmp: # put them all into the same dict ids[n] = id # return them in the SAME ORDER that they came in in the names argument, rather than the order they came out of the DB +# print "ids=",ids +# list = [ids[n] for n in names] +# print "list=",list +# print "\n" return [ids[n] for n in names] #end def recognisePlayerIDs