From 3ce0f91b277a6c4511cdfd83a05911e2e00c9b29 Mon Sep 17 00:00:00 2001 From: eblade Date: Thu, 30 Jul 2009 19:53:44 -0400 Subject: [PATCH 1/3] useless change of a comment just to test my rss output --- pyfpdb/fpdb_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index 9d76be69..f9b4cec9 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -351,7 +351,7 @@ class Importer: starttime = time() last_read_hand = 0 loc = 0 - #print "file =", file + # print "file =", file if file == "stdin": inputFile = sys.stdin else: From c400fd9ba7032df39ad93f12884e0bd1da09ed65 Mon Sep 17 00:00:00 2001 From: eblade Date: Thu, 30 Jul 2009 20:56:39 -0400 Subject: [PATCH 2/3] FTtoFpdb: default buyin to $0.00+$0.00 and level to 0, they don't seem to be in the FT hh --- pyfpdb/FulltiltToFpdb.py | 6 ++++++ pyfpdb/Hand.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index 3b8026bf..51b62174 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -176,6 +176,12 @@ follow : whether to tail -f the input""" hand.tourNo = m.group('TOURNO') if m.group('PLAY') != None: hand.gametype['currency'] = 'play' + + # TODO: if there's a way to figure these out, we should.. otherwise we have to stuff it with unknowns + if hand.buyin == None: + hand.buyin = "$0.00+$0.00" + if hand.level == None: + hand.level = "0" # These work, but the info is already in the Hand class - should be used for tourneys though. # m.group('SB') diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 4e7d4bdf..50fab822 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -564,7 +564,7 @@ Map the tuple self.gametype onto the pokerstars string describing it def writeGameLine(self): """Return the first HH line for the current hand.""" gs = "PokerStars Game #%s: " % self.handid - + if self.tourNo != None and self.mixed != None: # mixed tournament gs = gs + "Tournament #%s, %s %s (%s) - Level %s (%s) - " % (self.tourNo, self.buyin, self.MS[self.mixed], self.getGameTypeAsString(), self.level, self.getStakesAsString()) elif self.tourNo != None: # all other tournaments From f5ba0b5b7fe9cbc84bac9ff7f4a32c162140826b Mon Sep 17 00:00:00 2001 From: eblade Date: Thu, 30 Jul 2009 21:50:08 -0400 Subject: [PATCH 3/3] Database: insert missing HandToWrite.payin_amounts var EverleafToFpdb: remove DEBUG XXXXXXX line FulltiltToFpdb: pass on converting tournament hands Hand: add Hand.fee var that Database is looking for fpdb_import: clean up file update scan code, queue files that have changed in the last 60 seconds for the next importer pass, instead of locking it up reading them now (not that this does anything since FT no longer updates the mtime until it closes the table, but maybe it works with Stars or others) --- pyfpdb/Database.py | 1 + pyfpdb/EverleafToFpdb.py | 2 +- pyfpdb/FulltiltToFpdb.py | 1 + pyfpdb/Hand.py | 1 + pyfpdb/fpdb_import.py | 22 +++++++--------------- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 8d58da50..9e0007a3 100755 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -1620,6 +1620,7 @@ class HandToWrite: self.maxSeats = None self.tableName = None self.seatNos = None + self.payin_amounts = None # tourney import was complaining mightily about this missing except: print "htw.init error: " + str(sys.exc_info()) raise diff --git a/pyfpdb/EverleafToFpdb.py b/pyfpdb/EverleafToFpdb.py index a7685f90..9c63bcf0 100755 --- a/pyfpdb/EverleafToFpdb.py +++ b/pyfpdb/EverleafToFpdb.py @@ -44,7 +44,7 @@ out_path (default '-' = sys.stdout) follow : whether to tail -f the input autostart: whether to run the thread (or you can call start() yourself) debugging: if False, pass on partially supported game types. If true, have a go and error...""" - print "DEBUG: XXXXXXXXXXXXXXX" + #print "DEBUG: XXXXXXXXXXXXXXX" HandHistoryConverter.__init__(self, in_path, out_path, sitename="Everleaf", follow=follow, index=index) logging.info("Initialising Everleaf converter class") self.filetype = "text" diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index 51b62174..a68c1cbd 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -140,6 +140,7 @@ follow : whether to tail -f the input""" if mg['TOURNO'] == None: info['type'] = "ring" else: info['type'] = "tour" # NB: SB, BB must be interpreted as blinds or bets depending on limit type. + if info['type'] == "tour": return None # importer is screwed on tournies, pass on those hands so we don't interrupt other autoimporting return info #Following function is a hack, we should be dealing with this in readFile (i think correct codepage....) diff --git a/pyfpdb/Hand.py b/pyfpdb/Hand.py index 50fab822..0dbb9674 100644 --- a/pyfpdb/Hand.py +++ b/pyfpdb/Hand.py @@ -56,6 +56,7 @@ class Hand(object): self.buttonpos = 0 self.tourNo = None self.buyin = None + self.fee = None # the Database code is looking for this one .. ? self.level = None self.mixed = None self.seating = [] diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index f9b4cec9..76b483ba 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -268,23 +268,15 @@ class Importer: if os.path.exists(file): stat_info = os.stat(file) #rulog.writelines("path exists ") - try: - lastupdate = self.updated[file] - #rulog.writelines("lastupdate = %d, mtime = %d" % (lastupdate,stat_info.st_mtime)) - if stat_info.st_size > lastupdate: #stat_info.st_mtime > lastupdate: + if file in self.updated: + if stat_info.st_size > self.updated[file]: self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1]) - self.updated[file] = stat_info.st_size #time() - except: - self.updated[file] = stat_info.st_size #time() - # If modified in the last minute run an immediate import. - # This codepath only runs first time the file is found. + self.updated[file] = stat_info.st_size + else: if os.path.isdir(file) or (time() - stat_info.st_mtime) < 60: - # TODO attach a HHC thread to the file - # TODO import the output of the HHC thread -- this needs to wait for the HHC to block? - self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1]) - # TODO we also test if directory, why? - #if os.path.isdir(file): - #self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1]) + self.updated[file] = 0 + else: + self.updated[file] = stat_info.st_size else: self.removeFromFileList[file] = True self.addToDirList = filter(lambda x: self.addImportDirectory(x, True, self.addToDirList[x][0], self.addToDirList[x][1]), self.addToDirList)