From 660530a166484feb3b607d74968c2cd427455415 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Mon, 18 Aug 2008 09:05:22 +0100 Subject: [PATCH] p56 - various fixes to get FTP working again fixed in prev commit: sometimes truncuates position on store in tourneys --- docs/known-bugs-and-planned-features.txt | 4 ++-- pyfpdb/fpdb.py | 2 +- pyfpdb/fpdb_parse_logic.py | 8 ++++--- pyfpdb/fpdb_simple.py | 27 +++++++++++++++++------- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt index 87123cfa..966c22df 100644 --- a/docs/known-bugs-and-planned-features.txt +++ b/docs/known-bugs-and-planned-features.txt @@ -12,6 +12,7 @@ re-run existing regression tests alpha3 ====== +ftp: read maxSeats add sf.net logo to webpage separate db table design version and last bugfix in importer change tabledesign VALIGN @@ -56,10 +57,9 @@ use different colours according to classification. add stud, razz back to imp/tv but with less seperate codepathes move prepare-git.sh and create-release.sh to utils offer not storing db password -change definition of bet to exclude bring in? +change definition of bet to exclude bring in in tv, select from hud table using named fields rather than the current * remove remains of mysql/myisam support. -tourney bug: sometimes truncuates position on store -> possibly indicates much bigger problem fix GUI's load profile HUD config wizard diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py index e0e2c3f6..8fedf631 100755 --- a/pyfpdb/fpdb.py +++ b/pyfpdb/fpdb.py @@ -370,7 +370,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt") self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.connect("delete_event", self.delete_event) self.window.connect("destroy", self.destroy) - self.window.set_title("Free Poker DB - version: alpha1+, p55") + self.window.set_title("Free Poker DB - version: alpha1+, p56") self.window.set_border_width(1) self.window.set_size_request(1020,400) self.window.set_resizable(True) diff --git a/pyfpdb/fpdb_parse_logic.py b/pyfpdb/fpdb_parse_logic.py index aa644a0c..8ab7fe2e 100644 --- a/pyfpdb/fpdb_parse_logic.py +++ b/pyfpdb/fpdb_parse_logic.py @@ -90,11 +90,13 @@ def mainParser(db, cursor, site, category, hand): elif (lineTypes[i]=="ante"): fpdb_simple.parseAnteLine(hand[i], site, names, antes) elif (lineTypes[i]=="table"): - result=fpdb_simple.parseTableLine(hand[i]) - maxSeats=result['maxSeats'] - tableName=result['tableName'] + tableResult=fpdb_simple.parseTableLine(site, hand[i]) else: raise fpdb_simple.FpdbError("unrecognised lineType:"+lineTypes[i]) + if site=="ftp": + tableResult=fpdb_simple.parseTableLine(site, hand[0]) + maxSeats=tableResult['maxSeats'] + tableName=tableResult['tableName'] #part 5: final preparations, then call fpdb_save_to_db.saveHoldem with # the arrays as they are - that file will fill them. diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py index ef132da8..2307e8f0 100644 --- a/pyfpdb/fpdb_simple.py +++ b/pyfpdb/fpdb_simple.py @@ -19,6 +19,9 @@ import datetime +PS=1 +FTP=2 + class DuplicateError(Exception): def __init__(self, value): self.value = value @@ -881,15 +884,23 @@ def parseSiteHandNo(topline): return topline[pos1:pos2] #end def parseSiteHandNo -def parseTableLine(line): +def parseTableLine(site, line): """returns a dictionary with maxSeats and tableName""" - pos1=line.find('\'')+1 - pos2=line.find('\'', pos1) - #print "table:",line[pos1:pos2] - pos3=pos2+2 - pos4=line.find("-max") - #print "seats:",line[pos3:pos4] - return {'maxSeats':int(line[pos3:pos4]), 'tableName':line[pos1:pos2]} + if site=="ps": + pos1=line.find('\'')+1 + pos2=line.find('\'', pos1) + #print "table:",line[pos1:pos2] + pos3=pos2+2 + pos4=line.find("-max") + #print "seats:",line[pos3:pos4] + return {'maxSeats':int(line[pos3:pos4]), 'tableName':line[pos1:pos2]} + elif site=="ftp": + pos1=line.find("Table ")+6 + pos2=line.find("-")-1 + #print "table:",line[pos1:pos2]+"end" + return {'maxSeats':9, 'tableName':line[pos1:pos2]} + else: + raise FpdbError("invalid site ID") #end def parseTableLine #returns the hand no assigned by the poker site